@r_masseater/msch 0.66.0 → 0.67.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 +1 -0
- package/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +4 -4
- package/dist/cli.mjs +589 -367
- package/dist/cli.mjs.map +1 -1
- package/dist/config.mjs +4 -0
- package/dist/config.mjs.map +1 -1
- package/dist/{dependencies-BDQ7XSwU.mjs → dependencies-B9hf2aIC.mjs} +21 -21
- package/dist/dependencies-B9hf2aIC.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/{ignored-directories-DurTKTTN.mjs → ignored-directories-DzwJE3Y7.mjs} +2 -2
- package/dist/{ignored-directories-DurTKTTN.mjs.map → ignored-directories-DzwJE3Y7.mjs.map} +1 -1
- package/dist/{lookup-report-CPR_cj8F.mjs → lookup-report-FU7iFxSa.mjs} +3 -3
- package/dist/{lookup-report-CPR_cj8F.mjs.map → lookup-report-FU7iFxSa.mjs.map} +1 -1
- package/dist/manifest-texts-B8NV4YCS.mjs +59 -0
- package/dist/manifest-texts-B8NV4YCS.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{pass-records-DdiDtl_g.mjs → pass-records-C5tcV6Qh.mjs} +4 -4
- package/dist/{pass-records-DdiDtl_g.mjs.map → pass-records-C5tcV6Qh.mjs.map} +1 -1
- package/dist/{problem-glqVxx3h.mjs → problem-BvRpVt97.mjs} +2 -2
- package/dist/{problem-glqVxx3h.mjs.map → problem-BvRpVt97.mjs.map} +1 -1
- package/dist/publish.mjs +1 -1
- package/dist/{published-DnkuW2Tw.mjs → published-l5wN7u0m.mjs} +3 -3
- package/dist/{published-DnkuW2Tw.mjs.map → published-l5wN7u0m.mjs.map} +1 -1
- package/dist/published.d.mts +1 -0
- package/dist/published.mjs +118 -0
- package/dist/published.mjs.map +1 -0
- package/dist/refs.mjs +3 -3
- package/dist/{repository-files-mOPItI5o.mjs → repository-files-BxmKrOgg.mjs} +35 -22
- package/dist/repository-files-BxmKrOgg.mjs.map +1 -0
- package/dist/{runtime-mDBC8Yey.mjs → runtime-C6khg0XJ.mjs} +2 -2
- package/dist/{runtime-mDBC8Yey.mjs.map → runtime-C6khg0XJ.mjs.map} +1 -1
- package/dist/{syntax-A3ga4Ksb.mjs → syntax-V4CunkGE.mjs} +2 -2
- package/dist/{syntax-A3ga4Ksb.mjs.map → syntax-V4CunkGE.mjs.map} +1 -1
- package/dist/{upstream-exits-Bv2E-QO6.mjs → upstream-exits-DLZh68ZH.mjs} +4 -4
- package/dist/{upstream-exits-Bv2E-QO6.mjs.map → upstream-exits-DLZh68ZH.mjs.map} +1 -1
- package/dist/wake.mjs +1 -1
- package/dist/workspace-manifest-BC-1cRIJ.mjs +20 -0
- package/dist/workspace-manifest-BC-1cRIJ.mjs.map +1 -0
- package/dist/workspace-settings.mjs +4 -4
- package/package.json +7 -7
- package/skills/msch-checks/SKILL.md +6 -0
- package/dist/dependencies-BDQ7XSwU.mjs.map +0 -1
- package/dist/repository-files-mOPItI5o.mjs.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-FU7iFxSa.mjs";
|
|
3
|
+
import { t as runCli } from "./runtime-C6khg0XJ.mjs";
|
|
4
|
+
import { a as fieldsOf, c as namedCatalogsOf, d as specifiedIn, i as decodeManifest, n as baseName, t as manifestTexts } from "./manifest-texts-B8NV4YCS.mjs";
|
|
5
|
+
import { t as workspaceManifest } from "./workspace-manifest-BC-1cRIJ.mjs";
|
|
6
|
+
import { a as sent, i as publicLookup } from "./lookup-DjQU0W6q.mjs";
|
|
7
|
+
import { n as RepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
|
|
8
|
+
import { Array, Effect, HashMap, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
9
|
+
import semver from "semver";
|
|
10
|
+
import { HttpClientResponse } from "effect/http";
|
|
11
|
+
// src/features/check-published-versions/model/published-dependencies.ts
|
|
12
|
+
const REGISTRY = "https://registry.npmjs.org/";
|
|
13
|
+
const ABBREVIATED = "application/vnd.npm.install-v1+json";
|
|
14
|
+
const OWN_SCOPE = /^@(?:r_masseater|masseater\.dev)\//u;
|
|
15
|
+
const WORKSPACE_PROTOCOL = "workspace:";
|
|
16
|
+
const CATALOG_PROTOCOL = "catalog:";
|
|
17
|
+
const UNVERSIONED = "0.0.0";
|
|
18
|
+
const FIRST_LINE = 1;
|
|
19
|
+
const READ_CONCURRENCY = 16;
|
|
20
|
+
const LOOKUP_CONCURRENCY = 4;
|
|
21
|
+
const SECTIONS = ["dependencies", "optionalDependencies"];
|
|
22
|
+
const Packument = Schema.Struct({ versions: Schema.Record(Schema.String, Schema.Unknown) });
|
|
23
|
+
const stringOf = (value) => Option.liftPredicate(value, (found) => typeof found === "string");
|
|
24
|
+
const packageAt = (file, text) => pipe(decodeManifest(text), Option.filter((fields) => fields["private"] !== true), Option.flatMap((fields) => Option.all({
|
|
25
|
+
name: stringOf(fields["name"]),
|
|
26
|
+
version: stringOf(fields["version"])
|
|
27
|
+
}).pipe(Option.filter(({ version }) => version !== UNVERSIONED), Option.map(({ name, version }) => ({
|
|
28
|
+
file,
|
|
29
|
+
name,
|
|
30
|
+
version,
|
|
31
|
+
text,
|
|
32
|
+
specified: pipe(SECTIONS, Array.flatMap((section) => specifiedIn(fieldsOf(fields)[section])))
|
|
33
|
+
})))));
|
|
34
|
+
const OK = 200;
|
|
35
|
+
const NOT_FOUND = 404;
|
|
36
|
+
const versionsIn = (response) => {
|
|
37
|
+
if (response.status === OK) return HttpClientResponse.schemaBodyJson(Packument)(response).pipe(Effect.map(({ versions }) => Option.some(Record.keys(versions))));
|
|
38
|
+
if (response.status === NOT_FOUND) return Effect.succeedSome([]);
|
|
39
|
+
return Effect.succeedNone;
|
|
40
|
+
};
|
|
41
|
+
const publishedVersions = (name) => sent({
|
|
42
|
+
...publicLookup(`${REGISTRY}${String$1.replace("/", "%2f")(name)}`),
|
|
43
|
+
accept: ABBREVIATED
|
|
44
|
+
}).pipe(Effect.flatMap(versionsIn), Effect.orElseSucceed(() => Option.none()));
|
|
45
|
+
const catalogRanges = (settings) => pipe(settings, Option.map((found) => [...pipe(specifiedIn(found["catalog"]), Array.map(({ name, specifier }) => [name, specifier])), ...pipe(namedCatalogsOf(found), Array.flatMap(([, held]) => specifiedIn(held)), Array.map(({ name, specifier }) => [name, specifier]))]), Option.getOrElse(() => []), HashMap.fromIterable);
|
|
46
|
+
const lineOf = (text, dependency) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(`"${dependency}"`)(line)), Option.match({
|
|
47
|
+
onNone: () => FIRST_LINE,
|
|
48
|
+
onSome: (index) => index + FIRST_LINE
|
|
49
|
+
}));
|
|
50
|
+
const rangeOf = (catalog, { name, specifier }) => {
|
|
51
|
+
if (String$1.startsWith(CATALOG_PROTOCOL)(specifier)) return HashMap.get(catalog, name);
|
|
52
|
+
return Option.some(specifier);
|
|
53
|
+
};
|
|
54
|
+
const siblingWanted = (siblings, owner) => ({ name }) => pipe(HashMap.get(siblings, name), Option.map((sibling) => ({
|
|
55
|
+
owner,
|
|
56
|
+
name,
|
|
57
|
+
range: sibling.version,
|
|
58
|
+
sibling: Option.some(sibling)
|
|
59
|
+
})), Option.toArray);
|
|
60
|
+
const registryWanted = (catalog, owner) => (specified) => pipe(Option.liftPredicate(specified, ({ name }) => OWN_SCOPE.test(name)), Option.flatMap((own) => rangeOf(catalog, own)), Option.map((range) => ({
|
|
61
|
+
owner,
|
|
62
|
+
name: specified.name,
|
|
63
|
+
range,
|
|
64
|
+
sibling: Option.none()
|
|
65
|
+
})), Option.toArray);
|
|
66
|
+
const wantedBy = (siblings, catalog) => (owner) => pipe(owner.specified, Array.flatMap((specified) => {
|
|
67
|
+
if (String$1.startsWith(WORKSPACE_PROTOCOL)(specified.specifier)) return siblingWanted(siblings, owner)(specified);
|
|
68
|
+
return registryWanted(catalog, owner)(specified);
|
|
69
|
+
}));
|
|
70
|
+
const versionAtTip = (root, tip, { file }) => RepositoryFiles.pipe(Effect.flatMap((files) => files.readAtRevision(root, tip, file)), Effect.map((before) => pipe(before, Option.flatMap(decodeManifest), Option.flatMap((fields) => stringOf(fields["version"])))));
|
|
71
|
+
const notBumpedHere = (root, tip) => ({ sibling }) => Option.match(sibling, {
|
|
72
|
+
onNone: () => Effect.succeed(true),
|
|
73
|
+
onSome: (found) => Effect.map(versionAtTip(root, tip, found), Option.contains(found.version))
|
|
74
|
+
});
|
|
75
|
+
const lookupsOf = (wanted) => pipe(wanted, Array.map(({ name }) => name), Array.dedupe, (names) => Effect.forEach(names, (name) => Effect.map(publishedVersions(name), (found) => [name, found]), { concurrency: LOOKUP_CONCURRENCY }), Effect.map(HashMap.fromIterable));
|
|
76
|
+
const missingIn = (known) => ({ owner, name, range }) => pipe(HashMap.get(known, name), Option.flatten, Option.filter((published) => semver.maxSatisfying([...published], range) === null), Option.map(() => ({
|
|
77
|
+
file: owner.file,
|
|
78
|
+
line: lineOf(owner.text, name),
|
|
79
|
+
dependency: `${name}@${range}`,
|
|
80
|
+
reason: "is not on npm. Publish it first, or lower the range to a version that is."
|
|
81
|
+
})), Option.toArray);
|
|
82
|
+
const wantedIn = Effect.fn("wantedIn")(function* wantedIn(root) {
|
|
83
|
+
const manifests = yield* manifestTexts(root);
|
|
84
|
+
const packages = pipe(manifests, Array.flatMap(({ file, text }) => Option.toArray(packageAt(file, text))));
|
|
85
|
+
const siblings = HashMap.fromIterable(pipe(packages, Array.map((found) => [found.name, found])));
|
|
86
|
+
const settings = yield* workspaceManifest(root);
|
|
87
|
+
const catalog = catalogRanges(pipe(settings, Option.map(fieldsOf)));
|
|
88
|
+
return pipe(packages, Array.flatMap(wantedBy(siblings, catalog)));
|
|
89
|
+
});
|
|
90
|
+
/** @internal */
|
|
91
|
+
const missingVersions = Effect.fn("missingVersions")(function* missingVersions(root) {
|
|
92
|
+
const tip = yield* baseName;
|
|
93
|
+
const wanted = yield* wantedIn(root);
|
|
94
|
+
const keep = notBumpedHere(root, tip);
|
|
95
|
+
const kept = yield* Effect.forEach(wanted, (found) => Effect.map(keep(found), (unbumped) => ({
|
|
96
|
+
found,
|
|
97
|
+
unbumped
|
|
98
|
+
})), { concurrency: READ_CONCURRENCY });
|
|
99
|
+
const unchanged = pipe(kept, Array.filter(({ unbumped }) => unbumped), Array.map(({ found }) => found));
|
|
100
|
+
const known = yield* lookupsOf(unchanged);
|
|
101
|
+
return pipe(unchanged, Array.flatMap(missingIn(known)));
|
|
102
|
+
});
|
|
103
|
+
// bin/msch-published.ts
|
|
104
|
+
const Row = Schema.Struct({
|
|
105
|
+
file: Schema.String,
|
|
106
|
+
line: Schema.Finite,
|
|
107
|
+
dependency: Schema.String,
|
|
108
|
+
reason: Schema.String
|
|
109
|
+
});
|
|
110
|
+
const describeRow = (row) => `${row.file}:${String(row.line)} ${row.dependency} ${row.reason}`;
|
|
111
|
+
runCli(lookupReport({
|
|
112
|
+
row: Row,
|
|
113
|
+
rows: missingVersions,
|
|
114
|
+
describe: describeRow
|
|
115
|
+
}));
|
|
116
|
+
export {};
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=published.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published.mjs","names":["Arr","Rec","Str"],"sources":["../src/features/check-published-versions/model/published-dependencies.ts","../bin/msch-published.ts"],"sourcesContent":["import {\n Array as Arr,\n Effect,\n HashMap,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport semver from \"semver\";\n\nimport {\n decodeManifest,\n fieldsOf,\n namedCatalogsOf,\n specifiedIn,\n} from \"#/entities/package/index.ts\";\nimport type { Specified } from \"#/entities/package/index.ts\";\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport { baseName } from \"#/shared/lib/base-revision.ts\";\nimport { publicLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport { manifestTexts } from \"#/shared/lib/manifest-texts.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst REGISTRY = \"https://registry.npmjs.org/\";\nconst ABBREVIATED = \"application/vnd.npm.install-v1+json\";\nconst OWN_SCOPE = /^@(?:r_masseater|masseater\\.dev)\\//u;\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst CATALOG_PROTOCOL = \"catalog:\";\nconst UNVERSIONED = \"0.0.0\";\nconst FIRST_LINE = 1;\nconst READ_CONCURRENCY = 16;\nconst LOOKUP_CONCURRENCY = 4;\nconst SECTIONS = [\"dependencies\", \"optionalDependencies\"] as const;\n\n/** @internal */\nexport interface MissingVersion {\n readonly file: string;\n readonly line: number;\n readonly dependency: string;\n readonly reason: string;\n}\n\nconst Packument = Schema.Struct({ versions: Schema.Record(Schema.String, Schema.Unknown) });\n\ninterface Package {\n readonly file: string;\n readonly name: string;\n readonly version: string;\n readonly text: string;\n readonly specified: readonly Specified[];\n}\n\nconst stringOf = (value: unknown): Option.Option<string> =>\n Option.liftPredicate(value, (found): found is string => typeof found === \"string\");\n\nconst packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodeManifest(text),\n Option.filter((fields) => fields[\"private\"] !== true),\n Option.flatMap((fields) =>\n Option.all({ name: stringOf(fields[\"name\"]), version: stringOf(fields[\"version\"]) }).pipe(\n Option.filter(({ version }) => version !== UNVERSIONED),\n Option.map(({ name, version }): Package => ({\n file,\n name,\n version,\n text,\n specified: pipe(\n SECTIONS,\n Arr.flatMap((section) => specifiedIn(fieldsOf(fields)[section])),\n ),\n })),\n ),\n ),\n );\n\nconst OK = 200;\nconst NOT_FOUND = 404;\n\ntype Versions = Effect.Effect<Option.Option<readonly string[]>, unknown>;\n\nconst versionsIn = (response: HttpClientResponse.HttpClientResponse): Versions => {\n if (response.status === OK) {\n return HttpClientResponse.schemaBodyJson(Packument)(response).pipe(\n Effect.map(({ versions }) => Option.some(Rec.keys(versions))),\n );\n }\n if (response.status === NOT_FOUND) {\n return Effect.succeedSome<readonly string[]>([]);\n }\n return Effect.succeedNone;\n};\n\nconst publishedVersions = (\n name: string,\n): Effect.Effect<Option.Option<readonly string[]>, never, HttpClient.HttpClient> =>\n sent({\n ...publicLookup(`${REGISTRY}${Str.replace(\"/\", \"%2f\")(name)}`),\n accept: ABBREVIATED,\n }).pipe(\n Effect.flatMap(versionsIn),\n Effect.orElseSucceed(() => Option.none<readonly string[]>()),\n );\n\nconst catalogRanges = (\n settings: Option.Option<Readonly<Record<string, unknown>>>,\n): HashMap.HashMap<string, string> =>\n pipe(\n settings,\n Option.map((found) => [\n ...pipe(\n specifiedIn(found[\"catalog\"]),\n Arr.map(({ name, specifier }) => [name, specifier] as const),\n ),\n ...pipe(\n namedCatalogsOf(found),\n Arr.flatMap(([, held]) => specifiedIn(held)),\n Arr.map(({ name, specifier }) => [name, specifier] as const),\n ),\n ]),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n HashMap.fromIterable,\n );\n\nconst lineOf = (text: string, dependency: string): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes(`\"${dependency}\"`)(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\ninterface Wanted {\n readonly owner: Package;\n readonly name: string;\n readonly range: string;\n readonly sibling: Option.Option<Package>;\n}\n\nconst rangeOf = (\n catalog: HashMap.HashMap<string, string>,\n { name, specifier }: Specified,\n): Option.Option<string> => {\n if (Str.startsWith(CATALOG_PROTOCOL)(specifier)) {\n return HashMap.get(catalog, name);\n }\n return Option.some(specifier);\n};\n\nconst siblingWanted =\n (siblings: HashMap.HashMap<string, Package>, owner: Package) =>\n ({ name }: Specified): readonly Wanted[] =>\n pipe(\n HashMap.get(siblings, name),\n Option.map((sibling): Wanted => ({\n owner,\n name,\n range: sibling.version,\n sibling: Option.some(sibling),\n })),\n Option.toArray,\n );\n\nconst registryWanted =\n (catalog: HashMap.HashMap<string, string>, owner: Package) =>\n (specified: Specified): readonly Wanted[] =>\n pipe(\n Option.liftPredicate(specified, ({ name }) => OWN_SCOPE.test(name)),\n Option.flatMap((own) => rangeOf(catalog, own)),\n Option.map((range): Wanted => ({\n owner,\n name: specified.name,\n range,\n sibling: Option.none(),\n })),\n Option.toArray,\n );\n\nconst wantedBy =\n (siblings: HashMap.HashMap<string, Package>, catalog: HashMap.HashMap<string, string>) =>\n (owner: Package): readonly Wanted[] =>\n pipe(\n owner.specified,\n Arr.flatMap((specified) => {\n if (Str.startsWith(WORKSPACE_PROTOCOL)(specified.specifier)) {\n return siblingWanted(siblings, owner)(specified);\n }\n return registryWanted(catalog, owner)(specified);\n }),\n );\n\nconst versionAtTip = (\n root: string,\n tip: string,\n { file }: Package,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n RepositoryFiles.pipe(\n Effect.flatMap((files) => files.readAtRevision(root, tip, file)),\n Effect.map((before) =>\n pipe(\n before,\n Option.flatMap(decodeManifest),\n Option.flatMap((fields) => stringOf(fields[\"version\"])),\n ),\n ),\n );\n\nconst notBumpedHere =\n (root: string, tip: string) =>\n ({ sibling }: Wanted): Effect.Effect<boolean, never, RepositoryFiles> =>\n Option.match(sibling, {\n onNone: () => Effect.succeed(true),\n onSome: (found) => Effect.map(versionAtTip(root, tip, found), Option.contains(found.version)),\n });\n\nconst lookupsOf = (\n wanted: readonly Wanted[],\n): Effect.Effect<\n HashMap.HashMap<string, Option.Option<readonly string[]>>,\n never,\n HttpClient.HttpClient\n> =>\n pipe(\n wanted,\n Arr.map(({ name }) => name),\n Arr.dedupe,\n (names) =>\n Effect.forEach(\n names,\n (name) => Effect.map(publishedVersions(name), (found) => [name, found] as const),\n { concurrency: LOOKUP_CONCURRENCY },\n ),\n Effect.map(HashMap.fromIterable),\n );\n\nconst missingIn =\n (known: HashMap.HashMap<string, Option.Option<readonly string[]>>) =>\n ({ owner, name, range }: Wanted): readonly MissingVersion[] =>\n pipe(\n HashMap.get(known, name),\n Option.flatten,\n Option.filter((published) => semver.maxSatisfying([...published], range) === null),\n Option.map((): MissingVersion => ({\n file: owner.file,\n line: lineOf(owner.text, name),\n dependency: `${name}@${range}`,\n reason: \"is not on npm. Publish it first, or lower the range to a version that is.\",\n })),\n Option.toArray,\n );\n\nconst wantedIn = Effect.fn(\"wantedIn\")(function* wantedIn(root: string) {\n const manifests = yield* manifestTexts(root);\n const packages = pipe(\n manifests,\n Arr.flatMap(({ file, text }) => Option.toArray(packageAt(file, text))),\n );\n const siblings = HashMap.fromIterable(\n pipe(\n packages,\n Arr.map((found) => [found.name, found] as const),\n ),\n );\n const settings = yield* workspaceManifest(root);\n const catalog = catalogRanges(pipe(settings, Option.map(fieldsOf)));\n return pipe(packages, Arr.flatMap(wantedBy(siblings, catalog)));\n});\n\n/** @internal */\nexport const missingVersions = Effect.fn(\"missingVersions\")(function* missingVersions(\n root: string,\n) {\n const tip = yield* baseName;\n const wanted = yield* wantedIn(root);\n const keep = notBumpedHere(root, tip);\n const kept = yield* Effect.forEach(\n wanted,\n (found) => Effect.map(keep(found), (unbumped) => ({ found, unbumped })),\n { concurrency: READ_CONCURRENCY },\n );\n const unchanged = pipe(\n kept,\n Arr.filter(({ unbumped }) => unbumped),\n Arr.map(({ found }) => found),\n );\n const known = yield* lookupsOf(unchanged);\n return pipe(unchanged, Arr.flatMap(missingIn(known)));\n});\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { missingVersions } from \"#/features/check-published-versions/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n dependency: Schema.String,\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.dependency} ${row.reason}`;\n\nrunCli(lookupReport({ row: Row, rows: missingVersions, describe: describ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AAC;AAID,MAAM,eAAe,QACnB,GAAG,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,IAAI,WAAW,GAAG,IAAI;AAE3D,OAAO,aAAa;CAAE,KAAK;CAAK,MAAM;CAAiB,UAAU;AAAY,CAAC,CAAC"}
|
package/dist/refs.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
3
|
-
import { t as runCli } from "./runtime-
|
|
4
|
-
import { a as groupOf, n as RepositoryFiles } from "./repository-files-
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-FU7iFxSa.mjs";
|
|
3
|
+
import { t as runCli } from "./runtime-C6khg0XJ.mjs";
|
|
4
|
+
import { a as groupOf, n as RepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
|
|
5
5
|
import { a as sent, i as publicLookup, n as githubToken, r as jsonLookup } from "./lookup-DjQU0W6q.mjs";
|
|
6
6
|
import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
|
|
7
7
|
import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
@@ -60,44 +60,45 @@ const cacheOperations = (fs, path, digest) => ({
|
|
|
60
60
|
hash: (text) => digest.digestHex(Digest.sha256, encoder.encode(text)),
|
|
61
61
|
hashFile: (file) => fs.readFile(file).pipe(Effect.flatMap((bytes) => digest.digestHex(Digest.sha256, bytes)), Effect.option)
|
|
62
62
|
});
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
], "\0");
|
|
74
|
-
return RepositoryFiles.of({
|
|
75
|
-
generatedFiles: (root) => gitFiles(root, ["--", GENERATED_PATHSPEC]).pipe(Effect.map(Array.map((file) => path.join(root, file)))),
|
|
76
|
-
listedFiles: (root) => gitFiles(root, LISTED_ARGS),
|
|
77
|
-
ownedFiles: (root) => gitFiles(root, [
|
|
63
|
+
const gitFiles = (gitPaths) => (root, args) => gitPaths(root, [
|
|
64
|
+
"ls-files",
|
|
65
|
+
"-z",
|
|
66
|
+
...args
|
|
67
|
+
], "\0");
|
|
68
|
+
const gitOperations = (gitPaths, gitText) => {
|
|
69
|
+
const files = gitFiles(gitPaths);
|
|
70
|
+
return {
|
|
71
|
+
listedFiles: (root) => files(root, LISTED_ARGS),
|
|
72
|
+
ownedFiles: (root) => files(root, [
|
|
78
73
|
...LISTED_ARGS,
|
|
79
74
|
"--",
|
|
80
75
|
...OWNED_PATHSPECS
|
|
81
76
|
]),
|
|
82
|
-
linkedFiles: (root) =>
|
|
83
|
-
readLink: (file) => fs.readLink(file).pipe(Effect.option),
|
|
77
|
+
linkedFiles: (root) => files(root, STAGED_ARGS).pipe(Effect.map(Array.flatMap(linkName))),
|
|
84
78
|
mergeBase: (root, revision) => gitText(root, [
|
|
85
79
|
"merge-base",
|
|
86
80
|
"HEAD",
|
|
87
81
|
revision
|
|
88
82
|
]).pipe(Effect.map(Option.map(String.trim)), Effect.map(Option.filter(String.isNonEmpty))),
|
|
83
|
+
changedFiles: (root, revision) => gitPaths(root, [
|
|
84
|
+
"diff",
|
|
85
|
+
"--name-only",
|
|
86
|
+
"--no-renames",
|
|
87
|
+
"-z",
|
|
88
|
+
revision
|
|
89
|
+
], "\0"),
|
|
89
90
|
readAtRevision: (root, revision, name) => gitText(root, ["show", `${revision}:${name}`]),
|
|
90
|
-
matchingFiles: (root, pathspecs) =>
|
|
91
|
+
matchingFiles: (root, pathspecs) => files(root, [
|
|
91
92
|
...LISTED_ARGS,
|
|
92
93
|
"--",
|
|
93
94
|
...pathspecs
|
|
94
95
|
]),
|
|
95
|
-
trackedFiles: (root, pathspecs) =>
|
|
96
|
+
trackedFiles: (root, pathspecs) => files(root, [
|
|
96
97
|
...TRACKED_ARGS,
|
|
97
98
|
"--",
|
|
98
99
|
...pathspecs
|
|
99
100
|
]),
|
|
100
|
-
ignoredFiles: (root, pathspecs) =>
|
|
101
|
+
ignoredFiles: (root, pathspecs) => files(root, [
|
|
101
102
|
...IGNORED_ARGS,
|
|
102
103
|
"--",
|
|
103
104
|
...pathspecs
|
|
@@ -106,7 +107,19 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
|
|
|
106
107
|
"check-ignore",
|
|
107
108
|
"--",
|
|
108
109
|
...paths
|
|
109
|
-
], "\n")
|
|
110
|
+
], "\n")
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* nodeRepositoryFiles() {
|
|
114
|
+
const fs = yield* FileSystem.FileSystem;
|
|
115
|
+
const path = yield* Path.Path;
|
|
116
|
+
const digest = yield* Digest.Digest;
|
|
117
|
+
const gitPaths = yield* gitPathsService;
|
|
118
|
+
const gitText = yield* gitTextService;
|
|
119
|
+
return RepositoryFiles.of({
|
|
120
|
+
generatedFiles: (root) => gitFiles(gitPaths)(root, ["--", GENERATED_PATHSPEC]).pipe(Effect.map(Array.map((file) => path.join(root, file)))),
|
|
121
|
+
...gitOperations(gitPaths, gitText),
|
|
122
|
+
readLink: (file) => fs.readLink(file).pipe(Effect.option),
|
|
110
123
|
readFile: (file) => fs.readFileString(file).pipe(Effect.option),
|
|
111
124
|
exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),
|
|
112
125
|
realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),
|
|
@@ -123,4 +136,4 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
|
|
|
123
136
|
})).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
|
|
124
137
|
export { groupOf as a, nodeServicesLayer as i, RepositoryFiles as n, nodeRepositoryFiles as r, NODE_MODULES as t };
|
|
125
138
|
|
|
126
|
-
//# sourceMappingURL=repository-files-
|
|
139
|
+
//# sourceMappingURL=repository-files-BxmKrOgg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-files-BxmKrOgg.mjs","names":["Str","Str","Arr"],"sources":["../../lint-host/src/shared/lib/collections.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import { Array as Arr, Option, Order, Record as Rec, String as Str, pipe } from \"effect\";\n\nconst byKey = Order.mapInput(Str.Order, ([key]: readonly [string, unknown]) => key);\n\nexport const sortedRecord = <Value>(\n entries: readonly (readonly [string, Value])[],\n): Readonly<Record<string, Value>> => Rec.fromEntries(Arr.sort(entries, byKey));\n\nconst NEXT = 1;\n\nexport interface Grouped<Head, Item> {\n readonly head: Head;\n readonly items: readonly Item[];\n}\n\nexport const groupedUnder =\n <Item, Head>(asHead: (item: Item) => Option.Option<Head>) =>\n (closes: (head: Head, item: Item) => boolean) =>\n (items: readonly Item[]): readonly Grouped<Head, Item>[] =>\n pipe(\n items,\n Arr.flatMap((item, index) =>\n pipe(\n asHead(item),\n Option.map((head): Grouped<Head, Item> => ({\n head,\n items: pipe(\n items,\n Arr.drop(index + NEXT),\n Arr.takeWhile((next) => !closes(head, next)),\n ),\n })),\n Option.toArray,\n ),\n ),\n );\n\nexport const ancestorsBy =\n <Node>(parentOf: (node: Node) => Option.Option<Node>) =>\n (node: Node): readonly Node[] =>\n Arr.unfold(parentOf(node), (current) =>\n pipe(\n current,\n Option.map((found) => [found, parentOf(found)] as const),\n ),\n );\n\nexport const groupOf =\n (name: string) =>\n (found: RegExpMatchArray | null): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(found),\n Option.flatMap((match) => Option.fromNullishOr(match.groups)),\n Option.flatMap((groups) => Option.fromNullishOr(groups[name])),\n );\n","import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Digest } from \"effect/crypto\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\nconst MISSING_SIZE = 0;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst OWNED_PATHSPECS = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\nexport const NODE_MODULES = \"node_modules\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\", `--exclude=${NODE_MODULES}/`];\nconst IGNORED_ARGS = [\"--others\", \"--ignored\", \"--exclude-standard\"];\nconst TRACKED_ARGS = [\"--cached\"];\nconst STAGED_ARGS = [\"--stage\"];\nconst LINK_ENTRY = /^120000 \\S+ \\d+\\t(?<name>.+)$/u;\n\nexport class RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly walkDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly writeFile: (file: string, text: string) => Effect.Effect<void>;\n readonly removeFile: (file: string) => Effect.Effect<void>;\n readonly hash: (text: string) => Effect.Effect<string>;\n readonly hashFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly ownedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly linkedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly readLink: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly mergeBase: (root: string, revision: string) => Effect.Effect<Option.Option<string>>;\n readonly changedFiles: (root: string, revision: string) => Effect.Effect<readonly string[]>;\n readonly readAtRevision: (\n root: string,\n revision: string,\n name: string,\n ) => Effect.Effect<Option.Option<string>>;\n readonly matchingFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly trackedFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredPaths: (\n root: string,\n paths: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/shared/lib/repository-files/RepositoryFiles\") {}\n\nconst SUCCESS = 0;\n\ntype GitText = (root: string, args: readonly string[]) => Effect.Effect<Option.Option<string>>;\n\nconst gitTextService = Effect.gen(function* gitTextService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitText: GitText = (root, args) =>\n Effect.gen(function* readText() {\n const handle = yield* ChildProcess.make(\"git\", args, { cwd: root, stdin: \"ignore\" });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return Option.liftPredicate(text, () => code === SUCCESS);\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return gitText;\n});\n\ntype GitPaths = (\n root: string,\n args: readonly string[],\n separator: string,\n) => Effect.Effect<readonly string[]>;\n\nconst gitPathsService = Effect.gen(function* gitPathsService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitPaths: GitPaths = (root, args, separator) =>\n Effect.gen(function* listPaths() {\n const handle = yield* ChildProcess.make(\"git\", args, {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, separator), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return gitPaths;\n});\n\nconst linkName = (entry: string): readonly string[] =>\n Option.toArray(groupOf(\"name\")(LINK_ENTRY.exec(entry)));\n\ntype CacheOperations = Pick<\n typeof RepositoryFiles.Service,\n \"walkDirectory\" | \"writeFile\" | \"removeFile\" | \"hash\" | \"hashFile\"\n>;\n\nconst encoder = new TextEncoder();\n\nconst cacheOperations = (\n fs: FileSystem.FileSystem,\n path: Path.Path,\n digest: Digest.Digest[\"Service\"],\n): CacheOperations => ({\n walkDirectory: (directory) =>\n fs\n .readDirectory(directory, { recursive: true })\n .pipe(Effect.orElseSucceed((): readonly string[] => [])),\n writeFile: (file, text) =>\n fs\n .makeDirectory(path.dirname(file), { recursive: true })\n .pipe(Effect.andThen(fs.writeFileString(file, text)), Effect.ignore),\n removeFile: (file) => fs.remove(file, { force: true }).pipe(Effect.ignore),\n hash: (text) => digest.digestHex(Digest.sha256, encoder.encode(text)),\n hashFile: (file) =>\n fs.readFile(file).pipe(\n Effect.flatMap((bytes) => digest.digestHex(Digest.sha256, bytes)),\n Effect.option,\n ),\n});\n\nconst gitFiles =\n (gitPaths: GitPaths) =>\n (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n gitPaths(root, [\"ls-files\", \"-z\", ...args], \"\\0\");\n\nconst gitOperations = (\n gitPaths: GitPaths,\n gitText: GitText,\n): Pick<\n RepositoryFiles[\"Service\"],\n | \"changedFiles\"\n | \"ignoredFiles\"\n | \"ignoredPaths\"\n | \"linkedFiles\"\n | \"listedFiles\"\n | \"matchingFiles\"\n | \"mergeBase\"\n | \"ownedFiles\"\n | \"readAtRevision\"\n | \"trackedFiles\"\n> => {\n const files = gitFiles(gitPaths);\n return {\n listedFiles: (root) => files(root, LISTED_ARGS),\n ownedFiles: (root) => files(root, [...LISTED_ARGS, \"--\", ...OWNED_PATHSPECS]),\n linkedFiles: (root) => files(root, STAGED_ARGS).pipe(Effect.map(Arr.flatMap(linkName))),\n mergeBase: (root, revision) =>\n gitText(root, [\"merge-base\", \"HEAD\", revision]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n changedFiles: (root, revision) =>\n gitPaths(root, [\"diff\", \"--name-only\", \"--no-renames\", \"-z\", revision], \"\\0\"),\n readAtRevision: (root, revision, name) => gitText(root, [\"show\", `${revision}:${name}`]),\n matchingFiles: (root, pathspecs) => files(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n trackedFiles: (root, pathspecs) => files(root, [...TRACKED_ARGS, \"--\", ...pathspecs]),\n ignoredFiles: (root, pathspecs) => files(root, [...IGNORED_ARGS, \"--\", ...pathspecs]),\n ignoredPaths: (root, paths) => gitPaths(root, [\"check-ignore\", \"--\", ...paths], \"\\n\"),\n };\n};\n\nexport const nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const digest = yield* Digest.Digest;\n const gitPaths = yield* gitPathsService;\n const gitText = yield* gitTextService;\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(gitPaths)(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n ...gitOperations(gitPaths, gitText),\n readLink: (file) => fs.readLink(file).pipe(Effect.option),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n ...cacheOperations(fs, path, digest),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));\n"],"mappings":";;;;AAEc,MAAM,SAASA,OAAI,QAAQ,CAAC,SAAqC,GAAG;AA6ClF,MAAa,WACV,UACA,UACC,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,SAAS,UAAU,OAAO,cAAc,MAAM,MAAM,CAAC,GAC5D,OAAO,SAAS,WAAW,OAAO,cAAc,OAAO,KAAK,CAAC,CAC/D;;;AC/BJ,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;AAEA,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB,CAAC,qCAAqC,oCAAoC;AAClG,MAAa,eAAe;AAC5B,MAAM,cAAc;CAAC;CAAY;CAAY;CAAsB,aAAa,aAAa;AAAE;AAC/F,MAAM,eAAe;CAAC;CAAY;CAAa;AAAoB;AACnE,MAAM,eAAe,CAAC,UAAU;AAChC,MAAM,cAAc,CAAC,SAAS;AAC9B,MAAM,aAAa;AAEnB,IAAa,kBAAb,cAAqC,QAAQ,QAgD3C,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAEtE,MAAM,UAAU;AAIhB,MAAM,iBAAiB,OAAO,IAAI,UAAU,iBAAiB;CAC3D,MAAM,UAAU,O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OAAO,MACT;EACF,WAAW,SACT,GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,OAAO,KAAK,IAAI,CAAC,GACtC,OAAO,oBAAoB,YAAY,CACzC;EACF,OAAO,GAAG,aAAa,KAAK,KAAK,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as nodeRepositoryFiles } from "./repository-files-
|
|
1
|
+
import { r as nodeRepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
|
|
2
2
|
import { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from "effect";
|
|
3
3
|
import { FetchHttpClient } from "effect/http";
|
|
4
4
|
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
@@ -42,4 +42,4 @@ const runCli = (program) => {
|
|
|
42
42
|
};
|
|
43
43
|
export { ProblemsFound as n, writeStdout as r, runCli as t };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=runtime-
|
|
45
|
+
//# sourceMappingURL=runtime-C6khg0XJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-
|
|
1
|
+
{"version":3,"file":"runtime-C6khg0XJ.mjs","names":["nodeServices"],"sources":["../src/app/output.ts","../../node-main/src/features/run-main/model/run-main.ts","../src/app/runtime.ts"],"sourcesContent":["import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n","import { runMain as nodeRuntimeRunMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport type { NodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, Layer, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\n\n/** @internal */\nexport type Platform = NodeServices | HttpClient.HttpClient;\n\n/** @internal */\nexport type Run<Provided> = <Success, Failure>(\n program: Effect.Effect<Success, Failure, Platform | Provided>,\n) => void;\n\n/** @internal */\nexport type Report<Provided> = <Failure>(\n cause: Cause.Cause<Failure>,\n) => Effect.Effect<void, never, Platform | Provided>;\n\nconst platform = Layer.mergeAll(nodeServices, FetchHttpClient.layer);\n\nconst runWithTracingAnd =\n <Provided, LayerFailure>({\n serviceName,\n services,\n onFailure,\n }: Readonly<{\n serviceName: string;\n services: Layer.Layer<Provided, LayerFailure, Platform>;\n onFailure?: Report<Provided>;\n }>): Run<Provided> =>\n (program) => {\n const tracing = Otlp.layerFromConfig({ resource: { serviceName } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n );\n const provided = Layer.provideMerge(services, platform);\n const report = Option.fromNullishOr(onFailure);\n const reported = Option.match(report, {\n onNone: () => program,\n onSome: (handler) => Effect.tapCause(program, handler),\n });\n nodeRuntimeRunMain(\n Layer.mergeAll(tracing, provided).pipe(\n Layer.build,\n Effect.flatMap((context) => Effect.provideContext(reported, context)),\n Effect.scoped,\n ),\n { disableErrorReporting: Option.isSome(report) },\n );\n };\n\nconst runWithTracing = (serviceName: string): Run<never> =>\n runWithTracingAnd({ serviceName, services: Layer.empty });\n\n/** @internal */\nexport const runMainWith = runWithTracingAnd;\n\n/** @internal */\nexport const runMain = runWithTracing;\n","import { runMainWith } from \"@r_masseater/node-main\";\nimport { Cause, Effect, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport type { HttpClient } from \"effect/http\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\n/** @internal */\nexport const runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n | HttpClient.HttpClient\n >,\n): void => {\n runMainWith({\n serviceName: \"msch\",\n services: nodeRepositoryFiles,\n onFailure: reportFailure,\n })(program);\n};\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC,CAAC;;AAGH,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC;;ACOD,MAAM,WAAW,MAAM,SAASA,OAAc,gBAAgB,KAAK;AAEnE,MAAM,qBACqB,EACvB,aACA,UACA,iBAMD,YAAY;CACX,MAAM,UAAU,KAAK,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,KAClE,MAAM,QAAQ,kBAAkB,SAAS,GACzC,MAAM,QAAQ,gBAAgB,KAAK,CACrC;CACA,MAAM,WAAW,MAAM,aAAa,UAAU,QAAQ;CACtD,MAAM,SAAS,OAAO,cAAc,SAAS;CAC7C,MAAM,WAAW,OAAO,MAAM,QAAQ;EACpC,cAAc;EACd,SAAS,YAAY,OAAO,SAAS,SAAS,OAAO;CACvD,CAAC;CACD,QACE,MAAM,SAAS,SAAS,QAAQ,CAAC,CAAC,KAChC,MAAM,OACN,OAAO,SAAS,YAAY,OAAO,eAAe,UAAU,OAAO,CAAC,GACpE,OAAO,MACT,GACA,EAAE,uBAAuB,OAAO,OAAO,MAAM,EAAE,CACjD;AACF;;AAMF,MAAa,cAAc;;AChD3B,MAAM,iBACJ,UAEA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAE3B,IADe,MAAM,gBAAgB,KAAK,CAAC,CAAC,KAAK,OAAO,OAAO,OAAO,GAAG,aAAa,CAAC,CAC9E,GACP;CAEF,OAAO,OAAO,KAAK,GAAG,MAAM,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AAC9F,CAAC;;AAGH,MAAa,UACX,YAUS;CACT,YAAY;EACV,aAAa;EACb,UAAU;EACV,WAAW;CACb,CAAC,CAAC,CAAC,OAAO;AACZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as NODE_MODULES } from "./repository-files-
|
|
1
|
+
import { t as NODE_MODULES } from "./repository-files-BxmKrOgg.mjs";
|
|
2
2
|
import { Array, Option, String, pipe } from "effect";
|
|
3
3
|
import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
|
|
4
4
|
import { isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBlock, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportAssignment, isExportDeclaration, isExpressionStatement, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isLiteralTypeNode, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, isPropertySignatureDeclaration, isReturnStatement, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
|
|
@@ -80,4 +80,4 @@ const moduleSpecifierOf = (statement) => {
|
|
|
80
80
|
const importedModulesOf = (sourceFile) => pipe(sourceFile.statements, Array.map((statement) => moduleSpecifierOf(statement)), Array.getSomes);
|
|
81
81
|
export { isPropertyAccessExpression as $, getNameOfDeclaration as A, isExportDeclaration as B, IndexKind as C, SyntaxKind as D, SymbolFlags$1 as E, isBlock as F, isImportDeclaration as G, isFunctionDeclaration as H, isCallExpression as I, isModuleDeclaration as J, isInterfaceDeclaration as K, isClassDeclaration as L, isArrayLiteralExpression as M, isArrowFunction as N, getJSDocTags as O, isBinaryExpression as P, isParenthesizedExpression as Q, isElementAccessExpression as R, API as S, SignatureKind as T, isFunctionExpression as U, isExpressionStatement as V, isIdentifier as W, isNumericLiteral as X, isNewExpression as Y, isObjectLiteralExpression as Z, referencedSymbols as _, declarationsOf as a, isSpreadElement as at, symbolAtLocation as b, importedModulesOf as c, isTypeLiteralNode as ct, isInsideAny as d, isVariableDeclaration as dt, isPropertyAssignment as et, isOutsideDeclaration as f, isVariableDeclarationList as ft, propertyNamesOf as g, packageOf as h, contains as i, isSourceFile as it, getTextOfJSDocComment as j, getLeadingCommentRanges as k, isExternalDeclaration as l, isTypeReferenceNode as lt, lineOf as m, childrenOf as n, isSatisfiesExpression as nt, declaresAType as o, isStringLiteral as ot, isTypeDeclaration as p, isVariableStatement as pt, isModuleBlock as q, columnOf as r, isSignatureDeclaration as rt, descendantsOf as s, isTypeAliasDeclaration as st, carriesTag as t, isReturnStatement as tt, isGenericDeclaration as u, isUnionTypeNode as ut, resolvedSymbol as v, InternalSymbolName as w, uniqueByReference as x, symbolAt as y, isEnumDeclaration as z };
|
|
82
82
|
|
|
83
|
-
//# sourceMappingURL=syntax-
|
|
83
|
+
//# sourceMappingURL=syntax-V4CunkGE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-A3ga4Ksb.mjs","names":["Arr","Str"],"sources":["../src/shared/lib/syntax.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isPropertyAccessExpression,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nexport const isOutsideDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n program.isSourceFileDefaultLibrary(declaration.getSourceFile()) ||\n isExternalDeclaration(program)(declaration);\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAtLocation =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node));\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n symbolAtLocation(checker)(node).pipe(Option.map(resolvedSymbol(checker)));\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isInsideAny =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst membersOf = (declaration: Node): readonly Node[] => {\n if (isInterfaceDeclaration(declaration) || isClassDeclaration(declaration)) {\n return declaration.members;\n }\n if (isTypeAliasDeclaration(declaration) && isTypeLiteralNode(declaration.type)) {\n return declaration.type.members;\n }\n return [];\n};\n\nconst isTagNamed =\n (name: string) =>\n (member: Node): boolean =>\n (isPropertySignatureDeclaration(member) || isPropertyDeclaration(member)) &&\n pipe(\n Option.fromUndefinedOr(member.type),\n Option.exists(\n (type) =>\n isLiteralTypeNode(type) && isStringLiteral(type.literal) && type.literal.text === name,\n ),\n );\n\nexport const declaresAType = (declarations: readonly Node[]): boolean =>\n pipe(\n declarations,\n Arr.some((declaration) => isTypeDeclaration(declaration) || isClassDeclaration(declaration)),\n );\n\nexport const carriesTag =\n (name: string) =>\n (declarations: readonly Node[]): boolean =>\n pipe(declarations, Arr.flatMap(membersOf), Arr.some(isTagNamed(name)));\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nexport const importedModulesOf = (sourceFile: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,uBAAuB,WAAW,MAC1EA,MAAI,wBAAwB,YAAY,kBAAkB,CAAC,CAAC;AAE9D,MAAa,mBACV,aACA,SACC,KACE,QAAQ,oBAAoB,IAAI,GAChCA,MAAI,KAAK,aAAa,SAAS,IAAI,CACrC;AAEJ,MAAM,qBAAqB,cAA2C;CACpE,IAAI,CAAC,oBAAoB,SAAS,KAAK,CAAC,oBAAoB,SAAS,GACnE,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,gBAAgB,UAAU,eAAe,CAAC,CAAC,KACvD,OAAO,QAAQ,cAAc,gBAAgB,SAAS,CAAC,GACvD,OAAO,KAAK,cAAc,UAAU,IAAI,CAC1C;AACF;AAEA,MAAa,qBAAqB,eAChC,KACE,WAAW,YACXA,MAAI,KAAK,cAAc,kBAAkB,SAAS,CAAC,GACnDA,MAAI,QACN"}
|
|
1
|
+
{"version":3,"file":"syntax-V4CunkGE.mjs","names":["Arr","Str"],"sources":["../src/shared/lib/syntax.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isPropertyAccessExpression,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nexport const isOutsideDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n program.isSourceFileDefaultLibrary(declaration.getSourceFile()) ||\n isExternalDeclaration(program)(declaration);\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAtLocation =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node));\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n symbolAtLocation(checker)(node).pipe(Option.map(resolvedSymbol(checker)));\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isInsideAny =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst membersOf = (declaration: Node): readonly Node[] => {\n if (isInterfaceDeclaration(declaration) || isClassDeclaration(declaration)) {\n return declaration.members;\n }\n if (isTypeAliasDeclaration(declaration) && isTypeLiteralNode(declaration.type)) {\n return declaration.type.members;\n }\n return [];\n};\n\nconst isTagNamed =\n (name: string) =>\n (member: Node): boolean =>\n (isPropertySignatureDeclaration(member) || isPropertyDeclaration(member)) &&\n pipe(\n Option.fromUndefinedOr(member.type),\n Option.exists(\n (type) =>\n isLiteralTypeNode(type) && isStringLiteral(type.literal) && type.literal.text === name,\n ),\n );\n\nexport const declaresAType = (declarations: readonly Node[]): boolean =>\n pipe(\n declarations,\n Arr.some((declaration) => isTypeDeclaration(declaration) || isClassDeclaration(declaration)),\n );\n\nexport const carriesTag =\n (name: string) =>\n (declarations: readonly Node[]): boolean =>\n pipe(declarations, Arr.flatMap(membersOf), Arr.some(isTagNamed(name)));\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n"],"mappings":";;;;;;AAkCA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAa,qBAA2B,UACtCA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAa,cAAc,SAAgC;CACzD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAa,aAAa,aAA6B;CACrD,MAAM,eAAe,KACnB,UACAC,OAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,OAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,OAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C,IAAIA,OAAI,WAAW,YAAY,CAAC,CAAC,YAAY,GAC3C,OAAO,KAAKD,MAAI,KAAK,UAAU,eAAe,GAAGA,MAAI,KAAK,GAAG,CAAC;CAEhE,OAAO,KAAKA,MAAI,KAAK,UAAU,iBAAiB,GAAGA,MAAI,KAAK,GAAG,CAAC;AAClE;AAEA,MAAa,iBAAiB,SAC5B,KACE,WAAW,IAAI,GACfA,MAAI,SAAS,UAAUA,MAAI,QAAQ,cAAc,KAAK,GAAG,KAAK,CAAC,CACjE;AAEF,MAAM,kBACH,aACA,eACC,CAAC,QAAQ,2BAA2B,UAAU,MAC7CC,OAAI,SAAS,oBAAoB,CAAC,CAAC,WAAW,QAAQ,KACrD,QAAQ,gCAAgC,UAAU;AAExD,MAAa,yBACV,aACA,gBACC,eAAe,OAAO,CAAC,CAAC,YAAY,cAAc,CAAC;AAEvD,MA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,wBAAwB,iBAClC,uBAAuB,WAAW,KAAK,uBAAuB,WAAW,MAC1EA,MAAI,wBAAwB,YAAY,kBAAkB,CAAC,CAAC;AAE9D,MAAa,mBACV,aACA,SACC,KACE,QAAQ,oBAAoB,IAAI,GAChCA,MAAI,KAAK,aAAa,SAAS,IAAI,CACrC;AAEJ,MAAM,qBAAqB,cAA2C;CACpE,IAAI,CAAC,oBAAoB,SAAS,KAAK,CAAC,oBAAoB,SAAS,GACnE,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,gBAAgB,UAAU,eAAe,CAAC,CAAC,KACvD,OAAO,QAAQ,cAAc,gBAAgB,SAAS,CAAC,GACvD,OAAO,KAAK,cAAc,UAAU,IAAI,CAC1C;AACF;AAEA,MAAa,qBAAqB,eAChC,KACE,WAAW,YACXA,MAAI,KAAK,cAAc,kBAAkB,SAAS,CAAC,GACnDA,MAAI,QACN"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as groupOf, n as RepositoryFiles } from "./repository-files-
|
|
2
|
-
import { a as problemAtPosition } from "./problem-
|
|
1
|
+
import { a as groupOf, n as RepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
|
|
2
|
+
import { a as problemAtPosition } from "./problem-BvRpVt97.mjs";
|
|
3
3
|
import { i as publicLookup, n as githubToken, r as jsonLookup, t as fetched } from "./lookup-DjQU0W6q.mjs";
|
|
4
4
|
import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
5
|
+
import { parseTOML } from "toml-eslint-parser";
|
|
5
6
|
import { Parser, parseDocument } from "yaml";
|
|
6
7
|
import semver from "semver";
|
|
7
|
-
import { parseTOML } from "toml-eslint-parser";
|
|
8
8
|
import { HttpClientResponse } from "effect/http";
|
|
9
9
|
// src/shared/lib/text-position.ts
|
|
10
10
|
const START = 0;
|
|
@@ -398,4 +398,4 @@ const upstreamExitsMet = Effect.fn("upstreamExitsMet")(function* upstreamExitsMe
|
|
|
398
398
|
});
|
|
399
399
|
export { workspaceDeviations as a, tomlSourceComments as c, problemAtIndex as d, cargoDeviations as i, yamlSourceComments as l, upstreamExitsMet as n, collectNodes as o, WORKSPACE_SECTIONS as r, isRecord as s, checkUpstreamExits as t, positionOf as u };
|
|
400
400
|
|
|
401
|
-
//# sourceMappingURL=upstream-exits-
|
|
401
|
+
//# sourceMappingURL=upstream-exits-DLZh68ZH.mjs.map
|