@r_masseater/msch 0.87.2 → 0.87.3
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/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +6 -11
- package/dist/changed.mjs.map +1 -1
- package/dist/cli.mjs +20 -30
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{credential-broker-9FMyTp1H.mjs → credential-broker-jnmkwOXO.mjs} +4 -20
- package/dist/credential-broker-jnmkwOXO.mjs.map +1 -0
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-CwmpxrxZ.mjs → define-lint-preset-GWsBHDRn.mjs} +2 -2
- package/dist/define-lint-preset-GWsBHDRn.mjs.map +1 -0
- package/dist/{dependencies-BAjtDvY4.mjs → dependencies-0FX_K_FN.mjs} +6 -6
- package/dist/dependencies-0FX_K_FN.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/{ignored-directories-BW8gCBE1.mjs → ignored-directories-Ce-45yzO.mjs} +2 -2
- package/dist/{ignored-directories-BW8gCBE1.mjs.map → ignored-directories-Ce-45yzO.mjs.map} +1 -1
- package/dist/{index-CHxAqDok.d.mts → index-CMyIrsah.d.mts} +3 -3
- package/dist/judge.mjs +4 -4
- package/dist/lint-rules.mjs +5 -5
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/{lookup-report-jWcGgE_D.mjs → lookup-report-DVJg0K4Z.mjs} +3 -3
- package/dist/{lookup-report-jWcGgE_D.mjs.map → lookup-report-DVJg0K4Z.mjs.map} +1 -1
- package/dist/{manifest-texts-C6Qjv0xy.mjs → manifest-texts-l_XRxGlJ.mjs} +2 -2
- package/dist/{manifest-texts-C6Qjv0xy.mjs.map → manifest-texts-l_XRxGlJ.mjs.map} +1 -1
- package/dist/{output-DMksIc-0.mjs → output-B_YPmKad.mjs} +3 -3
- package/dist/{output-DMksIc-0.mjs.map → output-B_YPmKad.mjs.map} +1 -1
- package/dist/oxlint.mjs +2 -2
- package/dist/{package-versions-G9Unih6I.mjs → package-versions-KlfuUwaI.mjs} +5 -5
- package/dist/package-versions-KlfuUwaI.mjs.map +1 -0
- package/dist/{pass-records-fctupGWy.mjs → pass-records-DPIg0O9z.mjs} +5 -5
- package/dist/pass-records-DPIg0O9z.mjs.map +1 -0
- package/dist/{problem-DGGF-vjW.mjs → problem-CUIz4TEI.mjs} +2 -2
- package/dist/{problem-DGGF-vjW.mjs.map → problem-CUIz4TEI.mjs.map} +1 -1
- package/dist/publish.mjs +7 -48
- package/dist/publish.mjs.map +1 -1
- package/dist/{published-C34bsbOH.mjs → published-CoG4Fl0J.mjs} +5 -5
- package/dist/published-CoG4Fl0J.mjs.map +1 -0
- package/dist/published.mjs +7 -7
- package/dist/published.mjs.map +1 -1
- package/dist/refs.mjs +3 -3
- package/dist/{repository-files-C2gVviac.mjs → repository-files-B6PEvKWe.mjs} +11 -2
- package/dist/{repository-files-C2gVviac.mjs.map → repository-files-B6PEvKWe.mjs.map} +1 -1
- package/dist/runtime-C8OGDSk9.mjs +13 -0
- package/dist/runtime-C8OGDSk9.mjs.map +1 -0
- package/dist/{specifiers-D9L0OV3r.mjs → specifiers-BrCyPubD.mjs} +2 -2
- package/dist/specifiers-BrCyPubD.mjs.map +1 -0
- package/dist/unbumped.mjs +5 -5
- package/dist/{upstream-exits-BVey4j2q.mjs → upstream-exits-bWCzT6HQ.mjs} +3 -3
- package/dist/{upstream-exits-BVey4j2q.mjs.map → upstream-exits-bWCzT6HQ.mjs.map} +1 -1
- package/dist/{upstream-record-CSbML0KF.mjs → upstream-record-DlluH3fY.mjs} +3 -3
- package/dist/upstream-record-DlluH3fY.mjs.map +1 -0
- package/dist/upstream.mjs +4 -4
- package/dist/wake.mjs +2 -2
- package/dist/{workspace-manifest-CAVYfp66.mjs → workspace-manifest-BAVyPzbA.mjs} +2 -2
- package/dist/workspace-manifest-BAVyPzbA.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +7 -7
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +8 -11
- package/skills/msch-repository-config/SKILL.md +1 -1
- package/dist/credential-broker-9FMyTp1H.mjs.map +0 -1
- package/dist/define-lint-preset-CwmpxrxZ.mjs.map +0 -1
- package/dist/dependencies-BAjtDvY4.mjs.map +0 -1
- package/dist/package-versions-G9Unih6I.mjs.map +0 -1
- package/dist/pass-records-fctupGWy.mjs.map +0 -1
- package/dist/published-C34bsbOH.mjs.map +0 -1
- package/dist/runtime-CFZ41rB0.mjs +0 -47
- package/dist/runtime-CFZ41rB0.mjs.map +0 -1
- package/dist/specifiers-D9L0OV3r.mjs.map +0 -1
- package/dist/upstream-record-CSbML0KF.mjs.map +0 -1
- package/dist/workspace-manifest-CAVYfp66.mjs.map +0 -1
package/dist/lint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { c as INSTRUMENTATION, g as alchemyOverride, d as allRulesOf, _ as cloudflareResourceSyntax, v as commandsOverride, h as decisionPlugin, f as decisionRules, p as decisionTestRules, m as generated, u as lint, t as markdownOf, o as remotionRules, y as removalPolicyOverride, b as removalPolicySyntax, l as requiredStack, i as structureOf, n as textlintFilters, r as textlintPresets, s as tracedRules, a as videoRules } from "./define-lint-preset-
|
|
1
|
+
export { c as INSTRUMENTATION, g as alchemyOverride, d as allRulesOf, _ as cloudflareResourceSyntax, v as commandsOverride, h as decisionPlugin, f as decisionRules, p as decisionTestRules, m as generated, u as lint, t as markdownOf, o as remotionRules, y as removalPolicyOverride, b as removalPolicySyntax, l as requiredStack, i as structureOf, n as textlintFilters, r as textlintPresets, s as tracedRules, a as videoRules } from "./define-lint-preset-GWsBHDRn.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as JSON_FLAG } from "./cli-contract-D7btWrEu.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { a as writeStdout, t as ProblemsFound } from "./output-
|
|
2
|
+
import { r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
|
|
3
|
+
import { a as writeStdout, t as ProblemsFound } from "./output-B_YPmKad.mjs";
|
|
4
4
|
import { Array, Effect, Order, Schema, Stdio, pipe } from "effect";
|
|
5
5
|
// src/app/lookup-report.ts
|
|
6
6
|
const NONE_FOUND = 0;
|
|
@@ -26,4 +26,4 @@ const lookupReport = ({ row, rows, describe }) => Effect.gen(function* report()
|
|
|
26
26
|
});
|
|
27
27
|
export { lookupReport as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=lookup-report-
|
|
29
|
+
//# sourceMappingURL=lookup-report-DVJg0K4Z.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-report-
|
|
1
|
+
{"version":3,"file":"lookup-report-DVJg0K4Z.mjs","names":["Arr"],"sources":["../src/app/lookup-report.ts"],"sourcesContent":["import { Array as Arr, Effect, Order, Schema, Stdio, pipe } from \"effect\";\n\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\n\nconst NONE_FOUND = 0;\nconst LINE_BREAK = \"\\n\";\n\nconst byPlace = Order.Struct({ file: Order.String, line: Order.Number });\n\n/** @internal */\nexport interface Place {\n readonly file: string;\n readonly line: number;\n}\n\n/** @internal */\nexport interface LookupReport<Row extends Place, Failure, Requirements> {\n readonly row: Schema.Codec<Row>;\n readonly rows: (root: string) => Effect.Effect<readonly Row[], Failure, Requirements>;\n readonly describe: (row: Row) => string;\n}\n\nconst textOf =\n <Row extends Place>(row: Schema.Codec<Row>, describe: (row: Row) => string) =>\n (json: boolean, rows: readonly Row[]): Effect.Effect<string, Schema.SchemaError> => {\n if (json) {\n return Schema.encodeEffect(row.pipe(Schema.Array, Schema.fromJsonString))(rows);\n }\n return Effect.succeed(\n pipe(\n rows,\n Arr.map((found) => `${describe(found)}${LINE_BREAK}`),\n Arr.join(\"\"),\n ),\n );\n };\n\n/** @internal */\nexport const lookupReport = <Row extends Place, Failure, Requirements>({\n row,\n rows,\n describe,\n}: LookupReport<Row, Failure, Requirements>): Effect.Effect<\n number,\n Failure | Schema.SchemaError | ProblemsFound,\n Requirements | RepositoryFiles | Stdio.Stdio\n> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const found = yield* rows(files.resolve(\".\"));\n const text = yield* textOf(row, describe)(\n Arr.contains(args, JSON_FLAG),\n Arr.sort(found, byPlace),\n );\n yield* writeStdout(text);\n if (found.length > NONE_FOUND) {\n return yield* ProblemsFound.make({ count: found.length });\n }\n return NONE_FOUND;\n });\n"],"mappings":";;;;;AAOA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAM,OAAO;CAAE,MAAM,MAAM;CAAQ,MAAM,MAAM;AAAO,CAAC;AAevE,MAAM,UACgB,KAAwB,cAC3C,MAAe,SAAoE;CAClF,IAAI,MACF,OAAO,OAAO,aAAa,IAAI,KAAK,OAAO,OAAO,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI;CAEhF,OAAO,OAAO,QACZ,KACE,MACAA,MAAI,KAAK,UAAU,GAAG,SAAS,KAAK,IAAI,YAAY,GACpDA,MAAI,KAAK,EAAE,CACb,CACF;AACF;;AAGF,MAAa,gBAA0D,EACrE,KACA,MACA,eAMA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,QAAQ,OAAO,KAAK,MAAM,QAAQ,GAAG,CAAC;CAC5C,MAAM,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CACvCA,MAAI,SAAS,MAAM,SAAS,GAC5BA,MAAI,KAAK,OAAO,OAAO,CACzB;CACA,OAAO,YAAY,IAAI;CACvB,IAAI,MAAM,SAAS,YACjB,OAAO,OAAO,cAAc,KAAK,EAAE,OAAO,MAAM,OAAO,CAAC;CAE1D,OAAO;AACT,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
|
|
2
2
|
import { Array, Config, Effect, Option, pipe } from "effect";
|
|
3
3
|
// src/shared/lib/base-revision.ts
|
|
4
4
|
const DEFAULT_BASE = "origin/main";
|
|
@@ -26,4 +26,4 @@ const manifestTexts = Effect.fn("manifestTexts")(function* manifestTexts(root) {
|
|
|
26
26
|
});
|
|
27
27
|
export { baseName as n, baseRevision as r, manifestTexts as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=manifest-texts-
|
|
29
|
+
//# sourceMappingURL=manifest-texts-l_XRxGlJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-texts-
|
|
1
|
+
{"version":3,"file":"manifest-texts-l_XRxGlJ.mjs","names":["Arr"],"sources":["../src/shared/lib/base-revision.ts","../src/shared/lib/manifest-texts.ts"],"sourcesContent":["import { Config, Effect, Option } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst DEFAULT_BASE = \"origin/main\";\n\n/** @internal */\nexport const baseName = Config.option(Config.String(\"VPA_BASE\")).pipe(\n Effect.orDie,\n Effect.map(Option.getOrElse(() => DEFAULT_BASE)),\n);\n\n/** @internal */\nexport const baseRevision = Effect.fn(\"baseRevision\")(function* baseRevision(root: string) {\n const files = yield* RepositoryFiles;\n const base = yield* baseName;\n return yield* files.mergeBase(root, base);\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst MANIFEST = /(?:^|\\/)package\\.json$/u;\nconst READ_CONCURRENCY = 16;\n\n/** @internal */\nexport interface ManifestText {\n readonly file: string;\n readonly text: string;\n}\n\n/** @internal */\nexport const manifestTexts = Effect.fn(\"manifestTexts\")(function* manifestTexts(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const names = pipe(\n listed,\n Arr.filter((name) => MANIFEST.test(name)),\n );\n const read = yield* Effect.forEach(\n names,\n (file) =>\n Effect.map(\n files.readFile(files.join(root, file)),\n Option.map((text): ManifestText => ({ file, text })),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(read);\n});\n"],"mappings":";;;AAIA,MAAM,eAAe;;AAGrB,MAAa,WAAW,OAAO,OAAO,OAAO,OAAO,UAAU,CAAC,CAAC,CAAC,KAC/D,OAAO,OACP,OAAO,IAAI,OAAO,gBAAgB,YAAY,CAAC,CACjD;;AAGA,MAAa,eAAe,OAAO,GAAG,cAAc,CAAC,CAAC,UAAU,aAAa,MAAc;CACzF,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO;CACpB,OAAO,OAAO,MAAM,UAAU,MAAM,IAAI;AAC1C,CAAC;;ACbD,MAAM,WAAW;AACjB,MAAM,mBAAmB;;AASzB,MAAa,gBAAgB,OAAO,GAAG,eAAe,CAAC,CAAC,UAAU,cAAc,MAAc;CAC5F,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,OAAO,MAAM,YAAY,IAAI;CAC5C,MAAM,QAAQ,KACZ,QACAA,MAAI,QAAQ,SAAS,SAAS,KAAK,IAAI,CAAC,CAC1C;CACA,MAAM,OAAO,OAAO,OAAO,QACzB,QACC,SACC,OAAO,IACL,MAAM,SAAS,MAAM,KAAK,MAAM,IAAI,CAAC,GACrC,OAAO,KAAK,UAAwB;EAAE;EAAM;CAAK,EAAE,CACrD,GACF,EAAE,aAAa,iBAAiB,CAClC;CACA,OAAOA,MAAI,SAAS,IAAI;AAC1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as formatProblem, t as ProblemList } from "./problem-
|
|
2
|
-
import {
|
|
1
|
+
import { r as formatProblem, t as ProblemList } from "./problem-CUIz4TEI.mjs";
|
|
2
|
+
import { r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
|
|
3
3
|
import { Array, Effect, Runtime, Schema, Stdio, Stream, pipe } from "effect";
|
|
4
4
|
// src/app/output.ts
|
|
5
5
|
const taggedError = Schema.TaggedError;
|
|
@@ -30,4 +30,4 @@ const failWhenAny = (count) => {
|
|
|
30
30
|
};
|
|
31
31
|
export { writeStdout as a, writeProblems as i, failWhenAny as n, writeJsonProblems as r, ProblemsFound as t };
|
|
32
32
|
|
|
33
|
-
//# sourceMappingURL=output-
|
|
33
|
+
//# sourceMappingURL=output-B_YPmKad.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-
|
|
1
|
+
{"version":3,"file":"output-B_YPmKad.mjs","names":["Arr"],"sources":["../src/app/output.ts"],"sourcesContent":["import { Array as Arr, Effect, Runtime, Schema, Stdio, Stream, pipe } from \"effect\";\n\nimport { ProblemList, formatProblem } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst taggedError = Schema.TaggedError;\nconst NO_PROBLEMS = 0;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {\n public override readonly [Runtime.errorReported] = false;\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\n/** @internal */\nexport const writeProblems =\n (root: string) =>\n (problems: readonly Problem[]): Effect.Effect<void, never, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n });\n\n/** @internal */\nexport const writeJsonProblems = Effect.fn(\"writeJsonProblems\")(function* writeJsonProblems(\n problems: readonly Problem[],\n) {\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);\n return yield* writeStdout(text);\n});\n\n/** @internal */\nexport const failWhenAny = (count: number): Effect.Effect<void, ProblemsFound> => {\n if (count > NO_PROBLEMS) {\n return Effect.fail(ProblemsFound.make({ count }));\n }\n return Effect.void;\n};\n"],"mappings":";;;;AAMA,MAAM,cAAc,OAAO;AAC3B,MAAM,cAAc;AAEpB,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC;CACA,CAA0B,QAAQ,iBAAiB;AACrD;;AAGA,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;;AAGD,MAAa,iBACV,UACA,aACC,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,eAAe,SAAS,MAAM,SAAS,MAAM,IAAI,CAAC;CACjE,OAAO,YACL,KACE,UACAA,MAAI,KAAK,YAAY,GAAG,OAAO,OAAO,EAAE,GAAG,GAC3CA,MAAI,KAAK,EAAE,CACb,CACF;AACF,CAAC;;AAGL,MAAa,oBAAoB,OAAO,GAAG,mBAAmB,CAAC,CAAC,UAAU,kBACxE,UACA;CACA,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ;CACpF,OAAO,OAAO,YAAY,IAAI;AAChC,CAAC;;AAGD,MAAa,eAAe,UAAsD;CAChF,IAAI,QAAQ,aACV,OAAO,OAAO,KAAK,cAAc,KAAK,EAAE,MAAM,CAAC,CAAC;CAElD,OAAO,OAAO;AAChB"}
|
package/dist/oxlint.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as describeFinding, t as ProblemList } from "./problem-
|
|
1
|
+
import { n as describeFinding, t as ProblemList } from "./problem-CUIz4TEI.mjs";
|
|
2
2
|
import { t as JSON_FLAG } from "./cli-contract-D7btWrEu.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as nodeServicesLayer } from "./repository-files-B6PEvKWe.mjs";
|
|
4
4
|
import { Array, Effect, Layer, Schema, Stream, pipe } from "effect";
|
|
5
5
|
import { ChildProcess } from "effect/process";
|
|
6
6
|
// src/features/report-problems/model/oxlint-rule.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as baseName, r as baseRevision, t as manifestTexts } from "./manifest-texts-
|
|
2
|
-
import {
|
|
1
|
+
import { n as baseName, r as baseRevision, t as manifestTexts } from "./manifest-texts-l_XRxGlJ.mjs";
|
|
2
|
+
import { r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
|
|
3
3
|
import { Array, Effect, Option, String, pipe } from "effect";
|
|
4
|
-
import { DEPENDENCY_SECTIONS, namesIn } from "@r_masseater/kestrion";
|
|
5
|
-
import { decodePackageJson, decodeVersionedPackageJson } from "@r_masseater/kestrion/npm";
|
|
4
|
+
import { DEPENDENCY_SECTIONS, namesIn } from "@r_masseater/masseater-utils/kestrion";
|
|
5
|
+
import { decodePackageJson, decodeVersionedPackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
|
|
6
6
|
import semver from "semver";
|
|
7
7
|
// src/features/check-version-downgrades/model/package-versions.ts
|
|
8
8
|
const RULE = "unbumped-package";
|
|
@@ -88,4 +88,4 @@ const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPa
|
|
|
88
88
|
});
|
|
89
89
|
export { checkPackageVersions as t };
|
|
90
90
|
|
|
91
|
-
//# sourceMappingURL=package-versions-
|
|
91
|
+
//# sourceMappingURL=package-versions-KlfuUwaI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-versions-KlfuUwaI.mjs","names":["Str","Arr"],"sources":["../src/features/check-version-downgrades/model/package-versions.ts"],"sourcesContent":["import { DEPENDENCY_SECTIONS, namesIn } from \"@r_masseater/masseater-utils/kestrion\";\nimport {\n decodePackageJson,\n decodeVersionedPackageJson,\n} from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { baseName, baseRevision } from \"#/shared/lib/base-revision.ts\";\nimport { manifestTexts } from \"#/shared/lib/manifest-texts.ts\";\nimport type { ManifestText } from \"#/shared/lib/manifest-texts.ts\";\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RULE: RuleName = \"unbumped-package\";\nconst UNSHIPPED =\n /(?:\\.test\\.[\\w.]+$|(?:^|\\/)(?:fixtures|__tests__|tests?)\\/|(?:^|\\/)(?:AGENTS|CLAUDE|CHANGELOG)\\.md$)/u;\nconst UNVERSIONED = \"0.0.0\";\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst READ_CONCURRENCY = 16;\n\ninterface Package {\n readonly file: string;\n readonly directory: string;\n readonly name: string;\n readonly version: string;\n readonly text: string;\n readonly depends: readonly string[];\n}\n\ninterface Hidden {\n readonly directory: string;\n readonly depends: readonly string[];\n}\n\ntype HiddenPackages = ReadonlyMap<string, Hidden>;\n\nconst LAST_SEGMENT = /[^/]*$/u;\n\nconst directoryOf = (file: string): string => Str.replace(LAST_SEGMENT, \"\")(file);\n\nconst packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodeVersionedPackageJson(text),\n Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED),\n Option.map((manifest): Package => ({\n file,\n directory: directoryOf(file),\n name: manifest.name,\n version: manifest.version,\n text,\n depends: namesIn(manifest, DEPENDENCY_SECTIONS),\n })),\n );\n\nconst hiddenAt = (file: string, text: string): Option.Option<readonly [string, Hidden]> =>\n pipe(\n decodePackageJson(text),\n Option.filter((manifest) => manifest.private === true),\n Option.flatMap((manifest) =>\n Option.map(Option.fromUndefinedOr(manifest.name), (name): readonly [string, Hidden] => [\n name,\n { directory: directoryOf(file), depends: namesIn(manifest, DEPENDENCY_SECTIONS) },\n ]),\n ),\n );\n\nconst visit = (\n hidden: HiddenPackages,\n seen: ReadonlySet<string>,\n name: string,\n): ReadonlySet<string> => {\n if (seen.has(name)) {\n return seen;\n }\n return Option.match(Option.fromUndefinedOr(hidden.get(name)), {\n onNone: () => seen,\n onSome: (found) => {\n const added: ReadonlySet<string> = new Set([...seen, name]);\n return Arr.reduce(found.depends, added, (next, dependency) =>\n visit(hidden, next, dependency),\n );\n },\n });\n};\n\nconst bundledBy = (hidden: HiddenPackages, depends: readonly string[]): readonly string[] => [\n ...Arr.reduce(depends, new Set<string>() as ReadonlySet<string>, (seen, name) =>\n visit(hidden, seen, name),\n ),\n];\n\nconst hiddenPackagesIn = (manifests: readonly ManifestText[]): HiddenPackages =>\n new Map(\n pipe(\n manifests,\n Arr.flatMap(({ file, text }) => Option.toArray(hiddenAt(file, text))),\n ),\n );\n\nconst versionAt = (name: string, text: Option.Option<string>): Option.Option<string> =>\n pipe(\n text,\n Option.flatMap(decodeVersionedPackageJson),\n Option.filter((manifest) => manifest.name === name),\n Option.map(({ version }) => version),\n Option.filter((version) => semver.valid(version) !== null),\n );\n\nconst versionLine = (text: string): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes('\"version\"')(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\nconst shippedChange = (directory: string, changed: readonly string[]): boolean =>\n pipe(\n changed,\n Arr.some((name) => Str.startsWith(directory)(name) && !UNSHIPPED.test(name)),\n );\n\nconst higher = (left: string, right: string): string => {\n if (semver.gt(right, left)) {\n return right;\n }\n return left;\n};\n\nconst floorOf = (versions: readonly Option.Option<string>[]): Option.Option<string> => {\n let floor = Option.none<string>();\n for (const version of Arr.getSomes(versions)) {\n floor = Option.match(floor, {\n onNone: () => Option.some(version),\n onSome: (lowest) => Option.some(higher(version, lowest)),\n });\n }\n return floor;\n};\n\nconst changedPart = (\n hidden: HiddenPackages,\n changed: readonly string[],\n pack: Package,\n): Option.Option<string> => {\n if (shippedChange(pack.directory, changed)) {\n return Option.some(pack.name);\n }\n return pipe(\n bundledBy(hidden, pack.depends),\n Arr.findFirst((name) =>\n Option.exists(Option.fromUndefinedOr(hidden.get(name)), ({ directory }) =>\n shippedChange(directory, changed),\n ),\n ),\n Option.map((name) => `${name}, which ${pack.name} bundles,`),\n );\n};\n\nconst message = ({ name, version }: Package, part: string, floor: string): string =>\n `${part} changed, but the version of ${name}, ${version}, is not above ${floor}, the version of the base or of main. Another change may already publish ${floor}. Bump the version above ${floor}.`;\n\n/** @internal */\nexport const checkPackageVersions = Effect.fn(\"checkPackageVersions\")(\n function* checkPackageVersions(root: string) {\n const files = yield* RepositoryFiles;\n const base = yield* baseRevision(root);\n if (Option.isNone(base)) {\n return [];\n }\n const tip = yield* baseName;\n const changed = yield* files.changedFiles(root, base.value);\n const manifests = yield* manifestTexts(root);\n const hidden = hiddenPackagesIn(manifests);\n const found = yield* Effect.forEach(\n pipe(\n manifests,\n Arr.flatMap(({ file, text }) => Option.toArray(packageAt(file, text))),\n Arr.flatMap((pack) =>\n pipe(\n changedPart(hidden, changed, pack),\n Option.map((part) => ({ pack, part })),\n Option.toArray,\n ),\n ),\n ),\n ({ pack, part }) =>\n Effect.gen(function* compare() {\n const before = yield* files.readAtRevision(root, base.value, pack.file);\n const claimed = yield* files.readAtRevision(root, tip, pack.file);\n const floor = floorOf([versionAt(pack.name, before), versionAt(pack.name, claimed)]);\n return pipe(\n floor,\n Option.filter((lowest) => !semver.gt(pack.version, lowest)),\n Option.map((lowest): Problem => ({\n file: files.join(root, pack.file),\n line: versionLine(pack.text),\n column: FIRST_COLUMN,\n rule: RULE,\n message: message(pack, part, lowest),\n })),\n Option.toArray,\n );\n }),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n },\n);\n"],"mappings":";;;;;;;AAcA,MAAM,OAAiB;AACvB,MAAM,YACJ;AACF,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,mBAAmB;AAkBzB,MAAM,eAAe;AAErB,MAAM,eAAe,SAAyBA,OAAI,QAAQ,cAAc,EAAE,CAAC,CAAC,IAAI;AAEhF,MAAM,aAAa,MAAc,SAC/B,KACE,2BAA2B,IAAI,GAC/B,OAAO,QAAQ,EAAE,SAAS,QAAQ,cAAc,WAAW,QAAQ,YAAY,WAAW,GAC1F,OAAO,KAAK,cAAuB;CACjC;CACA,WAAW,YAAY,IAAI;CAC3B,MAAM,SAAS;CACf,SAAS,SAAS;CAClB;CACA,SAAS,QAAQ,UAAU,mBAAmB;AAChD,EAAE,CACJ;AAEF,MAAM,YAAY,MAAc,SAC9B,KACE,kBAAkB,IAAI,GACtB,OAAO,QAAQ,aAAa,SAAS,YAAY,IAAI,GACrD,OAAO,SAAS,aACd,OAAO,IAAI,OAAO,gBAAgB,SAAS,IAAI,IAAI,SAAoC,CACrF,MACA;CAAE,WAAW,YAAY,IAAI;CAAG,SAAS,QAAQ,UAAU,mBAAmB;AAAE,CAClF,CAAC,CACH,CACF;AAEF,MAAM,SACJ,QACA,MACA,SACwB;CACxB,IAAI,KAAK,IAAI,IAAI,GACf,OAAO;CAET,OAAO,OAAO,MAAM,OAAO,gBAAgB,OAAO,IAAI,IAAI,CAAC,GAAG;EAC5D,cAAc;EACd,SAAS,UAAU;GACjB,MAAM,wBAA6B,IAAI,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC;GAC1D,OAAOC,MAAI,OAAO,MAAM,SAAS,QAAQ,MAAM,eAC7C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QAAQ,CAAC,UAAU,KAAK,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM,OAAO,CAAC,CAAC;EACnF,OAAO,KACL,OACA,OAAO,QAAQ,WAAW,CAAC,OAAO,GAAG,KAAK,SAAS,MAAM,CAAC,GAC1D,OAAO,KAAK,YAAqB;GAC/B,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI;GAChC,MAAM,YAAY,KAAK,IAAI;GAC3B,QAAQ;GACR,MAAM;GACN,SAAS,QAAQ,MAAM,MAAM,MAAM;EACrC,EAAE,GACF,OAAO,OACT;CACF,CAAC,GACH,EAAE,aAAa,iBAAiB,CAClC;CACA,OAAOA,MAAI,QAAQ,KAAK;AAC1B,CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { n as readManifest, r as workspaceDependencies, t as dependencyEntries } from "./dependencies-
|
|
3
|
-
import { D as resolvedSymbol, M as IndexKind, N as InternalSymbolName, R as getLeadingCommentRanges, T as propertyNamesOf, _ as isGenericDeclaration, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, f as declarationsOf, j as API, p as declaresAType, rt as isModuleDeclaration } from "./problem-
|
|
1
|
+
import { n as NODE_MODULES, r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
|
|
2
|
+
import { n as readManifest, r as workspaceDependencies, t as dependencyEntries } from "./dependencies-0FX_K_FN.mjs";
|
|
3
|
+
import { D as resolvedSymbol, M as IndexKind, N as InternalSymbolName, R as getLeadingCommentRanges, T as propertyNamesOf, _ as isGenericDeclaration, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, f as declarationsOf, j as API, p as declaresAType, rt as isModuleDeclaration } from "./problem-CUIz4TEI.mjs";
|
|
4
4
|
import { Array, Effect, Function, Number, Option, Order, Schema, String as String$1, pipe } from "effect";
|
|
5
|
-
import { PACKAGE_JSON_FILE } from "@r_masseater/kestrion";
|
|
5
|
+
import { PACKAGE_JSON_FILE } from "@r_masseater/masseater-utils/kestrion";
|
|
6
6
|
// src/shared/lib/values.ts
|
|
7
7
|
const SCHEMA_TYPE_PROPERTIES = ["Type", "_output"];
|
|
8
8
|
const MINIMUM_SET_SIZE = 2;
|
|
@@ -434,4 +434,4 @@ const keepOnly = Effect.fn("keepOnly")(function* keepOnly(records, keys) {
|
|
|
434
434
|
});
|
|
435
435
|
export { valueKey as C, schemaTypeOf as S, formatValues as _, nearestManifestDirectory as a, literalValuesOf as b, listConfigFiles as c, withProject as d, declarationKey as f, finiteValuesOf as g, locationOf as h, installedPackages as i, mentions as l, isObjectType as m, keepOnly as n, projectInputs as o, describeLibraryType as p, recordsIn as r, workspaceClosure as s, contentKey as t, typeScriptCompiler as u, isSubsetOf as v, vocabularyOf as w, sameValues as x, literalUnionOf as y };
|
|
436
436
|
|
|
437
|
-
//# sourceMappingURL=pass-records-
|
|
437
|
+
//# sourceMappingURL=pass-records-DPIg0O9z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass-records-DPIg0O9z.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","Arr","Str","Arr"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/pass-records.ts"],"sourcesContent":["import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\nexport type Value = string | number;\n\nexport interface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nexport const literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nexport const literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nexport const schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nexport const finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nexport const vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nexport const isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nexport const sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n carriesTag,\n declaresAType,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n readonly typeNames: readonly string[];\n readonly tagNames: readonly string[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [], typeNames: [], tagNames: [] };\n\nexport const isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { ...EMPTY_INDEX, vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n ...EMPTY_INDEX,\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n typeNames: pipe(\n indexes,\n Arr.flatMap((index) => index.typeNames),\n ),\n tagNames: pipe(\n indexes,\n Arr.flatMap((index) => index.tagNames),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n Arr.some(declarationsOf(symbol), isModuleDeclaration);\n\nconst typeNameIndex = (visit: Visit, symbol: TypeSymbol): LibraryIndex => {\n const declarations = declarationsOf(symbol);\n const typeNames = pipe(\n [visit.exported.name],\n Arr.filter(() => declaresAType(declarations)),\n );\n const tagNames = pipe(\n typeNames,\n Arr.filter((name) => carriesTag(name)(declarations)),\n );\n return { ...EMPTY_INDEX, typeNames, tagNames };\n};\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([\n declaredTypeIndex(walk, named),\n schemaValueIndex(walk, named),\n typeNameIndex(visit, symbol),\n ]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nexport const libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nexport const annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, PACKAGE_JSON_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nexport const withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nexport const mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), {\n concurrency: 1,\n });\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { readManifest, workspaceDependencies } from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (\n parent !== directory &&\n !(yield* files.exists(files.join(directory, PACKAGE_JSON_FILE)))\n ) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* Effect.forEach(\n names,\n (name) => files.realPath(files.join(directory, NODE_MODULES, name)),\n {\n concurrency: 1,\n },\n );\n});\n\nexport const workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(\n start: string,\n) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }),\n );\n return Arr.flatten(nested);\n});\n\nexport const installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* Effect.forEach(\n names,\n (name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n { concurrency: 1 },\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* Effect.forEach(\n Arr.dedupe([root, ...directories]),\n (directory) => installedPackages(root, directory),\n { concurrency: 1 },\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst PASSED = \"\";\nconst UNREADABLE = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nexport interface Records {\n readonly directory: string;\n readonly passed: readonly string[];\n}\n\nexport type NamedFile = readonly [name: string, file: string];\n\nexport const contentKey = Effect.fn(\"contentKey\")(function* contentKey(\n salt: readonly string[],\n named: readonly NamedFile[],\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* Effect.forEach(\n named,\n ([name, file]) =>\n files\n .hashFile(file)\n .pipe(\n Effect.map(\n (found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`,\n ),\n ),\n { concurrency: 1 },\n );\n return yield* files.hash(Arr.join([...salt, ...entries], LINE_SEPARATOR));\n});\n\nexport const recordsIn = Effect.fn(\"recordsIn\")(function* recordsIn(directory: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.readDirectory(directory);\n return { directory, passed: present } satisfies Records;\n});\n\nexport const keepOnly = Effect.fn(\"keepOnly\")(function* keepOnly(\n records: Records,\n keys: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const stale = pipe(\n records.passed,\n Arr.filter((key) => !Arr.contains(keys, key)),\n );\n yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {\n concurrency: 1,\n discard: true,\n });\n yield* Effect.forEach(\n keys,\n (key) => files.writeFile(files.join(records.directory, key), PASSED),\n { concurrency: 1, discard: true },\n );\n});\n"],"mappings":";;;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CACpE;CACA,IAAI,OAAO,WAAW,MAAM,UAAU,OAAO,SAAS,kBACpD,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,KAAK,MAAM;AAC3B;AAEA,MAAa,kBAAkB,SAAgD;CAC7E,IAAI,CAAC,KAAK,YAAY,GACpB,OAAO,OAAO,KAAK;CAErB,OAAO,gBAAgB,KAAK,SAAS,CAA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ACjF,CACF,GACJ,EAAE,aAAa,EAAE,CACnB;CACA,OAAO,OAAO,MAAM,KAAKE,MAAI,KAAK,CAAC,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CAAC;AAC1E,CAAC;AAED,MAAa,YAAY,OAAO,GAAG,WAAW,CAAC,CAAC,UAAU,UAAU,WAAmB;CAGrF,OAAO;EAAE;EAAW,QAAQ,QADL,OADF,gBAAA,CACQ,cAAc,SAAS;CAChB;AACtC,CAAC;AAED,MAAa,WAAW,OAAO,GAAG,UAAU,CAAC,CAAC,UAAU,SACtD,SACA,MACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,QAAQ,KACZ,QAAQ,QACRA,MAAI,QAAQ,QAAQ,CAACA,MAAI,SAAS,MAAM,GAAG,CAAC,CAC9C;CACA,OAAO,OAAO,QAAQ,QAAQ,QAAQ,MAAM,WAAW,MAAM,KAAK,QAAQ,WAAW,GAAG,CAAC,GAAG;EAC1F,aAAa;EACb,SAAS;CACX,CAAC;CACD,OAAO,OAAO,QACZ,OACC,QAAQ,MAAM,UAAU,MAAM,KAAK,QAAQ,WAAW,GAAG,GAAG,MAAM,GACnE;EAAE,aAAa;EAAG,SAAS;CAAK,CAClC;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as NODE_MODULES } from "./repository-files-B6PEvKWe.mjs";
|
|
2
2
|
import { Array, Option, Order, Schema, String as String$1, pipe } from "effect";
|
|
3
3
|
import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "tsrs/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 "tsrs/ast/is";
|
|
@@ -127,4 +127,4 @@ const describeFinding = (problem) => `[${problem.rule}] ${problem.message}`;
|
|
|
127
127
|
const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;
|
|
128
128
|
export { isIdentifier as $, uniqueByReference as A, getTextOfJSDocComment as B, moduleSpecifierOf as C, resolvedSymbol as D, referencedSymbols as E, SymbolFlags$1 as F, isCallExpression as G, isArrowFunction as H, SyntaxKind as I, isEnumDeclaration as J, isClassDeclaration as K, getJSDocTags as L, IndexKind as M, InternalSymbolName as N, symbolAt as O, SignatureKind as P, isFunctionExpression as Q, getLeadingCommentRanges as R, moduleSpecifierLiteralOf as S, isVariableStatement as St, propertyNamesOf as T, isBinaryExpression as U, isArrayLiteralExpression as V, isBlock as W, isExpressionStatement as X, isExportDeclaration as Y, isFunctionDeclaration as Z, isGenericDeclaration as _, isTypeLiteralNode as _t, problemAtPosition as a, isNumericLiteral as at, isTypeDeclaration as b, isVariableDeclaration as bt, carriesTag as c, isPropertyAccessExpression as ct, contains as d, isSatisfiesExpression as dt, isImportDeclaration as et, declarationsOf as f, isSignatureDeclaration as ft, isExternalDeclaration as g, isTypeAliasDeclaration as gt, importedModulesOf as h, isStringLiteral as ht, problemAt as i, isNewExpression as it, API as j, symbolAtLocation as k, childrenOf as l, isPropertyAssignment as lt, descendantsOf as m, isSpreadElement as mt, describeFinding as n, isModuleBlock as nt, problemInFile as o, isObjectLiteralExpression as ot, declaresAType as p, isSourceFile as pt, isElementAccessExpression as q, formatProblem as r, isModuleDeclaration as rt, sortProblems as s, isParenthesizedExpression as st, ProblemList as t, isInterfaceDeclaration as tt, columnOf as u, isReturnStatement as ut, isInsideAny as v, isTypeReferenceNode as vt, packageOf as w, lineOf as x, isVariableDeclarationList as xt, isOutsideDeclaration as y, isUnionTypeNode as yt, getNameOfDeclaration as z };
|
|
129
129
|
|
|
130
|
-
//# sourceMappingURL=problem-
|
|
130
|
+
//# sourceMappingURL=problem-CUIz4TEI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problem-DGGF-vjW.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/syntax.ts","../src/shared/lib/problem.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 StringLiteral,\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\nexport const moduleSpecifierLiteralOf = (statement: Node): Option.Option<StringLiteral> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));\n};\n\nexport const moduleSpecifierOf = (statement: Node): Option.Option<string> =>\n Option.map(moduleSpecifierLiteralOf(statement), (specifier) => specifier.text);\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.String.check(Schema.isPattern(/^[a-z]+(?:-[a-z]+)*$/u));\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nconst FIRST = 1;\n\nexport interface Position {\n readonly line: number;\n readonly column: number;\n}\n\nexport const problemAtPosition =\n (rule: RuleName) =>\n (file: string, { line, column }: Readonly<Position>, message: string): Problem => ({\n file,\n line,\n column,\n rule,\n message,\n });\n\nexport const problemInFile =\n (rule: RuleName) =>\n (file: string, message: string): Problem =>\n problemAtPosition(rule)(file, { line: FIRST, column: FIRST }, message);\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n"],"mappings":";;;;;;AAmCA,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,SAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,SAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,SAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C,IAAIA,SAAI,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,SAAI,SAAS,oBAAoB,CAAC,CAAC,WAAW,QAAQ,KACrD,QAAQ,gCAAgC,UAAU;AAExD,MAAa,yBACV,aACA,gBACC,eAAe,OAAO,CAAC,CAAC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,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,MAAM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAa,gBAAgB,aAC3BA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAa,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAE1F,MAAa,iBACV,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO"}
|
|
1
|
+
{"version":3,"file":"problem-CUIz4TEI.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/syntax.ts","../src/shared/lib/problem.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 StringLiteral,\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\nexport const moduleSpecifierLiteralOf = (statement: Node): Option.Option<StringLiteral> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));\n};\n\nexport const moduleSpecifierOf = (statement: Node): Option.Option<string> =>\n Option.map(moduleSpecifierLiteralOf(statement), (specifier) => specifier.text);\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.String.check(Schema.isPattern(/^[a-z]+(?:-[a-z]+)*$/u));\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nconst FIRST = 1;\n\nexport interface Position {\n readonly line: number;\n readonly column: number;\n}\n\nexport const problemAtPosition =\n (rule: RuleName) =>\n (file: string, { line, column }: Readonly<Position>, message: string): Problem => ({\n file,\n line,\n column,\n rule,\n message,\n });\n\nexport const problemInFile =\n (rule: RuleName) =>\n (file: string, message: string): Problem =>\n problemAtPosition(rule)(file, { line: FIRST, column: FIRST }, message);\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n"],"mappings":";;;;;;AAmCA,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,SAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,SAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,SAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C,IAAIA,SAAI,WAAW,YAAY,CAAC,CAAC,YAAY,GAC3C,OAAO,KAAKD,MAAI,KAAK,UAAU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
#!/usr/bin/env node
|
|
2
|
-
import { t as runCli } from "./runtime-
|
|
3
|
-
import {
|
|
4
|
-
import { Array, Config, Console,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { decodePackageJson, readPackageJson, readRawPackageJson, readVersionedPackageJson, updatePackageJson, writePackageJson } from "@r_masseater/kestrion/npm";
|
|
2
|
+
import { t as runCli } from "./runtime-C8OGDSk9.mjs";
|
|
3
|
+
import { n as actionsOidcToken, t as BROKER } from "./credential-broker-jnmkwOXO.mjs";
|
|
4
|
+
import { Array, Config, Console, Effect, FileSystem, Option, Order, Path, Predicate, Record, Schedule, Schema, Stdio, String as String$1, pipe } from "effect";
|
|
5
|
+
import { PACKAGE_JSON_FILE, ROOT_SUBPATH, exportEntriesOf, importSpecifierOf, runtimeDependencyNames, unscopedNameOf } from "@r_masseater/masseater-utils/kestrion";
|
|
6
|
+
import { decodePackageJson, readPackageJson, readRawPackageJson, readVersionedPackageJson, updatePackageJson, writePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
|
|
8
7
|
import semver from "semver";
|
|
9
8
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
|
|
10
|
-
import {
|
|
9
|
+
import { mask, mustSucceed, outputOf, succeeds, writeOutputs } from "@r_masseater/masseater-utils/github-workflow";
|
|
11
10
|
import { arch, platform } from "node:os";
|
|
12
|
-
|
|
13
|
-
const SUCCESS = 0;
|
|
14
|
-
const FORCE_KILL_AFTER = Duration.seconds(10);
|
|
15
|
-
const taggedError$4 = Schema.TaggedError;
|
|
16
|
-
var CommandFailed = class extends taggedError$4()("CommandFailed", { message: Schema.String }) {};
|
|
17
|
-
const failed = ({ command, args }) => CommandFailed.make({ message: `${command} ${Array.join(args, " ")} failed` });
|
|
18
|
-
const exitCodeOf = Effect.fn("exitCodeOf")(function* exitCodeOf({ command, args, env, cwd, forceKillAfter = FORCE_KILL_AFTER }) {
|
|
19
|
-
return yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make(command, args, {
|
|
20
|
-
cwd,
|
|
21
|
-
env,
|
|
22
|
-
extendEnv: true,
|
|
23
|
-
stdin: "ignore",
|
|
24
|
-
stdout: "inherit",
|
|
25
|
-
stderr: "inherit",
|
|
26
|
-
forceKillAfter
|
|
27
|
-
}));
|
|
28
|
-
});
|
|
29
|
-
const succeedsWith = (command) => exitCodeOf(command).pipe(Effect.map((code) => code === SUCCESS));
|
|
30
|
-
const mustSucceedWith = (command) => succeedsWith(command).pipe(Effect.filterOrFail((passed) => passed, () => failed(command)), Effect.asVoid);
|
|
31
|
-
const collected = Effect.fn("collected")(function* collected({ command, args, env, cwd, forceKillAfter = FORCE_KILL_AFTER }) {
|
|
32
|
-
const handle = yield* ChildProcess.make(command, args, {
|
|
33
|
-
cwd,
|
|
34
|
-
env,
|
|
35
|
-
extendEnv: true,
|
|
36
|
-
stdin: "ignore",
|
|
37
|
-
stderr: "inherit",
|
|
38
|
-
forceKillAfter
|
|
39
|
-
});
|
|
40
|
-
const [output, code] = yield* Effect.all([handle.stdout.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
41
|
-
return {
|
|
42
|
-
output,
|
|
43
|
-
code
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
const outputWith = (command) => collected(command).pipe(Effect.scoped, Effect.filterOrFail(({ code }) => code === SUCCESS, () => failed(command)), Effect.map(({ output }) => String$1.trim(output)));
|
|
47
|
-
/** @internal */
|
|
48
|
-
const succeeds = succeedsWith;
|
|
49
|
-
/** @internal */
|
|
50
|
-
const mustSucceed = mustSucceedWith;
|
|
51
|
-
/** @internal */
|
|
52
|
-
const outputOf = outputWith;
|
|
11
|
+
import { Base64 } from "effect/encoding";
|
|
53
12
|
// src/features/publish-workspace/model/export-targets.ts
|
|
54
13
|
const PATTERN = "*";
|
|
55
14
|
const taggedError$3 = Schema.TaggedError;
|