@r_masseater/msch 0.48.1 → 0.50.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/dist/cargo-inputs.mjs +4 -4
- package/dist/cargo-inputs.mjs.map +1 -1
- package/dist/changed.mjs +4 -4
- package/dist/{check-upstream-exits-22kQ5juG.mjs → check-upstream-exits-DYxWDyHC.mjs} +2 -2
- package/dist/{check-upstream-exits-22kQ5juG.mjs.map → check-upstream-exits-DYxWDyHC.mjs.map} +1 -1
- package/dist/cli.mjs +210 -124
- package/dist/cli.mjs.map +1 -1
- package/dist/{comment-directives-CRAU6yNZ.mjs → comment-directives-CXgB6xpE.mjs} +1 -3
- package/dist/comment-directives-CXgB6xpE.mjs.map +1 -0
- package/dist/config.d.mts +5 -0
- package/dist/config.mjs +13 -6
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-BhT4RpHs.mjs → define-lint-preset-B1Xy1brk.mjs} +15 -2
- package/dist/define-lint-preset-B1Xy1brk.mjs.map +1 -0
- package/dist/{dependencies-Bh625TQu.mjs → dependencies-DbwLA4nT.mjs} +10 -11
- package/dist/dependencies-DbwLA4nT.mjs.map +1 -0
- package/dist/exits.mjs +3 -3
- package/dist/ignored-directories-BTMTNuAx.mjs +85 -0
- package/dist/ignored-directories-BTMTNuAx.mjs.map +1 -0
- package/dist/lint.mjs +1 -1
- package/dist/oxlint.mjs +2 -2
- package/dist/{package-M3y-ZOGZ.mjs → package-BKpgZyaV.mjs} +3 -3
- package/dist/{package-M3y-ZOGZ.mjs.map → package-BKpgZyaV.mjs.map} +1 -1
- package/dist/{problem-DHWbumiO.mjs → problem-D8mlJc3T.mjs} +2 -2
- package/dist/{problem-DHWbumiO.mjs.map → problem-D8mlJc3T.mjs.map} +1 -1
- package/dist/{project-DmUvZQEd.mjs → project-CR2jzkij.mjs} +4 -4
- package/dist/{project-DmUvZQEd.mjs.map → project-CR2jzkij.mjs.map} +1 -1
- package/dist/publish.mjs +11 -41
- package/dist/publish.mjs.map +1 -1
- package/dist/{repository-files-CEaXCw-J.mjs → repository-files-B5sRbxlz.mjs} +7 -1
- package/dist/repository-files-B5sRbxlz.mjs.map +1 -0
- package/dist/{runtime-Calown4W.mjs → runtime-DFsdNYI0.mjs} +2 -2
- package/dist/{runtime-Calown4W.mjs.map → runtime-DFsdNYI0.mjs.map} +1 -1
- package/dist/{syntax-P4jlh7LM.mjs → syntax-3AJkpCcs.mjs} +2 -2
- package/dist/{syntax-P4jlh7LM.mjs.map → syntax-3AJkpCcs.mjs.map} +1 -1
- package/dist/workspace-settings.mjs +4 -4
- package/package.json +4 -2
- package/skills/repository-config/SKILL.md +7 -7
- package/dist/comment-directives-CRAU6yNZ.mjs.map +0 -1
- package/dist/define-lint-preset-BhT4RpHs.mjs.map +0 -1
- package/dist/dependencies-Bh625TQu.mjs.map +0 -1
- package/dist/ignored-directories-BrwYtwZw.mjs +0 -57
- package/dist/ignored-directories-BrwYtwZw.mjs.map +0 -1
- package/dist/repository-files-CEaXCw-J.mjs.map +0 -1
package/dist/cargo-inputs.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-
|
|
1
|
+
import { n as collectPlacedIgnoredDirectories } from "./ignored-directories-BTMTNuAx.mjs";
|
|
2
|
+
import { i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-B5sRbxlz.mjs";
|
|
3
3
|
import { t as startedOnce } from "./started-once-CkTooI_o.mjs";
|
|
4
4
|
import { t as reachable } from "./reachable-Cc-255L3.mjs";
|
|
5
5
|
import { Array, Console, Effect, Layer, Option, Record, Schema, Stream, String as String$1, pipe } from "effect";
|
|
@@ -141,7 +141,7 @@ const scopedExtra = (owner) => (extra) => {
|
|
|
141
141
|
};
|
|
142
142
|
const excludedFrom = (workspace, walked, kept) => pipe(workspace.ignored, Array.filter(({ pattern }) => {
|
|
143
143
|
const covered = withoutContents(String$1.slice(1)(pattern));
|
|
144
|
-
return
|
|
144
|
+
return pipe(walked, Array.some((dir) => isWithin(dir)(covered))) && !pipe(kept, Array.some(isWithin(covered)));
|
|
145
145
|
}));
|
|
146
146
|
const generatedIn = (walked) => pipe(walked, Array.flatMap((dir) => pipe(GENERATED, Array.map((name) => `${NEGATION}${dir}/${ANYWHERE}${name}${CONTENTS}`))));
|
|
147
147
|
const externalIds = (closure) => pipe(closure, Array.filter((entry) => !isLocal(entry)), Array.map((entry) => entry.id));
|
|
@@ -235,7 +235,7 @@ const workspaceIn = Effect.fn("workspaceIn")(function* workspaceIn(root) {
|
|
|
235
235
|
onNone: () => readSource(root),
|
|
236
236
|
onSome: Effect.succeed
|
|
237
237
|
}),
|
|
238
|
-
ignored: yield*
|
|
238
|
+
ignored: yield* collectPlacedIgnoredDirectories(root)
|
|
239
239
|
};
|
|
240
240
|
});
|
|
241
241
|
const warn = (root, reason) => Console.error(`msch: the cargo workspace in ${root} could not be read, so its cargo tasks track every file they read: ${reason}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cargo-inputs.mjs","names":["Str","Rec","Arr","taggedError","Rec","Arr","Str","Arr","Str","Arr","Str"],"sources":["../src/features/derive-cargo-inputs/model/cargo-metadata.ts","../src/features/derive-cargo-inputs/model/root-manifest.ts","../src/features/derive-cargo-inputs/model/cargo-inputs.ts","../src/features/derive-cargo-inputs/model/derive.ts"],"sourcesContent":["import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { reachable } from \"#/shared/lib/reachable.ts\";\n\nexport const SEPARATOR = \"/\";\nexport const LOCK_FILE = \"Cargo.lock\";\nexport const MANIFEST_FILE = \"Cargo.toml\";\nexport const WORKSPACE_CACHE = \"node_modules/.cache/msch/cargo-workspace.json\";\nconst LAST_SEGMENT = /\\/[^/]*$/u;\n\nconst IgnoredDirectory = Schema.Struct({\n pattern: Schema.String,\n base: Schema.Literal(\"workspace\"),\n});\nconst CargoPackageSchema = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n manifest_path: Schema.String,\n source: Schema.NullOr(Schema.String),\n});\nconst CargoNode = Schema.Struct({\n id: Schema.String,\n deps: Schema.Array(Schema.Struct({ pkg: Schema.String })),\n});\nexport const CargoMetadataSchema = Schema.Struct({\n packages: Schema.Array(CargoPackageSchema),\n resolve: Schema.Struct({ nodes: Schema.Array(CargoNode) }),\n workspace_members: Schema.Array(Schema.String),\n workspace_root: Schema.String,\n});\nexport const CargoSourceSchema = Schema.Struct({\n metadata: CargoMetadataSchema,\n manifest: Schema.String,\n});\nexport const CargoWorkspaceSchema = Schema.Struct({\n ...CargoSourceSchema.fields,\n ignored: Schema.Array(IgnoredDirectory),\n});\nexport type CargoMetadata = typeof CargoMetadataSchema.Type;\nexport type CargoSource = typeof CargoSourceSchema.Type;\nexport type CargoWorkspace = typeof CargoWorkspaceSchema.Type;\nexport type CargoPackage = typeof CargoPackageSchema.Type;\n\nconst normalized = Str.replaceAll(\"\\\\\", SEPARATOR);\n\nexport const relativeTo =\n (root: string) =>\n (file: string): Option.Option<string> => {\n const prefix = `${normalized(root)}${SEPARATOR}`;\n const path = normalized(file);\n return Option.some(Str.slice(prefix.length)(path)).pipe(\n Option.filter(() => Str.startsWith(prefix)(path)),\n );\n };\n\nexport const directoryOf = (file: string): string =>\n pipe(normalized(file), Str.replace(LAST_SEGMENT, \"\"));\n\nexport const isWithin =\n (directory: string) =>\n (path: string): boolean =>\n Str.isEmpty(directory) ||\n path === directory ||\n Str.startsWith(`${directory}${SEPARATOR}`)(path);\n\nexport const isLocal = (entry: CargoPackage): boolean => entry.source === null;\n\nexport const closureOf =\n (metadata: CargoMetadata) =>\n (roots: readonly string[]): readonly CargoPackage[] => {\n const edges = Rec.fromEntries(\n pipe(\n metadata.resolve.nodes,\n Arr.map(\n (node) =>\n [\n node.id,\n pipe(\n node.deps,\n Arr.map(({ pkg }) => pkg),\n ),\n ] as const,\n ),\n ),\n );\n const ids = new Set(reachable(edges, roots));\n return pipe(\n metadata.packages,\n Arr.filter((entry) => ids.has(entry.id)),\n );\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./cargo-metadata.ts\";\n\nconst WORKSPACE = \"workspace\";\nconst PROFILE = \"profile\";\nconst PACKAGE = \"package\";\nconst MEMBER_LISTS = new Set([\"members\", \"exclude\", \"default-members\"]);\nconst EVERY_PACKAGE = \"*\";\nconst VERSION_MARK = \"@\";\nconst URL_MARK = \"/\";\n\ntype Table = Readonly<Record<string, unknown>>;\n\nconst taggedError = Schema.TaggedError;\n\nclass ManifestUnreadable extends taggedError<\n ManifestUnreadable,\n { readonly brand: unique symbol }\n>()(\"ManifestUnreadable\", { file: Schema.String }) {}\n\nconst ManifestJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));\nconst decodeManifest = Schema.decodeUnknownOption(ManifestJson);\nconst encodeManifest = Schema.encodeOption(ManifestJson);\nconst encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\nconst decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));\n\nconst mapTable =\n (change: (table: Table) => Table) =>\n (value: unknown): unknown =>\n pipe(\n decodeTable(value),\n Option.map(change),\n Option.getOrElse(() => value),\n );\n\nconst mapField =\n (name: string, change: (value: unknown) => unknown) =>\n (table: Table): Table => {\n if (!Rec.has(table, name)) {\n return table;\n }\n return { ...table, [name]: change(table[name]) };\n };\n\nconst nameOf = (spec: string): string => Arr.headNonEmpty(Str.split(spec, VERSION_MARK));\n\nconst overrides =\n (closure: readonly string[]) =>\n (spec: string): boolean =>\n spec === EVERY_PACKAGE ||\n Str.includes(URL_MARK)(spec) ||\n pipe(closure, Arr.contains(nameOf(spec)));\n\nconst withoutMembers = (workspace: Table): Table =>\n pipe(\n workspace,\n Rec.filter((_value, key) => !MEMBER_LISTS.has(key)),\n );\n\nconst keptOverrides = (closure: readonly string[]): ((packages: unknown) => unknown) => {\n const applies = overrides(closure);\n return mapTable((packages) =>\n pipe(\n packages,\n Rec.filter((_value, spec) => applies(spec)),\n ),\n );\n};\n\nconst profilesFor = (closure: readonly string[]): ((profiles: unknown) => unknown) => {\n const profileFor = mapTable(mapField(PACKAGE, keptOverrides(closure)));\n return mapTable(Rec.map(profileFor));\n};\n\nconst withoutMemberLists = mapField(WORKSPACE, mapTable(withoutMembers));\n\nexport const readManifest = Effect.fn(\"readManifest\")(function* readManifest(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, MANIFEST_FILE);\n const text = yield* files.readFile(file);\n const value = yield* Effect.try({\n try: () => getStaticTOMLValue(parseTOML(Option.getOrElse(text, () => \"\"))),\n catch: () => ManifestUnreadable.make({ file }),\n });\n return yield* encodeJson(value);\n});\n\nexport const manifestFor =\n (closure: readonly string[]) =>\n (manifest: string): string => {\n const forClosure = mapField(PROFILE, profilesFor(closure));\n return pipe(\n decodeManifest(manifest),\n Option.map(withoutMemberLists),\n Option.map(forClosure),\n Option.flatMap(encodeManifest),\n Option.getOrElse(() => manifest),\n );\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n LOCK_FILE,\n MANIFEST_FILE,\n SEPARATOR,\n WORKSPACE_CACHE,\n closureOf,\n directoryOf,\n isLocal,\n isWithin,\n relativeTo,\n} from \"./cargo-metadata.ts\";\nimport type { CargoMetadata, CargoPackage, CargoWorkspace } from \"./cargo-metadata.ts\";\nimport { manifestFor } from \"./root-manifest.ts\";\n\nconst NEGATION = \"!\";\nconst CONTENTS = \"/**\";\nconst ANYWHERE = \"**/\";\nconst CLOSURE_DIRECTORY = \"node_modules/.cache/msch/cargo-inputs\";\nconst CLOSURE_SUFFIX = \".lock\";\nconst ROOT_SLUG = \"root\";\nconst SLUG_SEPARATOR = \"__\";\nconst LINE = \"\\n\";\nconst WORKSPACE_FILES = [\"rust-toolchain.toml\", \".cargo/**\"] as const;\nconst GENERATED = [\"node_modules\", \"dist\"] as const;\n\nexport type CargoInput =\n | { readonly pattern: string; readonly base: \"workspace\" }\n | { readonly auto: true };\n\nexport interface DerivedInputs {\n readonly inputs: readonly CargoInput[];\n readonly closureFile: string;\n readonly closure: string;\n}\n\nexport interface CargoInputRequest {\n readonly workspace: CargoWorkspace;\n readonly directory: string;\n readonly extras: readonly string[];\n}\n\nconst workspaceInput = (pattern: string): CargoInput => ({ pattern, base: \"workspace\" });\n\nexport const DERIVATION_READS: readonly CargoInput[] = pipe(\n [LOCK_FILE, MANIFEST_FILE, WORKSPACE_CACHE, `${CLOSURE_DIRECTORY}${CONTENTS}`],\n Arr.map((file) => workspaceInput(`${NEGATION}${file}`)),\n);\n\nconst withoutContents = Str.replace(CONTENTS, \"\");\n\nconst slugOf = (owner: string): string =>\n Option.match(Option.liftPredicate(owner, Str.isNonEmpty), {\n onNone: () => ROOT_SLUG,\n onSome: Str.replaceAll(SEPARATOR, SLUG_SEPARATOR),\n });\n\nconst ownedRoots = (metadata: CargoMetadata, owner: string): readonly string[] => {\n const relative = relativeTo(metadata.workspace_root);\n const owned = new Set(\n pipe(\n metadata.packages,\n Arr.filter((entry) =>\n pipe(relative(directoryOf(entry.manifest_path)), Option.exists(isWithin(owner))),\n ),\n Arr.map((entry) => entry.id),\n ),\n );\n return pipe(\n metadata.workspace_members,\n Arr.filter((id) => owned.has(id)),\n );\n};\n\nconst scopedExtra =\n (owner: string) =>\n (extra: string): string => {\n if (Str.startsWith(NEGATION)(extra)) {\n return `${NEGATION}${owner}${SEPARATOR}${Str.slice(NEGATION.length)(extra)}`;\n }\n return `${owner}${SEPARATOR}${extra}`;\n };\n\nconst excludedFrom = (\n workspace: CargoWorkspace,\n walked: readonly string[],\n kept: readonly string[],\n): readonly CargoInput[] =>\n pipe(\n workspace.ignored,\n Arr.filter(({ pattern }) => {\n const covered = withoutContents(Str.slice(NEGATION.length)(pattern));\n const applies =\n Str.startsWith(ANYWHERE)(covered) ||\n pipe(\n walked,\n Arr.some((dir) => isWithin(dir)(covered)),\n );\n return applies && !pipe(kept, Arr.some(isWithin(covered)));\n }),\n );\n\nconst generatedIn = (walked: readonly string[]): readonly string[] =>\n pipe(\n walked,\n Arr.flatMap((dir) =>\n pipe(\n GENERATED,\n Arr.map((name) => `${NEGATION}${dir}${SEPARATOR}${ANYWHERE}${name}${CONTENTS}`),\n ),\n ),\n );\n\nconst externalIds = (closure: readonly CargoPackage[]): readonly string[] =>\n pipe(\n closure,\n Arr.filter((entry) => !isLocal(entry)),\n Arr.map((entry) => entry.id),\n );\n\nconst closureText = (manifest: string, closure: readonly CargoPackage[]): string => {\n const names = pipe(\n closure,\n Arr.map((entry) => entry.name),\n );\n return Arr.join(\n [...Arr.sort(externalIds(closure), Str.Order), manifestFor(names)(manifest)],\n LINE,\n );\n};\n\n/** @internal */\nexport const cargoInputsOf = ({\n workspace,\n directory,\n extras,\n}: CargoInputRequest): DerivedInputs => {\n const { metadata } = workspace;\n const relative = relativeTo(metadata.workspace_root);\n const owner = Option.getOrElse(relative(directory), () => \"\");\n const closure = closureOf(metadata)(ownedRoots(metadata, owner));\n const walked = Arr.sort(\n pipe(\n closure,\n Arr.filter(isLocal),\n Arr.flatMap((entry) => Option.toArray(relative(directoryOf(entry.manifest_path)))),\n ),\n Str.Order,\n );\n const added = pipe(extras, Arr.map(scopedExtra(owner)));\n const kept = pipe(\n added,\n Arr.filter((extra) => !Str.startsWith(NEGATION)(extra)),\n Arr.map(withoutContents),\n );\n const closureFile = `${CLOSURE_DIRECTORY}${SEPARATOR}${slugOf(owner)}${CLOSURE_SUFFIX}`;\n return {\n inputs: [\n ...pipe(\n walked,\n Arr.map((dir) => workspaceInput(`${dir}${CONTENTS}`)),\n ),\n workspaceInput(closureFile),\n ...pipe(WORKSPACE_FILES, Arr.map(workspaceInput)),\n ...excludedFrom(workspace, walked, kept),\n ...pipe(generatedIn(walked), Arr.map(workspaceInput)),\n ...pipe(added, Arr.map(workspaceInput)),\n ],\n closureFile,\n closure: closureText(workspace.manifest, closure),\n };\n};\n","import {\n Array as Arr,\n Console,\n Effect,\n Layer,\n Option,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { collectIgnoredDirectories } from \"#/shared/lib/ignored-directories.ts\";\nimport {\n RepositoryFiles,\n nodeRepositoryFiles,\n nodeServicesLayer,\n} from \"#/shared/lib/repository-files.ts\";\nimport { startedOnce } from \"#/shared/lib/started-once.ts\";\n\nimport { cargoInputsOf } from \"./cargo-inputs.ts\";\nimport type { CargoInput, DerivedInputs } from \"./cargo-inputs.ts\";\nimport {\n CargoMetadataSchema,\n CargoSourceSchema,\n LOCK_FILE,\n MANIFEST_FILE,\n WORKSPACE_CACHE,\n} from \"./cargo-metadata.ts\";\nimport type { CargoSource, CargoWorkspace } from \"./cargo-metadata.ts\";\nimport { readManifest } from \"./root-manifest.ts\";\n\nconst KEY_SEPARATOR = \"\\u0000\";\nconst SUCCESS = 0;\nconst KEYS = [LOCK_FILE, MANIFEST_FILE] as const;\nconst METADATA_ARGS = [\"metadata\", \"--format-version\", \"1\", \"--offline\", \"--locked\"];\n\nconst CachedSource = Schema.fromJsonString(\n Schema.Struct({\n fingerprint: Schema.String,\n source: CargoSourceSchema,\n }),\n);\nconst decodeMetadata = Schema.decodeUnknownEffect(Schema.fromJsonString(CargoMetadataSchema));\nconst decodeCached = Schema.decodeUnknownOption(CachedSource);\nconst encodeCached = Schema.encodeEffect(CachedSource);\n\nconst taggedError = Schema.TaggedError;\n\nclass MetadataFailed extends taggedError<MetadataFailed, { readonly brand: unique symbol }>()(\n \"MetadataFailed\",\n { output: Schema.String },\n) {}\n\nconst AUTO: readonly CargoInput[] = [{ auto: true }];\nconst nodeLayer = Layer.provideMerge(nodeRepositoryFiles, nodeServicesLayer);\n\nexport interface CargoInputOptions {\n readonly directory: string;\n readonly extras?: readonly string[];\n}\n\nconst fingerprintOf = Effect.fn(\"fingerprintOf\")(function* fingerprintOf(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* Effect.forEach(KEYS, (key) => files.readFile(files.join(root, key)), {\n concurrency: \"unbounded\",\n });\n return yield* files.hash(\n pipe(\n texts,\n Arr.map((text) => Option.getOrElse(text, () => \"\")),\n Arr.join(KEY_SEPARATOR),\n ),\n );\n});\n\nconst cachedSource = Effect.fn(\"cachedSource\")(function* cachedSource(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, WORKSPACE_CACHE));\n const fingerprint = yield* fingerprintOf(root);\n return text.pipe(\n Option.flatMap(decodeCached),\n Option.filter((cached) => cached.fingerprint === fingerprint),\n Option.map((cached) => cached.source),\n );\n});\n\nconst metadataIn = Effect.fn(\"metadataIn\")(function* metadataIn(root: string) {\n const handle = yield* ChildProcess.make(\"cargo\", METADATA_ARGS, {\n cwd: root,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [output, problem] = yield* Effect.all(\n [\n handle.stdout.pipe(Stream.decodeText(), Stream.mkString),\n handle.stderr.pipe(Stream.decodeText(), Stream.mkString),\n ],\n { concurrency: \"unbounded\" },\n );\n const code = yield* handle.exitCode;\n if (code !== SUCCESS) {\n return yield* MetadataFailed.make({ output: Str.trim(problem) });\n }\n return yield* decodeMetadata(output);\n}, Effect.scoped);\n\nconst readSource = Effect.fn(\"readSource\")(function* readSource(root: string) {\n const files = yield* RepositoryFiles;\n const source: CargoSource = {\n metadata: yield* metadataIn(root),\n manifest: yield* readManifest(root),\n };\n const text = yield* encodeCached({ fingerprint: yield* fingerprintOf(root), source });\n yield* files.writeFile(files.join(root, WORKSPACE_CACHE), text);\n return source;\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(root: string) {\n const cached = yield* cachedSource(root);\n const source = yield* Option.match(cached, {\n onNone: () => readSource(root),\n onSome: Effect.succeed,\n });\n const workspace: CargoWorkspace = {\n ...source,\n ignored: yield* collectIgnoredDirectories(root),\n };\n return workspace;\n});\n\nconst warn = (root: string, reason: string): Effect.Effect<void> =>\n Console.error(\n `msch: the cargo workspace in ${root} could not be read, so its cargo tasks track every file they read: ${reason}`,\n );\n\nconst loaded = (\n root: string,\n): Effect.Effect<Option.Option<CargoWorkspace>, never, Layer.Success<typeof nodeLayer>> =>\n workspaceIn(root).pipe(\n Effect.asSome,\n Effect.catchTag(\"MetadataFailed\", ({ output }) => Effect.fail(output)),\n Effect.tapError((cause) => warn(root, String(cause))),\n Effect.orElseSucceed(() => Option.none<CargoWorkspace>()),\n );\n\nconst loadedOnce = startedOnce<Option.Option<CargoWorkspace>>();\n\nconst loadWorkspace = (root: string): Promise<Option.Option<CargoWorkspace>> =>\n loadedOnce(root, () => Effect.runPromise(loaded(root).pipe(Effect.provide(nodeLayer))));\n\nconst lockDirectory = (\n directory: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* findLockDirectory() {\n const files = yield* RepositoryFiles;\n if (yield* files.exists(files.join(directory, LOCK_FILE))) {\n return Option.some(directory);\n }\n const parent = files.dirname(directory);\n if (parent === directory) {\n return Option.none<string>();\n }\n return yield* lockDirectory(parent);\n });\n\nconst writeClosure = Effect.fn(\"writeClosure\")(function* writeClosure(\n root: string,\n derived: DerivedInputs,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, derived.closureFile);\n const written = yield* files.readFile(file);\n if (!Option.exists(written, (text) => text === derived.closure)) {\n yield* files.writeFile(file, derived.closure);\n }\n return derived.inputs;\n});\n\nconst inputsIn = Effect.fn(\"inputsIn\")(function* inputsIn(\n root: string,\n directory: string,\n extras: readonly string[],\n) {\n const workspace = yield* Effect.promise(() => loadWorkspace(root));\n return yield* Option.match(workspace, {\n onNone: () => Effect.succeed(AUTO),\n onSome: (found) => writeClosure(root, cargoInputsOf({ workspace: found, directory, extras })),\n });\n});\n\nconst deriveCargoInputs = Effect.fn(\"deriveCargoInputs\")(function* deriveCargoInputs({\n directory,\n extras = [],\n}: CargoInputOptions) {\n const files = yield* RepositoryFiles;\n const absolute = files.resolve(directory);\n const root = yield* lockDirectory(absolute);\n return yield* Option.match(root, {\n onNone: () => Effect.succeed(AUTO),\n onSome: (found) => inputsIn(found, absolute, extras),\n });\n});\n\nexport const cargoInputs = (options: CargoInputOptions): Promise<readonly CargoInput[]> =>\n Effect.runPromise(deriveCargoInputs(options).pipe(Effect.provide(nodeLayer)));\n"],"mappings":";;;;;;;AAKA,MAAa,YAAY;AACzB,MAAa,gBAAgB;AAC7B,MAAa,kBAAkB;AAC/B,MAAM,eAAe;AAErB,MAAM,mBAAmB,OAAO,OAAO;CACrC,SAAS,OAAO;CAChB,MAAM,OAAO,QAAQ,WAAW;AAClC,CAAC;AACD,MAAM,qBAAqB,OAAO,OAAO;CACvC,IAAI,OAAO;CACX,MAAM,OAAO;CACb,eAAe,OAAO;CACtB,QAAQ,OAAO,OAAO,OAAO,MAAM;AACrC,CAAC;AACD,MAAM,YAAY,OAAO,OAAO;CAC9B,IAAI,OAAO;CACX,MAAM,OAAO,MAAM,OAAO,OAAO,EAAE,KAAK,OAAO,OAAO,CAAC,CAAC;AAC1D,CAAC;AACD,MAAa,sBAAsB,OAAO,OAAO;CAC/C,UAAU,OAAO,MAAM,kBAAkB;CACzC,SAAS,OAAO,OAAO,EAAE,OAAO,OAAO,MAAM,SAAS,EAAE,CAAC;CACzD,mBAAmB,OAAO,MAAM,OAAO,MAAM;CAC7C,gBAAgB,OAAO;AACzB,CAAC;AACD,MAAa,oBAAoB,OAAO,OAAO;CAC7C,UAAU;CACV,UAAU,OAAO;AACnB,CAAC;AACmC,OAAO,OAAO;CAChD,GAAG,kBAAkB;CACrB,SAAS,OAAO,MAAM,gBAAgB;AACxC,CAAC;AAMD,MAAM,aAAaA,SAAI,WAAW,MAAA,GAAe;AAEjD,MAAa,cACV,UACA,S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AAO,MAAM,MAAM;EAC/B,cAAc,OAAO,QAAQ,IAAI;EACjC,SAAS,UAAU,SAAS,OAAO,UAAU,MAAM;CACrD,CAAC;AACH,CAAC;AAED,MAAa,eAAe,YAC1B,OAAO,WAAW,kBAAkB,OAAO,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"cargo-inputs.mjs","names":["Str","Rec","Arr","taggedError","Rec","Arr","Str","Arr","Str","Arr","Str"],"sources":["../src/features/derive-cargo-inputs/model/cargo-metadata.ts","../src/features/derive-cargo-inputs/model/root-manifest.ts","../src/features/derive-cargo-inputs/model/cargo-inputs.ts","../src/features/derive-cargo-inputs/model/derive.ts"],"sourcesContent":["import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { reachable } from \"#/shared/lib/reachable.ts\";\n\nexport const SEPARATOR = \"/\";\nexport const LOCK_FILE = \"Cargo.lock\";\nexport const MANIFEST_FILE = \"Cargo.toml\";\nexport const WORKSPACE_CACHE = \"node_modules/.cache/msch/cargo-workspace.json\";\nconst LAST_SEGMENT = /\\/[^/]*$/u;\n\nconst IgnoredDirectory = Schema.Struct({\n pattern: Schema.String,\n base: Schema.Literal(\"workspace\"),\n});\nconst CargoPackageSchema = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n manifest_path: Schema.String,\n source: Schema.NullOr(Schema.String),\n});\nconst CargoNode = Schema.Struct({\n id: Schema.String,\n deps: Schema.Array(Schema.Struct({ pkg: Schema.String })),\n});\nexport const CargoMetadataSchema = Schema.Struct({\n packages: Schema.Array(CargoPackageSchema),\n resolve: Schema.Struct({ nodes: Schema.Array(CargoNode) }),\n workspace_members: Schema.Array(Schema.String),\n workspace_root: Schema.String,\n});\nexport const CargoSourceSchema = Schema.Struct({\n metadata: CargoMetadataSchema,\n manifest: Schema.String,\n});\nexport const CargoWorkspaceSchema = Schema.Struct({\n ...CargoSourceSchema.fields,\n ignored: Schema.Array(IgnoredDirectory),\n});\nexport type CargoMetadata = typeof CargoMetadataSchema.Type;\nexport type CargoSource = typeof CargoSourceSchema.Type;\nexport type CargoWorkspace = typeof CargoWorkspaceSchema.Type;\nexport type CargoPackage = typeof CargoPackageSchema.Type;\n\nconst normalized = Str.replaceAll(\"\\\\\", SEPARATOR);\n\nexport const relativeTo =\n (root: string) =>\n (file: string): Option.Option<string> => {\n const prefix = `${normalized(root)}${SEPARATOR}`;\n const path = normalized(file);\n return Option.some(Str.slice(prefix.length)(path)).pipe(\n Option.filter(() => Str.startsWith(prefix)(path)),\n );\n };\n\nexport const directoryOf = (file: string): string =>\n pipe(normalized(file), Str.replace(LAST_SEGMENT, \"\"));\n\nexport const isWithin =\n (directory: string) =>\n (path: string): boolean =>\n Str.isEmpty(directory) ||\n path === directory ||\n Str.startsWith(`${directory}${SEPARATOR}`)(path);\n\nexport const isLocal = (entry: CargoPackage): boolean => entry.source === null;\n\nexport const closureOf =\n (metadata: CargoMetadata) =>\n (roots: readonly string[]): readonly CargoPackage[] => {\n const edges = Rec.fromEntries(\n pipe(\n metadata.resolve.nodes,\n Arr.map(\n (node) =>\n [\n node.id,\n pipe(\n node.deps,\n Arr.map(({ pkg }) => pkg),\n ),\n ] as const,\n ),\n ),\n );\n const ids = new Set(reachable(edges, roots));\n return pipe(\n metadata.packages,\n Arr.filter((entry) => ids.has(entry.id)),\n );\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./cargo-metadata.ts\";\n\nconst WORKSPACE = \"workspace\";\nconst PROFILE = \"profile\";\nconst PACKAGE = \"package\";\nconst MEMBER_LISTS = new Set([\"members\", \"exclude\", \"default-members\"]);\nconst EVERY_PACKAGE = \"*\";\nconst VERSION_MARK = \"@\";\nconst URL_MARK = \"/\";\n\ntype Table = Readonly<Record<string, unknown>>;\n\nconst taggedError = Schema.TaggedError;\n\nclass ManifestUnreadable extends taggedError<\n ManifestUnreadable,\n { readonly brand: unique symbol }\n>()(\"ManifestUnreadable\", { file: Schema.String }) {}\n\nconst ManifestJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));\nconst decodeManifest = Schema.decodeUnknownOption(ManifestJson);\nconst encodeManifest = Schema.encodeOption(ManifestJson);\nconst encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\nconst decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));\n\nconst mapTable =\n (change: (table: Table) => Table) =>\n (value: unknown): unknown =>\n pipe(\n decodeTable(value),\n Option.map(change),\n Option.getOrElse(() => value),\n );\n\nconst mapField =\n (name: string, change: (value: unknown) => unknown) =>\n (table: Table): Table => {\n if (!Rec.has(table, name)) {\n return table;\n }\n return { ...table, [name]: change(table[name]) };\n };\n\nconst nameOf = (spec: string): string => Arr.headNonEmpty(Str.split(spec, VERSION_MARK));\n\nconst overrides =\n (closure: readonly string[]) =>\n (spec: string): boolean =>\n spec === EVERY_PACKAGE ||\n Str.includes(URL_MARK)(spec) ||\n pipe(closure, Arr.contains(nameOf(spec)));\n\nconst withoutMembers = (workspace: Table): Table =>\n pipe(\n workspace,\n Rec.filter((_value, key) => !MEMBER_LISTS.has(key)),\n );\n\nconst keptOverrides = (closure: readonly string[]): ((packages: unknown) => unknown) => {\n const applies = overrides(closure);\n return mapTable((packages) =>\n pipe(\n packages,\n Rec.filter((_value, spec) => applies(spec)),\n ),\n );\n};\n\nconst profilesFor = (closure: readonly string[]): ((profiles: unknown) => unknown) => {\n const profileFor = mapTable(mapField(PACKAGE, keptOverrides(closure)));\n return mapTable(Rec.map(profileFor));\n};\n\nconst withoutMemberLists = mapField(WORKSPACE, mapTable(withoutMembers));\n\nexport const readManifest = Effect.fn(\"readManifest\")(function* readManifest(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, MANIFEST_FILE);\n const text = yield* files.readFile(file);\n const value = yield* Effect.try({\n try: () => getStaticTOMLValue(parseTOML(Option.getOrElse(text, () => \"\"))),\n catch: () => ManifestUnreadable.make({ file }),\n });\n return yield* encodeJson(value);\n});\n\nexport const manifestFor =\n (closure: readonly string[]) =>\n (manifest: string): string => {\n const forClosure = mapField(PROFILE, profilesFor(closure));\n return pipe(\n decodeManifest(manifest),\n Option.map(withoutMemberLists),\n Option.map(forClosure),\n Option.flatMap(encodeManifest),\n Option.getOrElse(() => manifest),\n );\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n LOCK_FILE,\n MANIFEST_FILE,\n SEPARATOR,\n WORKSPACE_CACHE,\n closureOf,\n directoryOf,\n isLocal,\n isWithin,\n relativeTo,\n} from \"./cargo-metadata.ts\";\nimport type { CargoMetadata, CargoPackage, CargoWorkspace } from \"./cargo-metadata.ts\";\nimport { manifestFor } from \"./root-manifest.ts\";\n\nconst NEGATION = \"!\";\nconst CONTENTS = \"/**\";\nconst ANYWHERE = \"**/\";\nconst CLOSURE_DIRECTORY = \"node_modules/.cache/msch/cargo-inputs\";\nconst CLOSURE_SUFFIX = \".lock\";\nconst ROOT_SLUG = \"root\";\nconst SLUG_SEPARATOR = \"__\";\nconst LINE = \"\\n\";\nconst WORKSPACE_FILES = [\"rust-toolchain.toml\", \".cargo/**\"] as const;\nconst GENERATED = [\"node_modules\", \"dist\"] as const;\n\nexport type CargoInput =\n | { readonly pattern: string; readonly base: \"workspace\" }\n | { readonly auto: true };\n\nexport interface DerivedInputs {\n readonly inputs: readonly CargoInput[];\n readonly closureFile: string;\n readonly closure: string;\n}\n\nexport interface CargoInputRequest {\n readonly workspace: CargoWorkspace;\n readonly directory: string;\n readonly extras: readonly string[];\n}\n\nconst workspaceInput = (pattern: string): CargoInput => ({ pattern, base: \"workspace\" });\n\nexport const DERIVATION_READS: readonly CargoInput[] = pipe(\n [LOCK_FILE, MANIFEST_FILE, WORKSPACE_CACHE, `${CLOSURE_DIRECTORY}${CONTENTS}`],\n Arr.map((file) => workspaceInput(`${NEGATION}${file}`)),\n);\n\nconst withoutContents = Str.replace(CONTENTS, \"\");\n\nconst slugOf = (owner: string): string =>\n Option.match(Option.liftPredicate(owner, Str.isNonEmpty), {\n onNone: () => ROOT_SLUG,\n onSome: Str.replaceAll(SEPARATOR, SLUG_SEPARATOR),\n });\n\nconst ownedRoots = (metadata: CargoMetadata, owner: string): readonly string[] => {\n const relative = relativeTo(metadata.workspace_root);\n const owned = new Set(\n pipe(\n metadata.packages,\n Arr.filter((entry) =>\n pipe(relative(directoryOf(entry.manifest_path)), Option.exists(isWithin(owner))),\n ),\n Arr.map((entry) => entry.id),\n ),\n );\n return pipe(\n metadata.workspace_members,\n Arr.filter((id) => owned.has(id)),\n );\n};\n\nconst scopedExtra =\n (owner: string) =>\n (extra: string): string => {\n if (Str.startsWith(NEGATION)(extra)) {\n return `${NEGATION}${owner}${SEPARATOR}${Str.slice(NEGATION.length)(extra)}`;\n }\n return `${owner}${SEPARATOR}${extra}`;\n };\n\nconst excludedFrom = (\n workspace: CargoWorkspace,\n walked: readonly string[],\n kept: readonly string[],\n): readonly CargoInput[] =>\n pipe(\n workspace.ignored,\n Arr.filter(({ pattern }) => {\n const covered = withoutContents(Str.slice(NEGATION.length)(pattern));\n const applies = pipe(\n walked,\n Arr.some((dir) => isWithin(dir)(covered)),\n );\n return applies && !pipe(kept, Arr.some(isWithin(covered)));\n }),\n );\n\nconst generatedIn = (walked: readonly string[]): readonly string[] =>\n pipe(\n walked,\n Arr.flatMap((dir) =>\n pipe(\n GENERATED,\n Arr.map((name) => `${NEGATION}${dir}${SEPARATOR}${ANYWHERE}${name}${CONTENTS}`),\n ),\n ),\n );\n\nconst externalIds = (closure: readonly CargoPackage[]): readonly string[] =>\n pipe(\n closure,\n Arr.filter((entry) => !isLocal(entry)),\n Arr.map((entry) => entry.id),\n );\n\nconst closureText = (manifest: string, closure: readonly CargoPackage[]): string => {\n const names = pipe(\n closure,\n Arr.map((entry) => entry.name),\n );\n return Arr.join(\n [...Arr.sort(externalIds(closure), Str.Order), manifestFor(names)(manifest)],\n LINE,\n );\n};\n\n/** @internal */\nexport const cargoInputsOf = ({\n workspace,\n directory,\n extras,\n}: CargoInputRequest): DerivedInputs => {\n const { metadata } = workspace;\n const relative = relativeTo(metadata.workspace_root);\n const owner = Option.getOrElse(relative(directory), () => \"\");\n const closure = closureOf(metadata)(ownedRoots(metadata, owner));\n const walked = Arr.sort(\n pipe(\n closure,\n Arr.filter(isLocal),\n Arr.flatMap((entry) => Option.toArray(relative(directoryOf(entry.manifest_path)))),\n ),\n Str.Order,\n );\n const added = pipe(extras, Arr.map(scopedExtra(owner)));\n const kept = pipe(\n added,\n Arr.filter((extra) => !Str.startsWith(NEGATION)(extra)),\n Arr.map(withoutContents),\n );\n const closureFile = `${CLOSURE_DIRECTORY}${SEPARATOR}${slugOf(owner)}${CLOSURE_SUFFIX}`;\n return {\n inputs: [\n ...pipe(\n walked,\n Arr.map((dir) => workspaceInput(`${dir}${CONTENTS}`)),\n ),\n workspaceInput(closureFile),\n ...pipe(WORKSPACE_FILES, Arr.map(workspaceInput)),\n ...excludedFrom(workspace, walked, kept),\n ...pipe(generatedIn(walked), Arr.map(workspaceInput)),\n ...pipe(added, Arr.map(workspaceInput)),\n ],\n closureFile,\n closure: closureText(workspace.manifest, closure),\n };\n};\n","import {\n Array as Arr,\n Console,\n Effect,\n Layer,\n Option,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { collectPlacedIgnoredDirectories } from \"#/shared/lib/ignored-directories.ts\";\nimport {\n RepositoryFiles,\n nodeRepositoryFiles,\n nodeServicesLayer,\n} from \"#/shared/lib/repository-files.ts\";\nimport { startedOnce } from \"#/shared/lib/started-once.ts\";\n\nimport { cargoInputsOf } from \"./cargo-inputs.ts\";\nimport type { CargoInput, DerivedInputs } from \"./cargo-inputs.ts\";\nimport {\n CargoMetadataSchema,\n CargoSourceSchema,\n LOCK_FILE,\n MANIFEST_FILE,\n WORKSPACE_CACHE,\n} from \"./cargo-metadata.ts\";\nimport type { CargoSource, CargoWorkspace } from \"./cargo-metadata.ts\";\nimport { readManifest } from \"./root-manifest.ts\";\n\nconst KEY_SEPARATOR = \"\\u0000\";\nconst SUCCESS = 0;\nconst KEYS = [LOCK_FILE, MANIFEST_FILE] as const;\nconst METADATA_ARGS = [\"metadata\", \"--format-version\", \"1\", \"--offline\", \"--locked\"];\n\nconst CachedSource = Schema.fromJsonString(\n Schema.Struct({\n fingerprint: Schema.String,\n source: CargoSourceSchema,\n }),\n);\nconst decodeMetadata = Schema.decodeUnknownEffect(Schema.fromJsonString(CargoMetadataSchema));\nconst decodeCached = Schema.decodeUnknownOption(CachedSource);\nconst encodeCached = Schema.encodeEffect(CachedSource);\n\nconst taggedError = Schema.TaggedError;\n\nclass MetadataFailed extends taggedError<MetadataFailed, { readonly brand: unique symbol }>()(\n \"MetadataFailed\",\n { output: Schema.String },\n) {}\n\nconst AUTO: readonly CargoInput[] = [{ auto: true }];\nconst nodeLayer = Layer.provideMerge(nodeRepositoryFiles, nodeServicesLayer);\n\nexport interface CargoInputOptions {\n readonly directory: string;\n readonly extras?: readonly string[];\n}\n\nconst fingerprintOf = Effect.fn(\"fingerprintOf\")(function* fingerprintOf(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* Effect.forEach(KEYS, (key) => files.readFile(files.join(root, key)), {\n concurrency: \"unbounded\",\n });\n return yield* files.hash(\n pipe(\n texts,\n Arr.map((text) => Option.getOrElse(text, () => \"\")),\n Arr.join(KEY_SEPARATOR),\n ),\n );\n});\n\nconst cachedSource = Effect.fn(\"cachedSource\")(function* cachedSource(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, WORKSPACE_CACHE));\n const fingerprint = yield* fingerprintOf(root);\n return text.pipe(\n Option.flatMap(decodeCached),\n Option.filter((cached) => cached.fingerprint === fingerprint),\n Option.map((cached) => cached.source),\n );\n});\n\nconst metadataIn = Effect.fn(\"metadataIn\")(function* metadataIn(root: string) {\n const handle = yield* ChildProcess.make(\"cargo\", METADATA_ARGS, {\n cwd: root,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [output, problem] = yield* Effect.all(\n [\n handle.stdout.pipe(Stream.decodeText(), Stream.mkString),\n handle.stderr.pipe(Stream.decodeText(), Stream.mkString),\n ],\n { concurrency: \"unbounded\" },\n );\n const code = yield* handle.exitCode;\n if (code !== SUCCESS) {\n return yield* MetadataFailed.make({ output: Str.trim(problem) });\n }\n return yield* decodeMetadata(output);\n}, Effect.scoped);\n\nconst readSource = Effect.fn(\"readSource\")(function* readSource(root: string) {\n const files = yield* RepositoryFiles;\n const source: CargoSource = {\n metadata: yield* metadataIn(root),\n manifest: yield* readManifest(root),\n };\n const text = yield* encodeCached({ fingerprint: yield* fingerprintOf(root), source });\n yield* files.writeFile(files.join(root, WORKSPACE_CACHE), text);\n return source;\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(root: string) {\n const cached = yield* cachedSource(root);\n const source = yield* Option.match(cached, {\n onNone: () => readSource(root),\n onSome: Effect.succeed,\n });\n const workspace: CargoWorkspace = {\n ...source,\n ignored: yield* collectPlacedIgnoredDirectories(root),\n };\n return workspace;\n});\n\nconst warn = (root: string, reason: string): Effect.Effect<void> =>\n Console.error(\n `msch: the cargo workspace in ${root} could not be read, so its cargo tasks track every file they read: ${reason}`,\n );\n\nconst loaded = (\n root: string,\n): Effect.Effect<Option.Option<CargoWorkspace>, never, Layer.Success<typeof nodeLayer>> =>\n workspaceIn(root).pipe(\n Effect.asSome,\n Effect.catchTag(\"MetadataFailed\", ({ output }) => Effect.fail(output)),\n Effect.tapError((cause) => warn(root, String(cause))),\n Effect.orElseSucceed(() => Option.none<CargoWorkspace>()),\n );\n\nconst loadedOnce = startedOnce<Option.Option<CargoWorkspace>>();\n\nconst loadWorkspace = (root: string): Promise<Option.Option<CargoWorkspace>> =>\n loadedOnce(root, () => Effect.runPromise(loaded(root).pipe(Effect.provide(nodeLayer))));\n\nconst lockDirectory = (\n directory: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* findLockDirectory() {\n const files = yield* RepositoryFiles;\n if (yield* files.exists(files.join(directory, LOCK_FILE))) {\n return Option.some(directory);\n }\n const parent = files.dirname(directory);\n if (parent === directory) {\n return Option.none<string>();\n }\n return yield* lockDirectory(parent);\n });\n\nconst writeClosure = Effect.fn(\"writeClosure\")(function* writeClosure(\n root: string,\n derived: DerivedInputs,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, derived.closureFile);\n const written = yield* files.readFile(file);\n if (!Option.exists(written, (text) => text === derived.closure)) {\n yield* files.writeFile(file, derived.closure);\n }\n return derived.inputs;\n});\n\nconst inputsIn = Effect.fn(\"inputsIn\")(function* inputsIn(\n root: string,\n directory: string,\n extras: readonly string[],\n) {\n const workspace = yield* Effect.promise(() => loadWorkspace(root));\n return yield* Option.match(workspace, {\n onNone: () => Effect.succeed(AUTO),\n onSome: (found) => writeClosure(root, cargoInputsOf({ workspace: found, directory, extras })),\n });\n});\n\nconst deriveCargoInputs = Effect.fn(\"deriveCargoInputs\")(function* deriveCargoInputs({\n directory,\n extras = [],\n}: CargoInputOptions) {\n const files = yield* RepositoryFiles;\n const absolute = files.resolve(directory);\n const root = yield* lockDirectory(absolute);\n return yield* Option.match(root, {\n onNone: () => Effect.succeed(AUTO),\n onSome: (found) => inputsIn(found, absolute, extras),\n });\n});\n\nexport const cargoInputs = (options: CargoInputOptions): Promise<readonly CargoInput[]> =>\n Effect.runPromise(deriveCargoInputs(options).pipe(Effect.provide(nodeLayer)));\n"],"mappings":";;;;;;;AAKA,MAAa,YAAY;AACzB,MAAa,gBAAgB;AAC7B,MAAa,kBAAkB;AAC/B,MAAM,eAAe;AAErB,MAAM,mBAAmB,OAAO,OAAO;CACrC,SAAS,OAAO;CAChB,MAAM,OAAO,QA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AAM,UAAU,OAAO,MAAM,SAAS,IAAI;CAC1C,IAAI,CAAC,OAAO,OAAO,UAAU,SAAS,SAAS,QAAQ,OAAO,GAC5D,OAAO,MAAM,UAAU,MAAM,QAAQ,OAAO;CAE9C,OAAO,QAAQ;AACjB,CAAC;AAED,MAAM,WAAW,OAAO,GAAG,UAAU,CAAC,CAAC,UAAU,SAC/C,MACA,WACA,QACA;CACA,MAAM,YAAY,OAAO,OAAO,cAAc,cAAc,IAAI,CAAC;CACjE,OAAO,OAAO,OAAO,MAAM,WAAW;EACpC,cAAc,OAAO,QAAQ,IAAI;EACjC,SAAS,UAAU,aAAa,MAAM,cAAc;GAAE,WAAW;GAAO;GAAW;EAAO,CAAC,CAAC;CAC9F,CAAC;AACH,CAAC;AAED,MAAM,oBAAoB,OAAO,GAAG,mBAAmB,CAAC,CAAC,UAAU,kBAAkB,EACnF,WACA,SAAS,CAAC,KACU;CAEpB,MAAM,YAAW,OADI,gBAAA,CACE,QAAQ,SAAS;CACxC,MAAM,OAAO,OAAO,cAAc,QAAQ;CAC1C,OAAO,OAAO,OAAO,MAAM,MAAM;EAC/B,cAAc,OAAO,QAAQ,IAAI;EACjC,SAAS,UAAU,SAAS,OAAO,UAAU,MAAM;CACrD,CAAC;AACH,CAAC;AAED,MAAa,eAAe,YAC1B,OAAO,WAAW,kBAAkB,OAAO,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC,CAAC"}
|
package/dist/changed.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as ProblemsFound, t as runCli } from "./runtime-
|
|
3
|
-
import { a as installedPackages, i as recordsIn, r as keepOnly, s as workspaceClosure } from "./project-
|
|
4
|
-
import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-
|
|
5
|
-
import { v as workspaceDirectories } from "./dependencies-
|
|
2
|
+
import { n as ProblemsFound, t as runCli } from "./runtime-DFsdNYI0.mjs";
|
|
3
|
+
import { a as installedPackages, i as recordsIn, r as keepOnly, s as workspaceClosure } from "./project-CR2jzkij.mjs";
|
|
4
|
+
import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
|
|
5
|
+
import { v as workspaceDirectories } from "./dependencies-DbwLA4nT.mjs";
|
|
6
6
|
import { Array, Effect, Option, Order, Record, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
7
7
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
8
8
|
// src/features/run-changed/model/records.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as groupOf, n as RepositoryFiles } from "./repository-files-
|
|
1
|
+
import { a as groupOf, n as RepositoryFiles } from "./repository-files-B5sRbxlz.mjs";
|
|
2
2
|
import { Array, Config, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
3
3
|
import { Parser, parseDocument } from "yaml";
|
|
4
4
|
import semver from "semver";
|
|
@@ -496,4 +496,4 @@ const checkScatteredDeviations = Effect.fn("checkScatteredDeviations")(function*
|
|
|
496
496
|
});
|
|
497
497
|
export { isRecord as a, isScannedText as c, presentFiles as d, scanText as f, collectNodes as i, isToolVersions as l, checkUpstreamExits as n, tomlSourceComments as o, positionOf as p, upstreamExitsMet as r, yamlSourceComments as s, checkScatteredDeviations as t, listedFiles as u };
|
|
498
498
|
|
|
499
|
-
//# sourceMappingURL=check-upstream-exits-
|
|
499
|
+
//# sourceMappingURL=check-upstream-exits-DYxWDyHC.mjs.map
|
package/dist/{check-upstream-exits-22kQ5juG.mjs.map → check-upstream-exits-DYxWDyHC.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-upstream-exits-22kQ5juG.mjs","names":["START","Str","Arr","Arr","Arr","Rec","YamlParser","Str","Arr","Str","Arr","Arr","Rec","Str","RULE","problemAt","Arr","Str","Arr","Rec"],"sources":["../src/shared/lib/text-position.ts","../src/shared/lib/scanned-files.ts","../src/shared/lib/config-comments.ts","../src/features/check-upstream-exits/model/deviation-entries.ts","../src/features/check-upstream-exits/model/exit-condition.ts","../src/features/check-upstream-exits/model/met-exits.ts","../src/features/check-upstream-exits/model/upstream-exits.ts","../src/features/check-upstream-exits/model/scattered-deviations.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nexport const positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst READ_CONCURRENCY = 64;\n\nexport interface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nexport const isScannedText = ({ name }: Listed): boolean =>\n SCANNED_FILE.test(name) && !LOCKFILE.test(name);\n\nexport const isToolVersions = ({ name }: Listed): boolean => TOOL_VERSIONS.test(name);\n\n/** @internal */\nexport const listedFiles = Effect.fn(\"listedFiles\")(function* listedFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n return pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n});\n\n/** @internal */\nexport const presentFiles = Effect.fn(\"presentFiles\")(function* presentFiles(\n listed: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n listed,\n Effect.filter(({ file }) => files.exists(file)),\n );\n});\n\n/** @internal */\nexport const scanText = Effect.fn(\"scanText\")(function* scanText(\n listed: readonly Listed[],\n problemsIn: (entry: Listed, source: string) => readonly Problem[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n listed,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Record as Rec, String as Str, pipe } from \"effect\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { Parser as YamlParser } from \"yaml\";\n\nexport interface SourceComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null;\n\nconst childrenOf = (value: unknown): readonly unknown[] => {\n if (Arr.isArray(value)) {\n return value;\n }\n if (isRecord(value)) {\n return Rec.values(value);\n }\n return [];\n};\n\nexport const collectNodes =\n <Item>(isItem: (value: unknown) => value is Item) =>\n (value: unknown): readonly Item[] => {\n if (isItem(value)) {\n return [value];\n }\n return pipe(childrenOf(value), Arr.flatMap(collectNodes(isItem)));\n };\n\ninterface YamlSourceToken {\n readonly offset: number;\n readonly source: string;\n}\n\nconst isYamlComment = (value: unknown): value is YamlSourceToken =>\n isRecord(value) &&\n value[\"type\"] === \"comment\" &&\n typeof value[\"offset\"] === \"number\" &&\n typeof value[\"source\"] === \"string\";\n\nexport const yamlSourceComments = (source: string): readonly SourceComment[] =>\n pipe(\n Arr.fromIterable(new YamlParser().parse(source)),\n Arr.flatMap(collectNodes(isYamlComment)),\n Arr.map((token) => ({ index: token.offset, text: token.source })),\n );\n\nexport const tomlSourceComments = (source: string): readonly SourceComment[] =>\n pipe(\n parseTOML(source).comments,\n Arr.map(({ range: [start, end] }) => ({\n index: start,\n text: Str.slice(start, end)(source),\n })),\n );\n","import { Array as Arr, HashMap, Option, Schema, pipe } from \"effect\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { parseDocument } from \"yaml\";\n\nimport { tomlSourceComments, yamlSourceComments } from \"#/shared/lib/config-comments.ts\";\nimport type { SourceComment } from \"#/shared/lib/config-comments.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nexport const WORKSPACE_SECTIONS = [\n \"overrides\",\n \"patchedDependencies\",\n \"packageExtensions\",\n] as const;\nconst CARGO_PATCH = \"patch\";\nconst KEY_SEPARATOR = \".\";\nconst PATCH_SOURCE_DEPTH = 2;\n\nexport type Section = (typeof WORKSPACE_SECTIONS)[number] | typeof CARGO_PATCH;\n\nexport interface DeviationEntry {\n readonly section: Section;\n readonly key: string;\n readonly index: number;\n readonly line: number;\n}\n\nexport interface LineComment extends SourceComment {\n readonly line: number;\n}\n\nexport interface Deviations {\n readonly entries: readonly DeviationEntry[];\n readonly comments: readonly LineComment[];\n}\n\nconst NONE: Deviations = { entries: [], comments: [] };\n\nconst KeyValue = Schema.Union([Schema.String, Schema.Finite]);\nconst Positions = Schema.Array(Schema.Finite);\nconst YamlKey = Schema.Struct({ value: KeyValue, range: Positions });\nconst YamlMap = Schema.Struct({ items: Schema.Array(Schema.Struct({ key: YamlKey })) });\n\nconst KeyPart = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"TOMLBare\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"TOMLQuoted\"), value: Schema.String }),\n]);\nconst Located = {\n range: Schema.Array(Schema.Finite),\n loc: Schema.Struct({ start: Schema.Struct({ line: Schema.Finite }) }),\n};\nconst TomlKeyValue = Schema.Struct({\n ...Located,\n type: Schema.Literal(\"TOMLKeyValue\"),\n key: Schema.Struct({ keys: Schema.Array(KeyPart) }),\n});\nconst TomlTable = Schema.Struct({\n ...Located,\n type: Schema.Literal(\"TOMLTable\"),\n resolvedKey: Schema.Array(Schema.Union([Schema.String, Schema.Finite])),\n body: Schema.Array(TomlKeyValue),\n});\nconst TomlNode = Schema.Union([TomlTable, TomlKeyValue]);\nconst TomlTop = Schema.Array(Schema.Struct({ body: Schema.Array(TomlNode) }));\n\ntype TomlTableType = typeof TomlTable.Type;\ntype KeyPartType = typeof KeyPart.Type;\n\nconst decodeYamlMap = Schema.decodeUnknownOption(YamlMap);\nconst decodeTomlTop = Schema.decodeUnknownOption(TomlTop);\nconst FIRST = 0;\n\nconst lineComments = (source: string, comments: readonly SourceComment[]): readonly LineComment[] =>\n pipe(\n comments,\n Arr.map((comment) => ({ ...comment, line: positionOf(source)(comment.index).line })),\n );\n\nconst startOf = (range: readonly number[]): number =>\n Option.getOrElse(Arr.get(range, FIRST), () => FIRST);\n\nconst sectionEntries =\n (source: string, sectionNode: (section: string) => unknown) =>\n (section: (typeof WORKSPACE_SECTIONS)[number]): readonly DeviationEntry[] =>\n pipe(\n decodeYamlMap(sectionNode(section)),\n Option.match({\n onNone: () => [],\n onSome: ({ items }) =>\n pipe(\n items,\n Arr.map(({ key }) => {\n const index = startOf(key.range);\n return {\n section,\n key: String(key.value),\n index,\n line: positionOf(source)(index).line,\n };\n }),\n ),\n }),\n );\n\nexport const workspaceDeviations = (source: string): Deviations => {\n const document = parseDocument(source);\n if (Arr.isReadonlyArrayNonEmpty(document.errors)) {\n return NONE;\n }\n const sectionNode = (section: string): unknown => document.get(section, true);\n return {\n entries: pipe(WORKSPACE_SECTIONS, Arr.flatMap(sectionEntries(source, sectionNode))),\n comments: lineComments(source, yamlSourceComments(source)),\n };\n};\n\nconst partName = (part: KeyPartType): string => {\n if (part.type === \"TOMLBare\") {\n return part.name;\n }\n return part.value;\n};\n\nconst patchEntries = (table: TomlTableType): readonly DeviationEntry[] => {\n const tableKey = pipe(table.resolvedKey, Arr.map(String));\n if (!Option.exists(Arr.get(tableKey, FIRST), (part) => part === CARGO_PATCH)) {\n return [];\n }\n if (tableKey.length > PATCH_SOURCE_DEPTH) {\n return [\n {\n section: CARGO_PATCH,\n key: Arr.join(tableKey, KEY_SEPARATOR),\n index: startOf(table.range),\n line: table.loc.start.line,\n },\n ];\n }\n return pipe(\n table.body,\n Arr.map((value) => ({\n section: CARGO_PATCH,\n key: Arr.join([...tableKey, ...pipe(value.key.keys, Arr.map(partName))], KEY_SEPARATOR),\n index: startOf(value.range),\n line: value.loc.start.line,\n })),\n );\n};\n\nconst isTable = (node: TomlTableType | typeof TomlKeyValue.Type): node is TomlTableType =>\n node.type === \"TOMLTable\";\n\nexport const cargoDeviations = (source: string): Deviations =>\n pipe(\n Option.liftThrowable(() => parseTOML(source).body)(),\n Option.flatMap(decodeTomlTop),\n Option.match({\n onNone: () => NONE,\n onSome: (tops) => ({\n entries: pipe(\n tops,\n Arr.flatMap(({ body }) => body),\n Arr.filter(isTable),\n Arr.flatMap(patchEntries),\n ),\n comments: lineComments(source, tomlSourceComments(source)),\n }),\n }),\n );\n\nexport const commentsByLine = (\n comments: readonly LineComment[],\n): HashMap.HashMap<number, LineComment> =>\n HashMap.fromIterable(\n pipe(\n comments,\n Arr.map((comment) => [comment.line, comment] as const),\n ),\n );\n","import { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { groupOf } from \"#/shared/lib/match-groups.ts\";\n\nexport type Registry = \"npm\" | \"crate\";\nexport type Relation = \"drops\" | \"allows\" | \"requires\";\n\nexport interface Unused {\n readonly kind: \"unused\";\n}\n\nexport interface Published {\n readonly kind: \"published\";\n readonly registry: Registry;\n readonly name: string;\n readonly range: string;\n}\n\nexport interface Declares {\n readonly kind: \"declares\";\n readonly registry: Registry;\n readonly name: string;\n readonly relation: Relation;\n readonly dependency: string;\n readonly range: string;\n}\n\nexport interface Closed {\n readonly kind: \"closed\";\n readonly owner: string;\n readonly repo: string;\n readonly number: number;\n}\n\nexport type ExitCondition = Unused | Published | Declares | Closed;\n\nconst ALTERNATIVE = \" || \";\nconst UNUSED = \"unused\";\nconst ANY_RANGE = \"*\";\nconst EXIT_COMMENT = /^#?\\s*exit:\\s*(?<condition>.*?)\\s*$/u;\nconst PACKAGE = String.raw`(?:@[^\\s/@]+\\/)?[^\\s@]+`;\nconst REGISTRY_CONDITION = new RegExp(\n String.raw`^(?<registry>npm|crate):(?<name>${PACKAGE})(?:@(?<range>.+)| (?<relation>drops|allows|requires) (?<dependency>${PACKAGE})(?:@(?<dependencyRange>.+))?)$`,\n \"u\",\n);\nconst GITHUB_CONDITION = /^github:(?<owner>[\\w.-]+)\\/(?<repo>[\\w.-]+)#(?<number>[1-9]\\d*)$/u;\n\nexport const GRAMMAR =\n \"`unused`, `npm:<package>@<range>`, `npm:<package> drops <dependency>`, `npm:<package> allows <dependency>@<range>`, `npm:<package> requires <dependency>@<range>` (the same forms with `crate:`), or `github:<owner>/<repo>#<number>`, joined with ` || `\";\n\nconst isRegistry = (value: string): value is Registry => value === \"npm\" || value === \"crate\";\n\nconst isRelation = (value: string): value is Relation =>\n value === \"drops\" || value === \"allows\" || value === \"requires\";\n\nconst validRange = (range: string): Option.Option<string> =>\n Option.liftPredicate(range, (candidate) => semver.validRange(candidate) !== null);\n\ninterface Subject {\n readonly registry: Registry;\n readonly name: string;\n}\n\nconst declared = (subject: Subject, found: RegExpExecArray): Option.Option<ExitCondition> => {\n const relation = Option.filter(groupOf(\"relation\")(found), isRelation);\n const dependency = groupOf(\"dependency\")(found);\n const range = groupOf(\"dependencyRange\")(found);\n if (Option.isNone(relation) || Option.isNone(dependency)) {\n return Option.none();\n }\n const base = {\n kind: \"declares\",\n ...subject,\n relation: relation.value,\n dependency: dependency.value,\n } as const;\n if (relation.value === \"drops\") {\n return Option.match(range, {\n onNone: () => Option.some({ ...base, range: ANY_RANGE }),\n onSome: () => Option.none(),\n });\n }\n return pipe(\n range,\n Option.flatMap(validRange),\n Option.map((valid): ExitCondition => ({ ...base, range: valid })),\n );\n};\n\nconst registryCondition = (text: string): Option.Option<ExitCondition> => {\n const found = REGISTRY_CONDITION.exec(text);\n if (found === null) {\n return Option.none();\n }\n const subject = Option.all({\n registry: Option.filter(groupOf(\"registry\")(found), isRegistry),\n name: groupOf(\"name\")(found),\n });\n const range = groupOf(\"range\")(found);\n const conditionOf = (resolved: Subject): Option.Option<ExitCondition> =>\n Option.match(range, {\n onNone: () => declared(resolved, found),\n onSome: (published) =>\n Option.map(validRange(published), (valid): ExitCondition => ({\n kind: \"published\",\n ...resolved,\n range: valid,\n })),\n });\n return pipe(subject, Option.flatMap(conditionOf));\n};\n\nconst githubCondition = (text: string): Option.Option<ExitCondition> => {\n const found = GITHUB_CONDITION.exec(text);\n const issueNumber = pipe(groupOf(\"number\")(found), Option.map(Number));\n return pipe(\n Option.all({\n owner: groupOf(\"owner\")(found),\n repo: groupOf(\"repo\")(found),\n number: issueNumber,\n }),\n Option.map((issue): ExitCondition => ({ kind: \"closed\", ...issue })),\n );\n};\n\nconst alternativeOf = (text: string): Option.Option<ExitCondition> => {\n if (text === UNUSED) {\n return Option.some({ kind: \"unused\" });\n }\n return Option.orElse(registryCondition(text), () => githubCondition(text));\n};\n\nexport const parseCondition = (text: string): Option.Option<readonly ExitCondition[]> =>\n pipe(\n Str.split(text, ALTERNATIVE),\n Arr.map((alternative) => alternativeOf(Str.trim(alternative))),\n Option.all,\n );\n\nexport const exitTextOf = (comment: string): Option.Option<string> =>\n groupOf(\"condition\")(EXIT_COMMENT.exec(Str.trim(comment)));\n\nconst describeDeclares = (condition: Declares): string => {\n const subject = `${condition.registry}:${condition.name} ${condition.relation} ${condition.dependency}`;\n if (condition.relation === \"drops\") {\n return subject;\n }\n return `${subject}@${condition.range}`;\n};\n\nexport const describeCondition = (condition: ExitCondition): string =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => UNUSED,\n published: ({ registry, name, range }) => `${registry}:${name}@${range}`,\n declares: describeDeclares,\n closed: ({ owner, repo, number }) => `github:${owner}/${repo}#${String(number)}`,\n }),\n );\n\nexport const isUnused = (condition: ExitCondition): boolean => condition.kind === \"unused\";\n","import {\n Array as Arr,\n Config,\n Effect,\n HashMap,\n Match,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport type { HttpClientError } from \"effect/http\";\nimport semver from \"semver\";\n\nimport { commentsByLine } from \"./deviation-entries.ts\";\nimport type { DeviationEntry, Deviations, Section } from \"./deviation-entries.ts\";\nimport { describeCondition, exitTextOf, parseCondition } from \"./exit-condition.ts\";\nimport type { Closed, Declares, ExitCondition, Published } from \"./exit-condition.ts\";\n\nconst NPM = \"https://registry.npmjs.org/\";\nconst CRATES = \"https://crates.io/api/v1/crates/\";\nconst GITHUB = \"https://api.github.com/repos/\";\nconst USER_AGENT = \"msch-exits (https://github.com/masseater/masseater.dev/tree/main/libs/msch)\";\nconst LOOKUP_CONCURRENCY = 4;\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\n\nconst DECLARING_SECTIONS = [\"optionalDependencies\", \"peerDependencies\", \"dependencies\"] as const;\nconst Dependencies = Schema.Record(Schema.String, Schema.String);\nconst NpmVersion = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeDependencies = Schema.decodeUnknownOption(Dependencies);\nconst NpmPackument = Schema.Struct({\n \"dist-tags\": Schema.Struct({ latest: Schema.String }),\n versions: Schema.Record(Schema.String, NpmVersion),\n});\nconst Crate = Schema.Struct({\n crate: Schema.Struct({\n max_stable_version: Schema.NullOr(Schema.String),\n newest_version: Schema.String,\n }),\n versions: Schema.Array(Schema.Struct({ num: Schema.String, yanked: Schema.Boolean })),\n});\nconst CrateDependencies = Schema.Struct({\n dependencies: Schema.Array(Schema.Struct({ crate_id: Schema.String, req: Schema.String })),\n});\nconst Issue = Schema.Struct({ state: Schema.String });\n\ntype NpmVersionType = typeof NpmVersion.Type;\ntype LookupError = HttpClientError.HttpClientError | Schema.SchemaError;\n\n/** @internal */\nexport interface Release {\n readonly versions: readonly string[];\n readonly latestDependencies: Readonly<Record<string, string>>;\n}\n\n/** @internal */\nexport interface ExitEntry {\n readonly line: number;\n readonly section: Section;\n readonly key: string;\n readonly conditions: readonly ExitCondition[];\n}\n\n/** @internal */\nexport interface MetExit {\n readonly entry: ExitEntry;\n readonly condition: string;\n readonly outcome: \"met\" | \"unchecked\";\n}\n\ninterface Lookup {\n readonly url: string;\n readonly token: Option.Option<string>;\n}\n\nconst requestOf = ({ url, token }: Lookup): HttpClientRequest.HttpClientRequest => {\n const request = HttpClientRequest.get(url).pipe(\n HttpClientRequest.setHeader(\"user-agent\", USER_AGENT),\n HttpClientRequest.acceptJson,\n );\n return Option.match(token, {\n onNone: () => request,\n onSome: (value) => HttpClientRequest.bearerToken(value)(request),\n });\n};\n\nconst fetched = (\n lookup: Lookup,\n): Effect.Effect<\n HttpClientResponse.HttpClientResponse,\n HttpClientError.HttpClientError,\n HttpClient.HttpClient\n> =>\n HttpClient.HttpClient.pipe(\n Effect.flatMap((client) => HttpClient.filterStatusOk(client).execute(requestOf(lookup))),\n );\n\nconst publicLookup = (url: string): Lookup => ({ url, token: Option.none() });\n\nconst declaredBy = (version: NpmVersionType): Readonly<Record<string, string>> =>\n pipe(\n DECLARING_SECTIONS,\n Arr.flatMap((section) =>\n pipe(\n decodeDependencies(version[section]),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n ),\n ),\n Rec.fromEntries,\n );\n\nconst npmRelease = (name: string): Effect.Effect<Release, LookupError, HttpClient.HttpClient> =>\n fetched(publicLookup(`${NPM}${Str.replace(\"/\", \"%2f\")(name)}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(NpmPackument)),\n Effect.map(({ \"dist-tags\": tags, versions }) => ({\n versions: Rec.keys(versions),\n latestDependencies: pipe(\n Rec.get(versions, tags.latest),\n Option.map(declaredBy),\n Option.getOrElse(() => ({})),\n ),\n })),\n );\n\nconst crateRelease = Effect.fn(\"crateRelease\")(function* lookupCrate(name: string) {\n const found = yield* fetched(publicLookup(`${CRATES}${name}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Crate)),\n );\n const latest = found.crate.max_stable_version ?? found.crate.newest_version;\n const { dependencies } = yield* fetched(\n publicLookup(`${CRATES}${name}/${latest}/dependencies`),\n ).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(CrateDependencies)));\n const release: Release = {\n versions: pipe(\n found.versions,\n Arr.filter(({ yanked }) => !yanked),\n Arr.map(({ num }) => num),\n ),\n latestDependencies: Rec.fromEntries(\n pipe(\n dependencies,\n Arr.map(({ crate_id: crateId, req }) => [crateId, req] as const),\n ),\n ),\n };\n return release;\n});\n\nconst releaseOf = (\n condition: Published | Declares,\n): Effect.Effect<Release, LookupError, HttpClient.HttpClient> => {\n if (condition.registry === \"npm\") {\n return npmRelease(condition.name);\n }\n return crateRelease(condition.name);\n};\n\nconst declaresMet =\n (release: Release) =>\n (condition: Declares): boolean => {\n const declared = Rec.get(release.latestDependencies, condition.dependency);\n if (condition.relation === \"drops\") {\n return Option.isNone(declared);\n }\n return Option.exists(declared, (range) => {\n if (semver.validRange(range) === null) {\n return false;\n }\n if (condition.relation === \"allows\") {\n return semver.intersects(range, condition.range, RANGE_OPTIONS);\n }\n return semver.subset(range, condition.range, RANGE_OPTIONS);\n });\n };\n\n/** @internal */\nexport const isMet =\n (release: Release) =>\n (condition: ExitCondition): boolean =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => false,\n closed: () => false,\n published: ({ range }) =>\n pipe(\n release.versions,\n Arr.some((version) => semver.satisfies(version, range)),\n ),\n declares: declaresMet(release),\n }),\n );\n\nconst issueClosed = Effect.fn(\"issueClosed\")(function* lookupIssue(condition: Closed) {\n const token = yield* Config.option(\n Config.String(\"GH_TOKEN\").pipe(Config.orElse(() => Config.String(\"GITHUB_TOKEN\"))),\n ).pipe(Effect.orElseSucceed(() => Option.none<string>()));\n const issue = yield* fetched({\n url: `${GITHUB}${condition.owner}/${condition.repo}/issues/${String(condition.number)}`,\n token,\n }).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(Issue)));\n return issue.state === \"closed\";\n});\n\nconst conditionMet = (\n condition: ExitCondition,\n): Effect.Effect<boolean, LookupError, HttpClient.HttpClient> =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => Effect.succeed(false),\n closed: issueClosed,\n published: (published) =>\n Effect.map(releaseOf(published), (release) => isMet(release)(published)),\n declares: (declares) =>\n Effect.map(releaseOf(declares), (release) => isMet(release)(declares)),\n }),\n );\n\n/** @internal */\nexport const exitEntries = (deviations: Deviations): readonly ExitEntry[] => {\n const comments = commentsByLine(deviations.comments);\n const entryOf = ({ line, section, key }: DeviationEntry): readonly ExitEntry[] =>\n pipe(\n HashMap.get(comments, line),\n Option.flatMap(({ text }) => exitTextOf(text)),\n Option.flatMap(parseCondition),\n Option.map((conditions): ExitEntry => ({ line, section, key, conditions })),\n Option.toArray,\n );\n return pipe(deviations.entries, Arr.flatMap(entryOf));\n};\n\nconst metOf = (\n entry: ExitEntry,\n condition: ExitCondition,\n): Effect.Effect<Option.Option<MetExit>, never, HttpClient.HttpClient> => {\n const described = describeCondition(condition);\n return conditionMet(condition).pipe(\n Effect.match({\n onSuccess: (met) =>\n Option.liftPredicate({ entry, condition: described, outcome: \"met\" } as const, () => met),\n onFailure: (error) =>\n Option.some({\n entry,\n condition: `${described} (${String(error)})`,\n outcome: \"unchecked\",\n } as const),\n }),\n );\n};\n\n/** @internal */\nexport const metExits = Effect.fn(\"metExits\")(function* metExits(entries: readonly ExitEntry[]) {\n const checksOf = (entry: ExitEntry): readonly ReturnType<typeof metOf>[] =>\n pipe(\n entry.conditions,\n Arr.map((condition) => metOf(entry, condition)),\n );\n const checks = pipe(entries, Arr.flatMap(checksOf));\n const results = yield* Effect.all(checks, { concurrency: LOOKUP_CONCURRENCY });\n return Arr.getSomes(results);\n});\n","import { Array as Arr, Effect, HashMap, HashSet, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { cargoDeviations, commentsByLine, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { DeviationEntry, Deviations } from \"./deviation-entries.ts\";\nimport { GRAMMAR, exitTextOf, isUnused, parseCondition } from \"./exit-condition.ts\";\nimport { exitEntries, metExits } from \"./met-exits.ts\";\nimport type { ExitEntry, MetExit } from \"./met-exits.ts\";\n\nconst RULE: RuleName = \"upstream-exit\";\nconst ROOT_FILES = [\n { name: \"pnpm-workspace.yaml\", deviationsOf: workspaceDeviations },\n { name: \"Cargo.toml\", deviationsOf: cargoDeviations },\n] as const;\nconst REASON =\n \"Every deviation from an upstream package is temporary, and the comment says when to go back to the official package so that msch-exits can tell.\";\nconst STRAY =\n \"An exit condition belongs at the end of the line of an overrides, patchedDependencies, packageExtensions or [patch] entry. Move it there or delete it.\";\n\ninterface ReadFile {\n readonly file: string;\n readonly source: string;\n readonly deviations: Deviations;\n}\n\nconst problemAt =\n ({ file, source }: ReadFile) =>\n (index: number, message: string): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message,\n });\n\nconst messageFor = (\n entry: DeviationEntry,\n exitText: Option.Option<string>,\n): Option.Option<string> => {\n if (Option.isNone(exitText)) {\n return Option.some(\n `${entry.section} entry ${entry.key} has no exit condition. ${REASON} Add \\`# exit: <condition>\\` at the end of the line, where the condition is ${GRAMMAR}.`,\n );\n }\n const conditions = parseCondition(exitText.value);\n if (Option.isNone(conditions)) {\n return Option.some(\n `The exit condition \\`${exitText.value}\\` of ${entry.key} is not one msch-exits can check. Write ${GRAMMAR}.`,\n );\n }\n if (entry.section !== \"overrides\" && pipe(conditions.value, Arr.some(isUnused))) {\n return Option.some(\n `\\`unused\\` is checked only for overrides, by the unused-override and removable-override checks. Give ${entry.key} a condition on a release or an issue.`,\n );\n }\n return Option.none();\n};\n\nconst entryProblems = (read: ReadFile): readonly Problem[] => {\n const comments = commentsByLine(read.deviations.comments);\n return pipe(\n read.deviations.entries,\n Arr.flatMap((entry) => {\n const exitText = pipe(\n HashMap.get(comments, entry.line),\n Option.flatMap(({ text }) => exitTextOf(text)),\n );\n return pipe(\n messageFor(entry, exitText),\n Option.map((message) => problemAt(read)(entry.index, message)),\n Option.toArray,\n );\n }),\n );\n};\n\nconst strayProblems = (read: ReadFile): readonly Problem[] => {\n const entryLines = HashSet.fromIterable(\n pipe(\n read.deviations.entries,\n Arr.map(({ line }) => line),\n ),\n );\n return pipe(\n read.deviations.comments,\n Arr.filter(\n (comment) =>\n Option.isSome(exitTextOf(comment.text)) && !HashSet.has(entryLines, comment.line),\n ),\n Arr.map((comment) => problemAt(read)(comment.index, STRAY)),\n );\n};\n\nconst readRootFiles = Effect.fn(\"readRootFiles\")(function* readRootFiles(root: string) {\n const files = yield* RepositoryFiles;\n const read = yield* Effect.forEach(\n ROOT_FILES,\n ({ name, deviationsOf }) => {\n const file = files.join(root, name);\n return Effect.map(\n files.readFile(file),\n Option.map((source): ReadFile => ({ file, source, deviations: deviationsOf(source) })),\n );\n },\n { concurrency: \"unbounded\" },\n );\n return Arr.getSomes(read);\n});\n\n/** @internal */\nexport const checkUpstreamExits = Effect.fn(\"checkUpstreamExits\")(function* checkUpstreamExits(\n root: string,\n) {\n const read = yield* readRootFiles(root);\n return pipe(\n read,\n Arr.flatMap((file) => [...entryProblems(file), ...strayProblems(file)]),\n );\n});\n\n/** @internal */\nexport interface FileExit {\n readonly file: string;\n readonly met: MetExit;\n}\n\n/** @internal */\nexport const upstreamExitsMet = Effect.fn(\"upstreamExitsMet\")(function* upstreamExitsMet(\n root: string,\n) {\n const read = yield* readRootFiles(root);\n const perFile = yield* Effect.forEach(\n read,\n ({ file, deviations }) => {\n const entries: readonly ExitEntry[] = exitEntries(deviations);\n return Effect.map(\n metExits(entries),\n Arr.map((met): FileExit => ({ file, met })),\n );\n },\n { concurrency: 1 },\n );\n return Arr.flatten(perFile);\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { WORKSPACE_SECTIONS, cargoDeviations, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { Deviations } from \"./deviation-entries.ts\";\n\nconst RULE: RuleName = \"upstream-deviation-place\";\nconst MANIFEST = \"package.json\";\nconst NESTED_WORKSPACE = \"/pnpm-workspace.yaml\";\nconst NESTED_CARGO = \"/Cargo.toml\";\nconst CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config(?:\\.toml)?$/u;\nconst MANAGER_FIELDS = [\"overrides\", \"resolutions\"] as const;\nconst START = 0;\nconst PLACE =\n \"Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.\";\n\nconst Fields = Schema.Record(Schema.String, Schema.Unknown);\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({\n pnpm: Schema.optional(Fields),\n overrides: Schema.optional(Schema.Unknown),\n resolutions: Schema.optional(Schema.Unknown),\n }),\n);\nconst decodeManifest = Schema.decodeUnknownOption(Manifest);\n\ninterface Field {\n readonly name: string;\n readonly key: string;\n}\n\nconst isManifest = (name: string): boolean =>\n name === MANIFEST || Str.endsWith(`/${MANIFEST}`)(name);\n\nconst problemAt =\n (entry: Listed, source: string) =>\n (index: number, message: string): Problem => ({\n file: entry.file,\n ...positionOf(source)(index),\n rule: RULE,\n message,\n });\n\nconst keyIndex = (source: string, key: string): number =>\n Option.getOrElse(Str.indexOf(`\"${key}\"`)(source), () => START);\n\nconst fieldsIn = (source: string): readonly Field[] =>\n pipe(\n decodeManifest(source),\n Option.match({\n onNone: (): readonly Field[] => [],\n onSome: (manifest) => {\n const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));\n const pnpmFields = pipe(\n WORKSPACE_SECTIONS,\n Arr.filter((key) => Rec.has(pnpm, key)),\n Arr.map((key) => ({ name: `pnpm.${key}`, key })),\n );\n const managerFields = pipe(\n MANAGER_FIELDS,\n Arr.filter((key) => Option.isSome(Option.fromUndefinedOr(manifest[key]))),\n Arr.map((key) => ({ name: key, key })),\n );\n return [...pnpmFields, ...managerFields];\n },\n }),\n );\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n fieldsIn(source),\n Arr.map(({ name, key }) =>\n problemAt(entry, source)(\n keyIndex(source, key),\n `${name} in package.json is not allowed. ${PLACE} Move it there.`,\n ),\n ),\n );\n\nconst firstEntryProblem = (\n entry: Listed,\n source: string,\n deviations: Deviations,\n): readonly Problem[] =>\n pipe(\n Arr.head(deviations.entries),\n Option.map(({ index }) =>\n problemAt(entry, source)(index, `This file is not read for upstream deviations. ${PLACE}`),\n ),\n Option.toArray,\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] => {\n if (isManifest(entry.name)) {\n return manifestProblems(entry, source);\n }\n if (Str.endsWith(NESTED_WORKSPACE)(entry.name)) {\n return firstEntryProblem(entry, source, workspaceDeviations(source));\n }\n return firstEntryProblem(entry, source, cargoDeviations(source));\n};\n\nconst isScanned = ({ name }: Listed): boolean =>\n isManifest(name) ||\n Str.endsWith(NESTED_WORKSPACE)(name) ||\n Str.endsWith(NESTED_CARGO)(name) ||\n CARGO_CONFIG.test(name);\n\n/** @internal */\nexport const checkScatteredDeviations = Effect.fn(\"checkScatteredDeviations\")(\n function* checkScatteredDeviations(root: string) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed,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YamlParser","Str","Arr","Str","Arr","Arr","Rec","Str","RULE","problemAt","Arr","Str","Arr","Rec"],"sources":["../src/shared/lib/text-position.ts","../src/shared/lib/scanned-files.ts","../src/shared/lib/config-comments.ts","../src/features/check-upstream-exits/model/deviation-entries.ts","../src/features/check-upstream-exits/model/exit-condition.ts","../src/features/check-upstream-exits/model/met-exits.ts","../src/features/check-upstream-exits/model/upstream-exits.ts","../src/features/check-upstream-exits/model/scattered-deviations.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nexport const positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst SCANNED_FILE =\n /(?:\\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\\.tool-versions|[^./][^./]*))$/u;\n\nconst LOCKFILE = /(?:^|\\/)(?:[^/]*\\.lock|[^/]*-lock\\.(?:json|ya?ml))$/u;\n\nconst TOOL_VERSIONS = /(?:^|\\/)(?:\\.?mise(?:\\.[^/]+)?\\.toml|\\.tool-versions)$/u;\n\nconst READ_CONCURRENCY = 64;\n\nexport interface Listed {\n readonly name: string;\n readonly file: string;\n}\n\nexport const isScannedText = ({ name }: Listed): boolean =>\n SCANNED_FILE.test(name) && !LOCKFILE.test(name);\n\nexport const isToolVersions = ({ name }: Listed): boolean => TOOL_VERSIONS.test(name);\n\n/** @internal */\nexport const listedFiles = Effect.fn(\"listedFiles\")(function* listedFiles(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.ownedFiles(root);\n return pipe(\n names,\n Arr.map((name): Listed => ({ name, file: files.join(root, name) })),\n );\n});\n\n/** @internal */\nexport const presentFiles = Effect.fn(\"presentFiles\")(function* presentFiles(\n listed: readonly Listed[],\n) {\n const files = yield* RepositoryFiles;\n return yield* pipe(\n listed,\n Effect.filter(({ file }) => files.exists(file)),\n );\n});\n\n/** @internal */\nexport const scanText = Effect.fn(\"scanText\")(function* scanText(\n listed: readonly Listed[],\n problemsIn: (entry: Listed, source: string) => readonly Problem[],\n) {\n const files = yield* RepositoryFiles;\n const found = yield* Effect.forEach(\n listed,\n (entry) =>\n files.readFile(entry.file).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly Problem[] => [],\n onSome: (source) => problemsIn(entry, source),\n }),\n ),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.flatten(found);\n});\n","import { Array as Arr, Record as Rec, String as Str, pipe } from \"effect\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { Parser as YamlParser } from \"yaml\";\n\nexport interface SourceComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null;\n\nconst childrenOf = (value: unknown): readonly unknown[] => {\n if (Arr.isArray(value)) {\n return value;\n }\n if (isRecord(value)) {\n return Rec.values(value);\n }\n return [];\n};\n\nexport const collectNodes =\n <Item>(isItem: (value: unknown) => value is Item) =>\n (value: unknown): readonly Item[] => {\n if (isItem(value)) {\n return [value];\n }\n return pipe(childrenOf(value), Arr.flatMap(collectNodes(isItem)));\n };\n\ninterface YamlSourceToken {\n readonly offset: number;\n readonly source: string;\n}\n\nconst isYamlComment = (value: unknown): value is YamlSourceToken =>\n isRecord(value) &&\n value[\"type\"] === \"comment\" &&\n typeof value[\"offset\"] === \"number\" &&\n typeof value[\"source\"] === \"string\";\n\nexport const yamlSourceComments = (source: string): readonly SourceComment[] =>\n pipe(\n Arr.fromIterable(new YamlParser().parse(source)),\n Arr.flatMap(collectNodes(isYamlComment)),\n Arr.map((token) => ({ index: token.offset, text: token.source })),\n );\n\nexport const tomlSourceComments = (source: string): readonly SourceComment[] =>\n pipe(\n parseTOML(source).comments,\n Arr.map(({ range: [start, end] }) => ({\n index: start,\n text: Str.slice(start, end)(source),\n })),\n );\n","import { Array as Arr, HashMap, Option, Schema, pipe } from \"effect\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { parseDocument } from \"yaml\";\n\nimport { tomlSourceComments, yamlSourceComments } from \"#/shared/lib/config-comments.ts\";\nimport type { SourceComment } from \"#/shared/lib/config-comments.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nexport const WORKSPACE_SECTIONS = [\n \"overrides\",\n \"patchedDependencies\",\n \"packageExtensions\",\n] as const;\nconst CARGO_PATCH = \"patch\";\nconst KEY_SEPARATOR = \".\";\nconst PATCH_SOURCE_DEPTH = 2;\n\nexport type Section = (typeof WORKSPACE_SECTIONS)[number] | typeof CARGO_PATCH;\n\nexport interface DeviationEntry {\n readonly section: Section;\n readonly key: string;\n readonly index: number;\n readonly line: number;\n}\n\nexport interface LineComment extends SourceComment {\n readonly line: number;\n}\n\nexport interface Deviations {\n readonly entries: readonly DeviationEntry[];\n readonly comments: readonly LineComment[];\n}\n\nconst NONE: Deviations = { entries: [], comments: [] };\n\nconst KeyValue = Schema.Union([Schema.String, Schema.Finite]);\nconst Positions = Schema.Array(Schema.Finite);\nconst YamlKey = Schema.Struct({ value: KeyValue, range: Positions });\nconst YamlMap = Schema.Struct({ items: Schema.Array(Schema.Struct({ key: YamlKey })) });\n\nconst KeyPart = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"TOMLBare\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"TOMLQuoted\"), value: Schema.String }),\n]);\nconst Located = {\n range: Schema.Array(Schema.Finite),\n loc: Schema.Struct({ start: Schema.Struct({ line: Schema.Finite }) }),\n};\nconst TomlKeyValue = Schema.Struct({\n ...Located,\n type: Schema.Literal(\"TOMLKeyValue\"),\n key: Schema.Struct({ keys: Schema.Array(KeyPart) }),\n});\nconst TomlTable = Schema.Struct({\n ...Located,\n type: Schema.Literal(\"TOMLTable\"),\n resolvedKey: Schema.Array(Schema.Union([Schema.String, Schema.Finite])),\n body: Schema.Array(TomlKeyValue),\n});\nconst TomlNode = Schema.Union([TomlTable, TomlKeyValue]);\nconst TomlTop = Schema.Array(Schema.Struct({ body: Schema.Array(TomlNode) }));\n\ntype TomlTableType = typeof TomlTable.Type;\ntype KeyPartType = typeof KeyPart.Type;\n\nconst decodeYamlMap = Schema.decodeUnknownOption(YamlMap);\nconst decodeTomlTop = Schema.decodeUnknownOption(TomlTop);\nconst FIRST = 0;\n\nconst lineComments = (source: string, comments: readonly SourceComment[]): readonly LineComment[] =>\n pipe(\n comments,\n Arr.map((comment) => ({ ...comment, line: positionOf(source)(comment.index).line })),\n );\n\nconst startOf = (range: readonly number[]): number =>\n Option.getOrElse(Arr.get(range, FIRST), () => FIRST);\n\nconst sectionEntries =\n (source: string, sectionNode: (section: string) => unknown) =>\n (section: (typeof WORKSPACE_SECTIONS)[number]): readonly DeviationEntry[] =>\n pipe(\n decodeYamlMap(sectionNode(section)),\n Option.match({\n onNone: () => [],\n onSome: ({ items }) =>\n pipe(\n items,\n Arr.map(({ key }) => {\n const index = startOf(key.range);\n return {\n section,\n key: String(key.value),\n index,\n line: positionOf(source)(index).line,\n };\n }),\n ),\n }),\n );\n\nexport const workspaceDeviations = (source: string): Deviations => {\n const document = parseDocument(source);\n if (Arr.isReadonlyArrayNonEmpty(document.errors)) {\n return NONE;\n }\n const sectionNode = (section: string): unknown => document.get(section, true);\n return {\n entries: pipe(WORKSPACE_SECTIONS, Arr.flatMap(sectionEntries(source, sectionNode))),\n comments: lineComments(source, yamlSourceComments(source)),\n };\n};\n\nconst partName = (part: KeyPartType): string => {\n if (part.type === \"TOMLBare\") {\n return part.name;\n }\n return part.value;\n};\n\nconst patchEntries = (table: TomlTableType): readonly DeviationEntry[] => {\n const tableKey = pipe(table.resolvedKey, Arr.map(String));\n if (!Option.exists(Arr.get(tableKey, FIRST), (part) => part === CARGO_PATCH)) {\n return [];\n }\n if (tableKey.length > PATCH_SOURCE_DEPTH) {\n return [\n {\n section: CARGO_PATCH,\n key: Arr.join(tableKey, KEY_SEPARATOR),\n index: startOf(table.range),\n line: table.loc.start.line,\n },\n ];\n }\n return pipe(\n table.body,\n Arr.map((value) => ({\n section: CARGO_PATCH,\n key: Arr.join([...tableKey, ...pipe(value.key.keys, Arr.map(partName))], KEY_SEPARATOR),\n index: startOf(value.range),\n line: value.loc.start.line,\n })),\n );\n};\n\nconst isTable = (node: TomlTableType | typeof TomlKeyValue.Type): node is TomlTableType =>\n node.type === \"TOMLTable\";\n\nexport const cargoDeviations = (source: string): Deviations =>\n pipe(\n Option.liftThrowable(() => parseTOML(source).body)(),\n Option.flatMap(decodeTomlTop),\n Option.match({\n onNone: () => NONE,\n onSome: (tops) => ({\n entries: pipe(\n tops,\n Arr.flatMap(({ body }) => body),\n Arr.filter(isTable),\n Arr.flatMap(patchEntries),\n ),\n comments: lineComments(source, tomlSourceComments(source)),\n }),\n }),\n );\n\nexport const commentsByLine = (\n comments: readonly LineComment[],\n): HashMap.HashMap<number, LineComment> =>\n HashMap.fromIterable(\n pipe(\n comments,\n Arr.map((comment) => [comment.line, comment] as const),\n ),\n );\n","import { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { groupOf } from \"#/shared/lib/match-groups.ts\";\n\nexport type Registry = \"npm\" | \"crate\";\nexport type Relation = \"drops\" | \"allows\" | \"requires\";\n\nexport interface Unused {\n readonly kind: \"unused\";\n}\n\nexport interface Published {\n readonly kind: \"published\";\n readonly registry: Registry;\n readonly name: string;\n readonly range: string;\n}\n\nexport interface Declares {\n readonly kind: \"declares\";\n readonly registry: Registry;\n readonly name: string;\n readonly relation: Relation;\n readonly dependency: string;\n readonly range: string;\n}\n\nexport interface Closed {\n readonly kind: \"closed\";\n readonly owner: string;\n readonly repo: string;\n readonly number: number;\n}\n\nexport type ExitCondition = Unused | Published | Declares | Closed;\n\nconst ALTERNATIVE = \" || \";\nconst UNUSED = \"unused\";\nconst ANY_RANGE = \"*\";\nconst EXIT_COMMENT = /^#?\\s*exit:\\s*(?<condition>.*?)\\s*$/u;\nconst PACKAGE = String.raw`(?:@[^\\s/@]+\\/)?[^\\s@]+`;\nconst REGISTRY_CONDITION = new RegExp(\n String.raw`^(?<registry>npm|crate):(?<name>${PACKAGE})(?:@(?<range>.+)| (?<relation>drops|allows|requires) (?<dependency>${PACKAGE})(?:@(?<dependencyRange>.+))?)$`,\n \"u\",\n);\nconst GITHUB_CONDITION = /^github:(?<owner>[\\w.-]+)\\/(?<repo>[\\w.-]+)#(?<number>[1-9]\\d*)$/u;\n\nexport const GRAMMAR =\n \"`unused`, `npm:<package>@<range>`, `npm:<package> drops <dependency>`, `npm:<package> allows <dependency>@<range>`, `npm:<package> requires <dependency>@<range>` (the same forms with `crate:`), or `github:<owner>/<repo>#<number>`, joined with ` || `\";\n\nconst isRegistry = (value: string): value is Registry => value === \"npm\" || value === \"crate\";\n\nconst isRelation = (value: string): value is Relation =>\n value === \"drops\" || value === \"allows\" || value === \"requires\";\n\nconst validRange = (range: string): Option.Option<string> =>\n Option.liftPredicate(range, (candidate) => semver.validRange(candidate) !== null);\n\ninterface Subject {\n readonly registry: Registry;\n readonly name: string;\n}\n\nconst declared = (subject: Subject, found: RegExpExecArray): Option.Option<ExitCondition> => {\n const relation = Option.filter(groupOf(\"relation\")(found), isRelation);\n const dependency = groupOf(\"dependency\")(found);\n const range = groupOf(\"dependencyRange\")(found);\n if (Option.isNone(relation) || Option.isNone(dependency)) {\n return Option.none();\n }\n const base = {\n kind: \"declares\",\n ...subject,\n relation: relation.value,\n dependency: dependency.value,\n } as const;\n if (relation.value === \"drops\") {\n return Option.match(range, {\n onNone: () => Option.some({ ...base, range: ANY_RANGE }),\n onSome: () => Option.none(),\n });\n }\n return pipe(\n range,\n Option.flatMap(validRange),\n Option.map((valid): ExitCondition => ({ ...base, range: valid })),\n );\n};\n\nconst registryCondition = (text: string): Option.Option<ExitCondition> => {\n const found = REGISTRY_CONDITION.exec(text);\n if (found === null) {\n return Option.none();\n }\n const subject = Option.all({\n registry: Option.filter(groupOf(\"registry\")(found), isRegistry),\n name: groupOf(\"name\")(found),\n });\n const range = groupOf(\"range\")(found);\n const conditionOf = (resolved: Subject): Option.Option<ExitCondition> =>\n Option.match(range, {\n onNone: () => declared(resolved, found),\n onSome: (published) =>\n Option.map(validRange(published), (valid): ExitCondition => ({\n kind: \"published\",\n ...resolved,\n range: valid,\n })),\n });\n return pipe(subject, Option.flatMap(conditionOf));\n};\n\nconst githubCondition = (text: string): Option.Option<ExitCondition> => {\n const found = GITHUB_CONDITION.exec(text);\n const issueNumber = pipe(groupOf(\"number\")(found), Option.map(Number));\n return pipe(\n Option.all({\n owner: groupOf(\"owner\")(found),\n repo: groupOf(\"repo\")(found),\n number: issueNumber,\n }),\n Option.map((issue): ExitCondition => ({ kind: \"closed\", ...issue })),\n );\n};\n\nconst alternativeOf = (text: string): Option.Option<ExitCondition> => {\n if (text === UNUSED) {\n return Option.some({ kind: \"unused\" });\n }\n return Option.orElse(registryCondition(text), () => githubCondition(text));\n};\n\nexport const parseCondition = (text: string): Option.Option<readonly ExitCondition[]> =>\n pipe(\n Str.split(text, ALTERNATIVE),\n Arr.map((alternative) => alternativeOf(Str.trim(alternative))),\n Option.all,\n );\n\nexport const exitTextOf = (comment: string): Option.Option<string> =>\n groupOf(\"condition\")(EXIT_COMMENT.exec(Str.trim(comment)));\n\nconst describeDeclares = (condition: Declares): string => {\n const subject = `${condition.registry}:${condition.name} ${condition.relation} ${condition.dependency}`;\n if (condition.relation === \"drops\") {\n return subject;\n }\n return `${subject}@${condition.range}`;\n};\n\nexport const describeCondition = (condition: ExitCondition): string =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => UNUSED,\n published: ({ registry, name, range }) => `${registry}:${name}@${range}`,\n declares: describeDeclares,\n closed: ({ owner, repo, number }) => `github:${owner}/${repo}#${String(number)}`,\n }),\n );\n\nexport const isUnused = (condition: ExitCondition): boolean => condition.kind === \"unused\";\n","import {\n Array as Arr,\n Config,\n Effect,\n HashMap,\n Match,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport type { HttpClientError } from \"effect/http\";\nimport semver from \"semver\";\n\nimport { commentsByLine } from \"./deviation-entries.ts\";\nimport type { DeviationEntry, Deviations, Section } from \"./deviation-entries.ts\";\nimport { describeCondition, exitTextOf, parseCondition } from \"./exit-condition.ts\";\nimport type { Closed, Declares, ExitCondition, Published } from \"./exit-condition.ts\";\n\nconst NPM = \"https://registry.npmjs.org/\";\nconst CRATES = \"https://crates.io/api/v1/crates/\";\nconst GITHUB = \"https://api.github.com/repos/\";\nconst USER_AGENT = \"msch-exits (https://github.com/masseater/masseater.dev/tree/main/libs/msch)\";\nconst LOOKUP_CONCURRENCY = 4;\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\n\nconst DECLARING_SECTIONS = [\"optionalDependencies\", \"peerDependencies\", \"dependencies\"] as const;\nconst Dependencies = Schema.Record(Schema.String, Schema.String);\nconst NpmVersion = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeDependencies = Schema.decodeUnknownOption(Dependencies);\nconst NpmPackument = Schema.Struct({\n \"dist-tags\": Schema.Struct({ latest: Schema.String }),\n versions: Schema.Record(Schema.String, NpmVersion),\n});\nconst Crate = Schema.Struct({\n crate: Schema.Struct({\n max_stable_version: Schema.NullOr(Schema.String),\n newest_version: Schema.String,\n }),\n versions: Schema.Array(Schema.Struct({ num: Schema.String, yanked: Schema.Boolean })),\n});\nconst CrateDependencies = Schema.Struct({\n dependencies: Schema.Array(Schema.Struct({ crate_id: Schema.String, req: Schema.String })),\n});\nconst Issue = Schema.Struct({ state: Schema.String });\n\ntype NpmVersionType = typeof NpmVersion.Type;\ntype LookupError = HttpClientError.HttpClientError | Schema.SchemaError;\n\n/** @internal */\nexport interface Release {\n readonly versions: readonly string[];\n readonly latestDependencies: Readonly<Record<string, string>>;\n}\n\n/** @internal */\nexport interface ExitEntry {\n readonly line: number;\n readonly section: Section;\n readonly key: string;\n readonly conditions: readonly ExitCondition[];\n}\n\n/** @internal */\nexport interface MetExit {\n readonly entry: ExitEntry;\n readonly condition: string;\n readonly outcome: \"met\" | \"unchecked\";\n}\n\ninterface Lookup {\n readonly url: string;\n readonly token: Option.Option<string>;\n}\n\nconst requestOf = ({ url, token }: Lookup): HttpClientRequest.HttpClientRequest => {\n const request = HttpClientRequest.get(url).pipe(\n HttpClientRequest.setHeader(\"user-agent\", USER_AGENT),\n HttpClientRequest.acceptJson,\n );\n return Option.match(token, {\n onNone: () => request,\n onSome: (value) => HttpClientRequest.bearerToken(value)(request),\n });\n};\n\nconst fetched = (\n lookup: Lookup,\n): Effect.Effect<\n HttpClientResponse.HttpClientResponse,\n HttpClientError.HttpClientError,\n HttpClient.HttpClient\n> =>\n HttpClient.HttpClient.pipe(\n Effect.flatMap((client) => HttpClient.filterStatusOk(client).execute(requestOf(lookup))),\n );\n\nconst publicLookup = (url: string): Lookup => ({ url, token: Option.none() });\n\nconst declaredBy = (version: NpmVersionType): Readonly<Record<string, string>> =>\n pipe(\n DECLARING_SECTIONS,\n Arr.flatMap((section) =>\n pipe(\n decodeDependencies(version[section]),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n ),\n ),\n Rec.fromEntries,\n );\n\nconst npmRelease = (name: string): Effect.Effect<Release, LookupError, HttpClient.HttpClient> =>\n fetched(publicLookup(`${NPM}${Str.replace(\"/\", \"%2f\")(name)}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(NpmPackument)),\n Effect.map(({ \"dist-tags\": tags, versions }) => ({\n versions: Rec.keys(versions),\n latestDependencies: pipe(\n Rec.get(versions, tags.latest),\n Option.map(declaredBy),\n Option.getOrElse(() => ({})),\n ),\n })),\n );\n\nconst crateRelease = Effect.fn(\"crateRelease\")(function* lookupCrate(name: string) {\n const found = yield* fetched(publicLookup(`${CRATES}${name}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Crate)),\n );\n const latest = found.crate.max_stable_version ?? found.crate.newest_version;\n const { dependencies } = yield* fetched(\n publicLookup(`${CRATES}${name}/${latest}/dependencies`),\n ).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(CrateDependencies)));\n const release: Release = {\n versions: pipe(\n found.versions,\n Arr.filter(({ yanked }) => !yanked),\n Arr.map(({ num }) => num),\n ),\n latestDependencies: Rec.fromEntries(\n pipe(\n dependencies,\n Arr.map(({ crate_id: crateId, req }) => [crateId, req] as const),\n ),\n ),\n };\n return release;\n});\n\nconst releaseOf = (\n condition: Published | Declares,\n): Effect.Effect<Release, LookupError, HttpClient.HttpClient> => {\n if (condition.registry === \"npm\") {\n return npmRelease(condition.name);\n }\n return crateRelease(condition.name);\n};\n\nconst declaresMet =\n (release: Release) =>\n (condition: Declares): boolean => {\n const declared = Rec.get(release.latestDependencies, condition.dependency);\n if (condition.relation === \"drops\") {\n return Option.isNone(declared);\n }\n return Option.exists(declared, (range) => {\n if (semver.validRange(range) === null) {\n return false;\n }\n if (condition.relation === \"allows\") {\n return semver.intersects(range, condition.range, RANGE_OPTIONS);\n }\n return semver.subset(range, condition.range, RANGE_OPTIONS);\n });\n };\n\n/** @internal */\nexport const isMet =\n (release: Release) =>\n (condition: ExitCondition): boolean =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => false,\n closed: () => false,\n published: ({ range }) =>\n pipe(\n release.versions,\n Arr.some((version) => semver.satisfies(version, range)),\n ),\n declares: declaresMet(release),\n }),\n );\n\nconst issueClosed = Effect.fn(\"issueClosed\")(function* lookupIssue(condition: Closed) {\n const token = yield* Config.option(\n Config.String(\"GH_TOKEN\").pipe(Config.orElse(() => Config.String(\"GITHUB_TOKEN\"))),\n ).pipe(Effect.orElseSucceed(() => Option.none<string>()));\n const issue = yield* fetched({\n url: `${GITHUB}${condition.owner}/${condition.repo}/issues/${String(condition.number)}`,\n token,\n }).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(Issue)));\n return issue.state === \"closed\";\n});\n\nconst conditionMet = (\n condition: ExitCondition,\n): Effect.Effect<boolean, LookupError, HttpClient.HttpClient> =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => Effect.succeed(false),\n closed: issueClosed,\n published: (published) =>\n Effect.map(releaseOf(published), (release) => isMet(release)(published)),\n declares: (declares) =>\n Effect.map(releaseOf(declares), (release) => isMet(release)(declares)),\n }),\n );\n\n/** @internal */\nexport const exitEntries = (deviations: Deviations): readonly ExitEntry[] => {\n const comments = commentsByLine(deviations.comments);\n const entryOf = ({ line, section, key }: DeviationEntry): readonly ExitEntry[] =>\n pipe(\n HashMap.get(comments, line),\n Option.flatMap(({ text }) => exitTextOf(text)),\n Option.flatMap(parseCondition),\n Option.map((conditions): ExitEntry => ({ line, section, key, conditions })),\n Option.toArray,\n );\n return pipe(deviations.entries, Arr.flatMap(entryOf));\n};\n\nconst metOf = (\n entry: ExitEntry,\n condition: ExitCondition,\n): Effect.Effect<Option.Option<MetExit>, never, HttpClient.HttpClient> => {\n const described = describeCondition(condition);\n return conditionMet(condition).pipe(\n Effect.match({\n onSuccess: (met) =>\n Option.liftPredicate({ entry, condition: described, outcome: \"met\" } as const, () => met),\n onFailure: (error) =>\n Option.some({\n entry,\n condition: `${described} (${String(error)})`,\n outcome: \"unchecked\",\n } as const),\n }),\n );\n};\n\n/** @internal */\nexport const metExits = Effect.fn(\"metExits\")(function* metExits(entries: readonly ExitEntry[]) {\n const checksOf = (entry: ExitEntry): readonly ReturnType<typeof metOf>[] =>\n pipe(\n entry.conditions,\n Arr.map((condition) => metOf(entry, condition)),\n );\n const checks = pipe(entries, Arr.flatMap(checksOf));\n const results = yield* Effect.all(checks, { concurrency: LOOKUP_CONCURRENCY });\n return Arr.getSomes(results);\n});\n","import { Array as Arr, Effect, HashMap, HashSet, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { cargoDeviations, commentsByLine, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { DeviationEntry, Deviations } from \"./deviation-entries.ts\";\nimport { GRAMMAR, exitTextOf, isUnused, parseCondition } from \"./exit-condition.ts\";\nimport { exitEntries, metExits } from \"./met-exits.ts\";\nimport type { ExitEntry, MetExit } from \"./met-exits.ts\";\n\nconst RULE: RuleName = \"upstream-exit\";\nconst ROOT_FILES = [\n { name: \"pnpm-workspace.yaml\", deviationsOf: workspaceDeviations },\n { name: \"Cargo.toml\", deviationsOf: cargoDeviations },\n] as const;\nconst REASON =\n \"Every deviation from an upstream package is temporary, and the comment says when to go back to the official package so that msch-exits can tell.\";\nconst STRAY =\n \"An exit condition belongs at the end of the line of an overrides, patchedDependencies, packageExtensions or [patch] entry. Move it there or delete it.\";\n\ninterface ReadFile {\n readonly file: string;\n readonly source: string;\n readonly deviations: Deviations;\n}\n\nconst problemAt =\n ({ file, source }: ReadFile) =>\n (index: number, message: string): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message,\n });\n\nconst messageFor = (\n entry: DeviationEntry,\n exitText: Option.Option<string>,\n): Option.Option<string> => {\n if (Option.isNone(exitText)) {\n return Option.some(\n `${entry.section} entry ${entry.key} has no exit condition. ${REASON} Add \\`# exit: <condition>\\` at the end of the line, where the condition is ${GRAMMAR}.`,\n );\n }\n const conditions = parseCondition(exitText.value);\n if (Option.isNone(conditions)) {\n return Option.some(\n `The exit condition \\`${exitText.value}\\` of ${entry.key} is not one msch-exits can check. Write ${GRAMMAR}.`,\n );\n }\n if (entry.section !== \"overrides\" && pipe(conditions.value, Arr.some(isUnused))) {\n return Option.some(\n `\\`unused\\` is checked only for overrides, by the unused-override and removable-override checks. Give ${entry.key} a condition on a release or an issue.`,\n );\n }\n return Option.none();\n};\n\nconst entryProblems = (read: ReadFile): readonly Problem[] => {\n const comments = commentsByLine(read.deviations.comments);\n return pipe(\n read.deviations.entries,\n Arr.flatMap((entry) => {\n const exitText = pipe(\n HashMap.get(comments, entry.line),\n Option.flatMap(({ text }) => exitTextOf(text)),\n );\n return pipe(\n messageFor(entry, exitText),\n Option.map((message) => problemAt(read)(entry.index, message)),\n Option.toArray,\n );\n }),\n );\n};\n\nconst strayProblems = (read: ReadFile): readonly Problem[] => {\n const entryLines = HashSet.fromIterable(\n pipe(\n read.deviations.entries,\n Arr.map(({ line }) => line),\n ),\n );\n return pipe(\n read.deviations.comments,\n Arr.filter(\n (comment) =>\n Option.isSome(exitTextOf(comment.text)) && !HashSet.has(entryLines, comment.line),\n ),\n Arr.map((comment) => problemAt(read)(comment.index, STRAY)),\n );\n};\n\nconst readRootFiles = Effect.fn(\"readRootFiles\")(function* readRootFiles(root: string) {\n const files = yield* RepositoryFiles;\n const read = yield* Effect.forEach(\n ROOT_FILES,\n ({ name, deviationsOf }) => {\n const file = files.join(root, name);\n return Effect.map(\n files.readFile(file),\n Option.map((source): ReadFile => ({ file, source, deviations: deviationsOf(source) })),\n );\n },\n { concurrency: \"unbounded\" },\n );\n return Arr.getSomes(read);\n});\n\n/** @internal */\nexport const checkUpstreamExits = Effect.fn(\"checkUpstreamExits\")(function* checkUpstreamExits(\n root: string,\n) {\n const read = yield* readRootFiles(root);\n return pipe(\n read,\n Arr.flatMap((file) => [...entryProblems(file), ...strayProblems(file)]),\n );\n});\n\n/** @internal */\nexport interface FileExit {\n readonly file: string;\n readonly met: MetExit;\n}\n\n/** @internal */\nexport const upstreamExitsMet = Effect.fn(\"upstreamExitsMet\")(function* upstreamExitsMet(\n root: string,\n) {\n const read = yield* readRootFiles(root);\n const perFile = yield* Effect.forEach(\n read,\n ({ file, deviations }) => {\n const entries: readonly ExitEntry[] = exitEntries(deviations);\n return Effect.map(\n metExits(entries),\n Arr.map((met): FileExit => ({ file, met })),\n );\n },\n { concurrency: 1 },\n );\n return Arr.flatten(perFile);\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { listedFiles, scanText } from \"#/shared/lib/scanned-files.ts\";\nimport type { Listed } from \"#/shared/lib/scanned-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { WORKSPACE_SECTIONS, cargoDeviations, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { Deviations } from \"./deviation-entries.ts\";\n\nconst RULE: RuleName = \"upstream-deviation-place\";\nconst MANIFEST = \"package.json\";\nconst NESTED_WORKSPACE = \"/pnpm-workspace.yaml\";\nconst NESTED_CARGO = \"/Cargo.toml\";\nconst CARGO_CONFIG = /(?:^|\\/)\\.cargo\\/config(?:\\.toml)?$/u;\nconst MANAGER_FIELDS = [\"overrides\", \"resolutions\"] as const;\nconst START = 0;\nconst PLACE =\n \"Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.\";\n\nconst Fields = Schema.Record(Schema.String, Schema.Unknown);\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({\n pnpm: Schema.optional(Fields),\n overrides: Schema.optional(Schema.Unknown),\n resolutions: Schema.optional(Schema.Unknown),\n }),\n);\nconst decodeManifest = Schema.decodeUnknownOption(Manifest);\n\ninterface Field {\n readonly name: string;\n readonly key: string;\n}\n\nconst isManifest = (name: string): boolean =>\n name === MANIFEST || Str.endsWith(`/${MANIFEST}`)(name);\n\nconst problemAt =\n (entry: Listed, source: string) =>\n (index: number, message: string): Problem => ({\n file: entry.file,\n ...positionOf(source)(index),\n rule: RULE,\n message,\n });\n\nconst keyIndex = (source: string, key: string): number =>\n Option.getOrElse(Str.indexOf(`\"${key}\"`)(source), () => START);\n\nconst fieldsIn = (source: string): readonly Field[] =>\n pipe(\n decodeManifest(source),\n Option.match({\n onNone: (): readonly Field[] => [],\n onSome: (manifest) => {\n const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));\n const pnpmFields = pipe(\n WORKSPACE_SECTIONS,\n Arr.filter((key) => Rec.has(pnpm, key)),\n Arr.map((key) => ({ name: `pnpm.${key}`, key })),\n );\n const managerFields = pipe(\n MANAGER_FIELDS,\n Arr.filter((key) => Option.isSome(Option.fromUndefinedOr(manifest[key]))),\n Arr.map((key) => ({ name: key, key })),\n );\n return [...pnpmFields, ...managerFields];\n },\n }),\n );\n\nconst manifestProblems = (entry: Listed, source: string): readonly Problem[] =>\n pipe(\n fieldsIn(source),\n Arr.map(({ name, key }) =>\n problemAt(entry, source)(\n keyIndex(source, key),\n `${name} in package.json is not allowed. ${PLACE} Move it there.`,\n ),\n ),\n );\n\nconst firstEntryProblem = (\n entry: Listed,\n source: string,\n deviations: Deviations,\n): readonly Problem[] =>\n pipe(\n Arr.head(deviations.entries),\n Option.map(({ index }) =>\n problemAt(entry, source)(index, `This file is not read for upstream deviations. ${PLACE}`),\n ),\n Option.toArray,\n );\n\nconst problemsIn = (entry: Listed, source: string): readonly Problem[] => {\n if (isManifest(entry.name)) {\n return manifestProblems(entry, source);\n }\n if (Str.endsWith(NESTED_WORKSPACE)(entry.name)) {\n return firstEntryProblem(entry, source, workspaceDeviations(source));\n }\n return firstEntryProblem(entry, source, cargoDeviations(source));\n};\n\nconst isScanned = ({ name }: Listed): boolean =>\n isManifest(name) ||\n Str.endsWith(NESTED_WORKSPACE)(name) ||\n Str.endsWith(NESTED_CARGO)(name) ||\n CARGO_CONFIG.test(name);\n\n/** @internal */\nexport const checkScatteredDeviations = Effect.fn(\"checkScatteredDeviations\")(\n function* checkScatteredDeviations(root: string) {\n const listed = yield* listedFiles(root);\n return yield* scanText(pipe(listed, Arr.filter(isScanned)), problemsIn);\n },\n);\n"],"mappings":";;;;;;;AAIA,MAAMA,UAAQ;AACd,MAAM,eAAe;AAErB,MAAa,cACV,YACA,UAAoD;CACnD,MAAM,SAAS,KAAK,QAAQC,SAAI,MAAMD,SAAO,KAAK,GAAGC,SAAI,MAAM,IAAI,CAAC;CACpE,OAAO;EACL,MAAM,OAAO;EACb,QAAQ,KACNC,MAAI,KAAK,MAAM,GACf,OAAO,MAAM;GAAE,cAAc;GAAc,SAAS,SAAS,KAAK,SAAS;EAAa,CAAC,CAC3F;CACF;AACF;;ACbF,MAAM,eACJ;AAEF,MAAM,WAAW;AAEjB,MAAM,gBAAgB;AAEtB,MAAM,mBAAmB;AAOzB,MAAa,iBAAiB,EAAE,WAC9B,aAAa,KAAK,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI;AAEhD,MAAa,kBAAkB,EAAE,WAA4B,cAAc,KAAK,IAAI;;AAGpF,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO;CACrB,MAAM,QAAQ,OAAO,MAAM,WAAW,IAAI;CAC1C,OAAO,KACL,OACAC,MAAI,KAAK,UAAkB;EAAE;EAAM,MAAM,MAAM,KAAK,MAAM,IAAI;CAAE,EAAE,CACpE;AACF,CAAC;;AAGD,MAAa,eAAe,OAAO,GAAG,cAAc,CAAC,CAAC,UAAU,aAC9D,QACA;CACA,MAAM,QAAQ,OAAO;CACrB,OAAO,OAAO,KACZ,QACA,OAAO,QAAQ,EAAE,WAAW,MAAM,OAAO,IAAI,CAAC,CAChD;AACF,CAAC;;AAGD,MAAa,WAAW,OAAO,GAAG,UAAU,CAAC,CAAC,UAAU,SACtD,QACA,YACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,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