@r_masseater/msch 0.65.0 → 0.66.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 +2 -2
- package/dist/changed.mjs +4 -4
- package/dist/cli.mjs +878 -864
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/config.mjs.map +1 -1
- package/dist/{dependencies-B6p7x90y.mjs → dependencies-BDQ7XSwU.mjs} +7 -30
- package/dist/dependencies-BDQ7XSwU.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/export-subpaths-D6ZLYZGy.mjs +17 -0
- package/dist/export-subpaths-D6ZLYZGy.mjs.map +1 -0
- package/dist/{ignored-directories-BgUqwuc4.mjs → ignored-directories-DurTKTTN.mjs} +2 -2
- package/dist/{ignored-directories-BgUqwuc4.mjs.map → ignored-directories-DurTKTTN.mjs.map} +1 -1
- package/dist/{index-BZIBqvmt.d.mts → index-CWZNFtdG.d.mts} +5 -1
- package/dist/{lookup-DmifnzVb.mjs → lookup-DjQU0W6q.mjs} +3 -16
- package/dist/lookup-DjQU0W6q.mjs.map +1 -0
- package/dist/{lookup-report-ARfHc4ey.mjs → lookup-report-CPR_cj8F.mjs} +3 -3
- package/dist/lookup-report-CPR_cj8F.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{pass-records-CFIrQmB5.mjs → pass-records-DdiDtl_g.mjs} +5 -5
- package/dist/pass-records-DdiDtl_g.mjs.map +1 -0
- package/dist/{problem-D2HKNIVq.mjs → problem-glqVxx3h.mjs} +2 -2
- package/dist/{problem-D2HKNIVq.mjs.map → problem-glqVxx3h.mjs.map} +1 -1
- package/dist/publish.mjs +7 -18
- package/dist/publish.mjs.map +1 -1
- package/dist/{published-BIexKvdJ.mjs → published-DnkuW2Tw.mjs} +10 -15
- package/dist/published-DnkuW2Tw.mjs.map +1 -0
- package/dist/refs.mjs +53 -25
- package/dist/refs.mjs.map +1 -1
- package/dist/{repository-files-B5sRbxlz.mjs → repository-files-mOPItI5o.mjs} +3 -3
- package/dist/repository-files-mOPItI5o.mjs.map +1 -0
- package/dist/{runtime-A2p57njU.mjs → runtime-mDBC8Yey.mjs} +2 -2
- package/dist/{runtime-A2p57njU.mjs.map → runtime-mDBC8Yey.mjs.map} +1 -1
- package/dist/{syntax-C0ddqOHc.mjs → syntax-A3ga4Ksb.mjs} +2 -2
- package/dist/{syntax-C0ddqOHc.mjs.map → syntax-A3ga4Ksb.mjs.map} +1 -1
- package/dist/tree-sitter-BfzHNwTR.mjs +41 -0
- package/dist/tree-sitter-BfzHNwTR.mjs.map +1 -0
- package/dist/{upstream-exits-Dp0EeI5D.mjs → upstream-exits-Bv2E-QO6.mjs} +21 -12
- package/dist/upstream-exits-Bv2E-QO6.mjs.map +1 -0
- package/dist/wake.mjs +1 -1
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +18 -5
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +3 -6
- package/skills/msch-checks/SKILL.md +2 -2
- package/skills/msch-publishing/SKILL.md +2 -0
- package/dist/dependencies-B6p7x90y.mjs.map +0 -1
- package/dist/lookup-DmifnzVb.mjs.map +0 -1
- package/dist/lookup-report-ARfHc4ey.mjs.map +0 -1
- package/dist/pass-records-CFIrQmB5.mjs.map +0 -1
- package/dist/published-BIexKvdJ.mjs.map +0 -1
- package/dist/reference-links-B9NZUUF8.mjs +0 -172
- package/dist/reference-links-B9NZUUF8.mjs.map +0 -1
- package/dist/repository-files-B5sRbxlz.mjs.map +0 -1
- package/dist/upstream-exits-Dp0EeI5D.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { n as RepositoryFiles } from "./repository-files-
|
|
2
|
-
import { t as MANIFEST_FILE$1 } from "./dependencies-
|
|
1
|
+
import { n as RepositoryFiles } from "./repository-files-mOPItI5o.mjs";
|
|
2
|
+
import { t as MANIFEST_FILE$1 } from "./dependencies-BDQ7XSwU.mjs";
|
|
3
|
+
import { t as exportEntriesOf } from "./export-subpaths-D6ZLYZGy.mjs";
|
|
3
4
|
import { n as baseName } from "./app-BwjhFdKD.mjs";
|
|
4
5
|
import { Array, Effect, Match, Option, Predicate, Record, Schema, String as String$1, pipe } from "effect";
|
|
5
6
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -295,16 +296,17 @@ var LockfileUnreadable = class extends taggedError$1()("LockfileUnreadable", {
|
|
|
295
296
|
reason: Schema.String
|
|
296
297
|
}) {};
|
|
297
298
|
// src/entities/workspace/model/locked-packages.ts
|
|
298
|
-
|
|
299
|
-
const wantedLockfile = (root) => Effect.tryPromise({
|
|
299
|
+
const readLockfile = (select) => (root) => Effect.tryPromise({
|
|
300
300
|
try: () => readWantedLockfile(root, { ignoreIncompatible: false }),
|
|
301
301
|
catch: (cause) => LockfileUnreadable.make({
|
|
302
302
|
root,
|
|
303
303
|
reason: String(cause)
|
|
304
304
|
})
|
|
305
|
-
}).pipe(Effect.map(Option.fromNullishOr));
|
|
305
|
+
}).pipe(Effect.map(Option.fromNullishOr), Effect.map(Option.flatMap(select)));
|
|
306
|
+
/** @internal */
|
|
307
|
+
const wantedLockfile = readLockfile(Option.some);
|
|
306
308
|
/** @internal */
|
|
307
|
-
const lockedPackages = (
|
|
309
|
+
const lockedPackages = readLockfile(({ packages }) => Option.map(Option.fromUndefinedOr(packages), Record.keys));
|
|
308
310
|
// src/entities/workspace/model/locked-graph.ts
|
|
309
311
|
const MANIFEST = "package.json";
|
|
310
312
|
const ROOT_IMPORTER = ".";
|
|
@@ -353,7 +355,6 @@ const workspaceLinks = Effect.fn("workspaceLinks")(function* workspaceLinks(root
|
|
|
353
355
|
const SOURCE = /\.[cm]?tsx?$/u;
|
|
354
356
|
const BUILT = /\.(?:d\.)?[cm]?[jt]s$/u;
|
|
355
357
|
const DECLARATION = ".d.";
|
|
356
|
-
const ROOT_SUBPATH = ".";
|
|
357
358
|
const BIN_LABEL = "bin";
|
|
358
359
|
const isBinEntry = ({ label }) => String$1.startsWith(`${BIN_LABEL} `)(label);
|
|
359
360
|
const targetsIn = (held) => {
|
|
@@ -361,12 +362,6 @@ const targetsIn = (held) => {
|
|
|
361
362
|
if (!Predicate.isObject(held)) return [];
|
|
362
363
|
return pipe(Record.values(held), Array.flatMap(targetsIn));
|
|
363
364
|
};
|
|
364
|
-
const subpathsOf = (exportsField) => {
|
|
365
|
-
if (!Predicate.isObject(exportsField)) return [[ROOT_SUBPATH, exportsField]];
|
|
366
|
-
const entries = Record.toEntries(exportsField);
|
|
367
|
-
if (pipe(entries, Array.some(([key]) => String$1.startsWith(ROOT_SUBPATH)(key)))) return entries;
|
|
368
|
-
return [[ROOT_SUBPATH, exportsField]];
|
|
369
|
-
};
|
|
370
365
|
const binsOf = (manifest) => {
|
|
371
366
|
if (Predicate.isString(manifest.bin)) {
|
|
372
367
|
const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => "");
|
|
@@ -381,7 +376,7 @@ const sourceOf = ({ join, packEntries }) => (target) => {
|
|
|
381
376
|
const name = entryNameOf(target);
|
|
382
377
|
return pipe(packEntries, Array.findFirst((entry) => entry.name === name), Option.map((entry) => entry.source));
|
|
383
378
|
};
|
|
384
|
-
const publicEntriesOf = (lookup) => pipe([...
|
|
379
|
+
const publicEntriesOf = (lookup) => pipe([...exportEntriesOf(lookup.manifest.exports), ...binsOf(lookup.manifest)], Array.flatMap(([label, held]) => pipe(targetsIn(held), Array.map(sourceOf(lookup)), Array.getSomes, Array.map((source) => ({
|
|
385
380
|
label,
|
|
386
381
|
source
|
|
387
382
|
})))), Array.dedupeWith((left, right) => left.label === right.label && left.source === right.source));
|
|
@@ -507,4 +502,4 @@ const publishedWorkspaces = Effect.fn("publishedWorkspaces")(function* published
|
|
|
507
502
|
});
|
|
508
503
|
export { programOf as A, stringsIn as B, VERIFY_TASK as C, testsItself as D, tasksOf as E, childrenOf as F, keyName as I, literalOf as L, usedFrom as M, workspaceConfigOf as N, literalSettings as O, KeySchema as P, nestedValues as R, RUN_TASKS as S, hasVerifyTask as T, deployEntries as _, EntryManifestJson as a, prefixed as b, publicEntriesOf as c, workspaceLinks as d, depPathsOf as f, bundledEntries as g, wantedLockfile as h, publishedWorkspaces as i, settingsInvalid as j, merged as k, targetsIn as l, lockedPackages as m, entriesOf as n, entryNameOf as o, lockedGraph as p, packedWorkspaces as r, isBinEntry as s, PackEntry as t, linkedPaths as u, shadcnUiIn as v, definesTask as w, NO_TASKS as x, shadcnUiOf as y, propertyValue as z };
|
|
509
504
|
|
|
510
|
-
//# sourceMappingURL=published-
|
|
505
|
+
//# sourceMappingURL=published-DnkuW2Tw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-DnkuW2Tw.mjs","names":["Arr","Rec","CONFIG_FILE","taggedError","Arr","Rec","Arr","SEPARATOR","Str","Str","Rec","Arr","READ_CONCURRENCY","Arr","taggedError","Rec","Rec","Arr","Arr","Rec","Str","Str","Rec","Arr","Arr","Str","Rec","MANIFEST_FILE"],"sources":["../src/entities/workspace/model/config-literal.ts","../src/entities/workspace/model/workspace-config-source.ts","../src/entities/workspace/model/workspace-tasks.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/shadcn-ui.ts","../src/entities/workspace/model/deploy-entries.ts","../src/entities/workspace/model/lockfile-unreadable.ts","../src/entities/workspace/model/locked-packages.ts","../src/entities/workspace/model/locked-graph.ts","../src/entities/workspace/model/locked-links.ts","../src/entities/package/model/public-entries.ts","../src/entities/package/model/published.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nexport type Literal = string | number | boolean | null | readonly Literal[] | LiteralObject;\n\nexport interface LiteralObject {\n readonly [key: string]: Literal;\n}\n\nconst WRAPPERS = [\"TSAsExpression\", \"TSSatisfiesExpression\", \"ParenthesizedExpression\"] as const;\n\nexport const KeySchema = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"Literal\"), value: Schema.String }),\n]);\nconst Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });\nconst PropertyNode = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n});\nconst WrappedNode = Schema.Struct({ type: Schema.Literals(WRAPPERS), expression: Schema.Unknown });\nconst ValueNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"Literal\"),\n value: Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]),\n }),\n Schema.Struct({\n type: Schema.Literal(\"TemplateLiteral\"),\n expressions: Schema.Tuple([]),\n quasis: Schema.Array(Quasi),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ArrayExpression\"),\n elements: Schema.Array(Schema.Unknown),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(PropertyNode),\n }),\n]);\n\nconst decodeWrapped = Schema.decodeUnknownOption(WrappedNode);\nconst decodeValue = Schema.decodeUnknownOption(ValueNode);\nconst decodeProperty = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"Property\"), key: KeySchema, value: Schema.Unknown }),\n);\nconst decodeObject = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n);\n\nexport const keyName = (key: typeof KeySchema.Type): string =>\n Match.value(key).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Identifier: (identifier) => identifier.name,\n Literal: (literal) => literal.value,\n }),\n );\n\nexport const literalOf = (node: unknown): Option.Option<Literal> => {\n const wrapped = decodeWrapped(node);\n if (Option.isSome(wrapped)) {\n return literalOf(wrapped.value.expression);\n }\n return pipe(\n decodeValue(node),\n Option.flatMap((value) =>\n Match.value(value).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Literal: (scalar): Option.Option<Literal> => Option.some(scalar.value),\n TemplateLiteral: (template): Option.Option<Literal> =>\n Option.some(\n pipe(\n template.quasis,\n Arr.map((quasi) => quasi.value.cooked),\n Arr.join(\"\"),\n ),\n ),\n ArrayExpression: (array): Option.Option<Literal> =>\n pipe(array.elements, Arr.map(literalOf), Option.all),\n ObjectExpression: (object): Option.Option<Literal> =>\n pipe(\n object.properties,\n Arr.map((property) =>\n pipe(\n literalOf(property.value),\n Option.map((literal) => [keyName(property.key), literal] as const),\n ),\n ),\n Option.all,\n Option.map(Rec.fromEntries),\n ),\n }),\n ),\n ),\n );\n};\n\nexport const propertyValue =\n (name: string) =>\n (object: unknown): Option.Option<unknown> =>\n pipe(\n decodeObject(object),\n Option.flatMap(({ properties }) =>\n pipe(\n properties,\n Arr.findFirst((property) =>\n pipe(\n decodeProperty(property),\n Option.filter(({ key }) => keyName(key) === name),\n Option.map(({ value }) => value),\n ),\n ),\n ),\n ),\n );\n\nexport const childrenOf = (node: unknown): readonly unknown[] => {\n if (Arr.isArray(node)) {\n return node;\n }\n if (Predicate.isReadonlyObject(node)) {\n return Rec.values(node);\n }\n return [];\n};\n\nexport const nestedValues =\n (path: readonly [string, string]) =>\n (node: unknown): readonly unknown[] => {\n const [outer, inner] = path;\n const own = pipe(\n Option.some(node),\n Option.flatMap(propertyValue(outer)),\n Option.flatMap(propertyValue(inner)),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(nestedValues(path)))];\n };\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\nexport interface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nexport const stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { literalOf, nestedValues } from \"./config-literal.ts\";\n\nconst SINGLE = 1;\nconst CONFIG_FILE = \"vite.config.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceSettingsInvalid extends taggedError<\n WorkspaceSettingsInvalid,\n { readonly brand: unique symbol }\n>()(\"WorkspaceSettingsInvalid\", { file: Schema.String, message: Schema.String }) {}\n\nexport const settingsInvalid =\n (file: string) =>\n (reason: string): WorkspaceSettingsInvalid =>\n WorkspaceSettingsInvalid.make({ file, message: `${file}: ${reason}` });\n\nexport interface WorkspaceSource {\n readonly file: string;\n readonly directory: string;\n readonly program: unknown;\n}\n\nexport type SettingsPath = readonly [string, string];\n\nconst notLiteral = ([outer, inner]: SettingsPath): string =>\n `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Name a set the root config defines in use instead of importing values.`;\n\nexport const merged = <Value>(\n records: readonly Readonly<Record<string, Value>>[],\n): Record<string, Value> => pipe(records, Arr.flatMap(Rec.toEntries), Rec.fromEntries);\n\nexport const usedFrom = Effect.fn(\"usedFrom\")(function* usedFrom<Value>(\n file: string,\n sets: Readonly<Record<string, Value>>,\n used: readonly string[],\n) {\n const unknownSets = pipe(\n used,\n Arr.filter((name) => !Rec.has(sets, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(unknownSets)) {\n return yield* settingsInvalid(file)(\n `msch uses sets the root does not define: ${Arr.join(unknownSets, \", \")}. Defined: ${Arr.join(Rec.keys(sets), \", \")}.`,\n );\n }\n return pipe(\n used,\n Arr.flatMap((name) => Option.toArray(Rec.get(sets, name))),\n );\n});\n\nconst singleValue = Effect.fn(\"singleValue\")(function* singleValue(\n source: WorkspaceSource,\n path: SettingsPath,\n) {\n const found = nestedValues(path)(source.program);\n if (found.length > SINGLE) {\n return yield* settingsInvalid(source.file)(`${Arr.join(path, \".\")} appears more than once.`);\n }\n return Arr.head(found);\n});\n\nexport interface LiteralSettingsRequest<Settings> {\n readonly source: WorkspaceSource;\n readonly path: SettingsPath;\n readonly decode: (input: unknown) => Effect.Effect<Settings, Schema.SchemaError>;\n}\n\nexport const literalSettings = <Settings>({\n source,\n path,\n decode,\n}: LiteralSettingsRequest<Settings>): Effect.Effect<\n Option.Option<Settings>,\n WorkspaceSettingsInvalid\n> =>\n Effect.gen(function* literalSettingsIn() {\n const node = yield* singleValue(source, path);\n if (Option.isNone(node)) {\n return Option.none();\n }\n const literal = literalOf(node.value);\n if (Option.isNone(literal)) {\n return yield* settingsInvalid(source.file)(notLiteral(path));\n }\n const settings = yield* decode(literal.value).pipe(\n Effect.mapError((error) => settingsInvalid(source.file)(error.message)),\n );\n return Option.some(settings);\n });\n\nexport const programOf = Effect.fn(\"programOf\")(function* programOf(file: string, text: string) {\n const parsed = yield* Effect.promise(() => parse(file, text, { lang: \"ts\" }));\n if (Arr.isReadonlyArrayNonEmpty(parsed.errors)) {\n return yield* settingsInvalid(file)(\"vite.config.ts does not parse.\");\n }\n const program: unknown = parsed.program;\n return program;\n});\n\n/** @internal */\nexport interface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Manifest } from \"#/entities/package/@x/workspace.ts\";\n\nimport { nestedValues, propertyValue, stringsIn } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const VERIFY_TASK = [\"tasks\", \"verify\"] as const;\n\nexport const TEST_TASK = [\"tasks\", \"test\"] as const;\n\nconst NATIVE_TASK = [\"tasks\", \"native\"] as const;\n\nexport const RUN_TASKS = [\"run\", \"tasks\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n readonly native: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [], native: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nconst TEST_TASK_NAME = \"test\";\nconst DEPENDS_ON = \"dependsOn\";\n\nexport const testsItself = (program: unknown): boolean =>\n definesTask(TEST_TASK)(program) ||\n pipe(\n nestedValues(VERIFY_TASK)(program),\n Arr.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))),\n Arr.flatMap(stringsIn),\n Arr.some(({ text }) => text === TEST_TASK_NAME),\n );\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n return Option.exists(config, isVerified);\n});\n\nconst shipsAddon = (manifest: Option.Option<Manifest>): boolean =>\n Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));\n\nexport const tasksOf =\n (manifest: Option.Option<Manifest>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (name) => ({\n verify: Arr.getSomes([\n Option.liftPredicate(`${name}#verify`, () => definesTask(VERIFY_TASK)(program)),\n Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)),\n ]),\n native: Arr.filter(\n [`${name}#native`],\n () => definesTask(NATIVE_TASK)(program) || shipsAddon(manifest),\n ),\n }),\n }),\n );\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { prefixed, withoutRelative } from \"./workspace-patterns.ts\";\n\nconst SHADCN_FILE = \"components.json\";\nconst MANIFEST_FILE = \"package.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst ManifestImports = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\nconst decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));\n\nconst withoutWildcard = Str.replace(WILDCARD, \"\");\n\nconst importTarget =\n (alias: string) =>\n ([key, target]: readonly [string, string]): Option.Option<string> => {\n if (!Str.endsWith(WILDCARD)(key)) {\n return Option.some(target).pipe(Option.filter(() => key === alias));\n }\n const prefix = withoutWildcard(key);\n if (!Str.startsWith(prefix)(alias)) {\n return Option.none();\n }\n return Option.some(`${withoutWildcard(target)}${Str.slice(prefix.length)(alias)}`);\n };\n\nconst resolvedAlias = (\n imports: Readonly<Record<string, string>>,\n alias: string,\n): Option.Option<string> =>\n pipe(Rec.toEntries(imports), Arr.findFirst(importTarget(alias)), Option.map(withoutRelative));\n\nexport type ShadcnUi = Readonly<{\n file: string;\n alias: string;\n target: Option.Option<string>;\n}>;\n\nexport const shadcnUiOf = Effect.fn(\"shadcnUiOf\")(function* shadcnUiOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SHADCN_FILE);\n const configText = yield* files.readFile(file);\n const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodeManifestImports),\n Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }): ShadcnUi => ({\n file,\n alias: aliases.ui,\n target: pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n ),\n })),\n );\n});\n\nexport const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(\n root: string,\n directory: string,\n) {\n const found = yield* shadcnUiOf(root, directory);\n return pipe(\n found,\n Option.map(\n ({ alias, target }) =>\n `${prefixed(directory)(Option.getOrElse(target, () => alias))}${EVERYTHING}`,\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { KeySchema, childrenOf, keyName, stringsIn } from \"./config-literal.ts\";\n\nconst MAIN_KEY = \"main\";\nconst FRAMEWORK_SITES = \"Website\";\nconst READ_CONCURRENCY = 16;\nconst SCRIPT = /\\.[cm]?tsx?$/u;\nconst SKIPPED = /\\.test\\.|\\.d\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst MAIN_PROPERTY = /\\bmain\\s*:/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\nconst SiteNamespace = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(FRAMEWORK_SITES),\n});\nconst SiteResource = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n object: SiteNamespace,\n});\nconst FrameworkSite = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: SiteResource,\n});\nconst decodeFrameworkSite = Schema.decodeUnknownOption(FrameworkSite);\n\nconst isMainProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => keyName(key) === MAIN_KEY),\n );\n\ntype Skip = (node: unknown) => boolean;\n\nconst skipNothing: Skip = () => false;\n\nconst isFrameworkSite: Skip = (node) => Option.isSome(decodeFrameworkSite(node));\n\nconst mainTargetsIn = (skip: Skip): ((node: unknown) => readonly string[]) => {\n const visit = (node: unknown): readonly string[] => {\n if (skip(node)) {\n return [];\n }\n if (Predicate.isReadonlyObject(node) && isMainProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.head,\n Option.map(({ text }) => text),\n Option.toArray,\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(visit));\n };\n return visit;\n};\n\ninterface Declaring {\n readonly root: string;\n readonly file: string;\n readonly skip: Skip;\n}\n\nconst declaredIn = Effect.fn(\"declaredIn\")(function* declaredIn({ root, file, skip }: Declaring) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value) || !MAIN_PROPERTY.test(text.value)) {\n return [];\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return pipe(\n mainTargetsIn(skip)(parsed.program),\n Arr.map((target) => files.join(files.dirname(file), target)),\n );\n});\n\nconst entriesOutside = Effect.fn(\"entriesOutside\")(function* entriesOutside(\n root: string,\n skip: Skip,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const declaring = pipe(\n listed,\n Arr.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)),\n );\n const found = yield* Effect.forEach(declaring, (file) => declaredIn({ root, file, skip }), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(\n Arr.flatten(found),\n Arr.filter((file) => Arr.contains(listed, file)),\n Arr.dedupe,\n );\n});\n\nexport const deployEntries = Effect.fn(\"deployEntries\")(function* deployEntries(root: string) {\n return yield* entriesOutside(root, skipNothing);\n});\n\nexport const bundledEntries = Effect.fn(\"bundledEntries\")(function* bundledEntries(root: string) {\n return yield* entriesOutside(root, isFrameworkSite);\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class LockfileUnreadable extends taggedError<\n LockfileUnreadable,\n { readonly brand: unique symbol }\n>()(\"LockfileUnreadable\", { root: Schema.String, reason: Schema.String }) {}\n","import { readWantedLockfile } from \"@pnpm/lockfile.fs\";\nimport { Effect, Option, Record as Rec } from \"effect\";\n\nimport { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport type WantedLockfile = NonNullable<Awaited<ReturnType<typeof readWantedLockfile>>>;\n\nconst readLockfile =\n <Selected>(select: (lockfile: WantedLockfile) => Option.Option<Selected>) =>\n (root: string): Effect.Effect<Option.Option<Selected>, LockfileUnreadable> =>\n Effect.tryPromise({\n try: () => readWantedLockfile(root, { ignoreIncompatible: false }),\n catch: (cause) => LockfileUnreadable.make({ root, reason: String(cause) }),\n }).pipe(Effect.map(Option.fromNullishOr), Effect.map(Option.flatMap(select)));\n\n/** @internal */\nexport const wantedLockfile = readLockfile(Option.some);\n\n/** @internal */\nexport const lockedPackages = readLockfile(({ packages }) =>\n Option.map(Option.fromUndefinedOr(packages), Rec.keys),\n);\n","import { refToRelative } from \"@pnpm/deps.path\";\nimport { Array as Arr, Effect, Option, Record as Rec, pipe } from \"effect\";\n\nimport { wantedLockfile } from \"./locked-packages.ts\";\nimport type { WantedLockfile } from \"./locked-packages.ts\";\nimport type { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport interface LockedNode {\n readonly id: string;\n readonly dependencies: readonly string[];\n}\n\nconst MANIFEST = \"package.json\";\nconst ROOT_IMPORTER = \".\";\n\ntype ProjectSnapshot = WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]];\n\ntype ResolvedSections = Readonly<\n Partial<Pick<ProjectSnapshot, \"dependencies\" | \"devDependencies\" | \"optionalDependencies\">>\n>;\n\nexport type ResolvedDependencies = Readonly<\n NonNullable<WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]][\"dependencies\"]>\n>;\n\ninterface LockedSnapshots<Importer extends string, Package extends string> {\n readonly importers: Readonly<Record<Importer, ResolvedSections>>;\n readonly packages?: Readonly<Record<Package, ResolvedSections>> | undefined;\n}\n\nconst importerManifest = (id: string): string =>\n Option.match(\n Option.liftPredicate(id, (found) => found === ROOT_IMPORTER),\n {\n onNone: () => `${id}/${MANIFEST}`,\n onSome: () => MANIFEST,\n },\n );\n\nexport const depPathsOf = (resolved: ResolvedDependencies | undefined): readonly string[] =>\n pipe(\n Rec.toEntries(resolved ?? {}),\n Arr.flatMap(([name, reference]) =>\n Option.toArray(Option.fromNullishOr(refToRelative(reference, name))),\n ),\n );\n\nconst nodesOf = <Importer extends string, Package extends string>(\n lockfile: LockedSnapshots<Importer, Package>,\n): readonly LockedNode[] => [\n ...pipe(\n Rec.toEntries(lockfile.importers),\n Arr.map(([id, project]) => ({\n id: importerManifest(id),\n dependencies: [\n ...depPathsOf(project.dependencies),\n ...depPathsOf(project.devDependencies),\n ...depPathsOf(project.optionalDependencies),\n ],\n })),\n ),\n ...pipe(\n Option.match(Option.fromUndefinedOr(lockfile.packages), {\n onNone: (): readonly (readonly [Package, ResolvedSections])[] => [],\n onSome: Rec.toEntries,\n }),\n Arr.map(([id, snapshot]) => ({\n id,\n dependencies: [\n ...depPathsOf(snapshot.dependencies),\n ...depPathsOf(snapshot.optionalDependencies),\n ],\n })),\n ),\n];\n\n/** @internal */\nexport const lockedGraph = (\n root: string,\n): Effect.Effect<Option.Option<readonly LockedNode[]>, LockfileUnreadable> =>\n wantedLockfile(root).pipe(Effect.map(Option.map(nodesOf)));\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\nconst LINK = \"link:\";\n\nexport interface WorkspaceLink {\n readonly from: string;\n readonly to: string;\n}\n\nexport const linkedPaths = (\n sections: readonly (ResolvedDependencies | undefined)[],\n): readonly string[] =>\n pipe(\n sections,\n Arr.flatMap((resolved) => Rec.values(resolved ?? {})),\n Arr.filter(Str.startsWith(LINK)),\n Arr.map((reference) => Str.slice(LINK.length)(reference)),\n );\n\n/** @internal */\nexport const workspaceLinks = Effect.fn(\"workspaceLinks\")(function* workspaceLinks(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const linksOf = (id: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const from = files.relative(root, files.join(root, id));\n return pipe(\n paths,\n Arr.map((path): WorkspaceLink => ({\n from,\n to: files.relative(root, files.join(root, id, path)),\n })),\n );\n };\n return pipe(\n lockfile,\n Option.map(({ importers }) =>\n pipe(\n Rec.toEntries(importers),\n Arr.flatMap(([id, project]) =>\n linksOf(\n id,\n linkedPaths([\n project.dependencies,\n project.devDependencies,\n project.optionalDependencies,\n ]),\n ),\n ),\n ),\n ),\n Option.getOrElse((): readonly WorkspaceLink[] => []),\n );\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { exportEntriesOf } from \"./export-subpaths.ts\";\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport interface EntryManifest {\n readonly name?: string | undefined;\n readonly exports?: unknown;\n readonly bin?: unknown;\n}\n\nexport interface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nexport const isBinEntry = ({ label }: PublicEntry): boolean =>\n Str.startsWith(`${BIN_LABEL} `)(label);\n\nexport const targetsIn = (held: unknown): readonly string[] => {\n if (Predicate.isString(held)) {\n return [held];\n }\n if (!Predicate.isObject(held)) {\n return [];\n }\n return pipe(Rec.values(held), Arr.flatMap(targetsIn));\n};\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] => {\n if (Predicate.isString(manifest.bin)) {\n const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => \"\");\n return [[`${BIN_LABEL} ${name}`, manifest.bin]];\n }\n if (!Predicate.isObject(manifest.bin)) {\n return [];\n }\n return pipe(\n Rec.toEntries(manifest.bin),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n};\n\nexport const entryNameOf = (target: string): string => Str.replace(BUILT, \"\")(baseName(target));\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = entryNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nexport const publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...exportEntriesOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n\nconst EntryManifestFields = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nexport const EntryManifestJson = Schema.fromJsonString(EntryManifestFields);\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nexport const PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst AlwaysBundle = Schema.Array(Schema.String);\nconst PackDeps = Schema.Struct({ alwaysBundle: Schema.optional(AlwaysBundle) });\nconst PackSettings = Schema.Struct({\n entry: Schema.optional(PackEntry),\n deps: Schema.optional(PackDeps),\n});\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst PackConfig = Schema.Struct({ pack: Schema.optional(PackList) });\nconst BudgetConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n});\nconst PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(false)) });\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nexport interface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\nexport interface PackedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly packEntries: readonly PackEntrySource[];\n readonly alwaysBundle: readonly string[];\n}\n\nexport interface PublishedWorkspace extends PackedWorkspace {\n readonly installSize: string;\n readonly installBudget: number;\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nexport const entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packSettingsOf = (pack: typeof PackConfig.Type.pack): readonly (typeof PackSettings.Type)[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n );\n\nconst packEntriesOf = (pack: typeof PackConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst alwaysBundleOf = (pack: typeof PackConfig.Type.pack): readonly string[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.deps),\n Option.flatMap((deps) => Option.fromUndefinedOr(deps.alwaysBundle)),\n Option.getOrElse((): readonly string[] => []),\n ),\n ),\n Arr.dedupe,\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return config;\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return Option.exists(text, (found) =>\n Option.isSome(Schema.decodeOption(Schema.fromJsonString(PublicManifest))(found)),\n );\n});\n\nconst packedWorkspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ pack }: typeof PackConfig.Type): PackedWorkspace => ({\n directory,\n configFile,\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n alwaysBundle: alwaysBundleOf(pack),\n });\n\nconst budgetOf = ({\n msch,\n}: typeof BudgetConfig.Type): Pick<PublishedWorkspace, \"installSize\" | \"installBudget\"> => {\n const [amount, , unit] = msch.publish.installSize;\n return { installSize: `${amount} ${unit}`, installBudget: amount * bytesPer(unit) };\n};\n\nconst packedIn = Effect.fn(\"packedIn\")(function* packedIn(root: string, configName: string) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<readonly [PackedWorkspace, unknown]>();\n }\n const config = yield* settingsIn(configFile);\n return pipe(\n config,\n Option.flatMap((found) =>\n pipe(\n Schema.decodeUnknownOption(PackConfig)(found),\n Option.map(\n packedWorkspaceOf(directory, configFile, (source) => files.join(directory, source)),\n ),\n Option.map((workspace) => [workspace, found] as const),\n ),\n ),\n );\n});\n\nconst packedPairs = Effect.fn(\"packedPairs\")(function* packedPairs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const configs = pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n const found = yield* Effect.forEach(configs, (name) => packedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\n/** @internal */\nexport const packedWorkspaces = Effect.fn(\"packedWorkspaces\")(function* packedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.map(([workspace]) => workspace),\n );\n});\n\n/** @internal */\nexport const publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.flatMap(([workspace, config]) =>\n pipe(\n Schema.decodeUnknownOption(BudgetConfig)(config),\n Option.map((budget): PublishedWorkspace => ({ ...workspace, ...budgetOf(budget) })),\n Option.toArray,\n ),\n ),\n );\n});\n"],"mappings":";;;;;;;;;AASA,MAAM,WAAW;CAAC;CAAkB;CAAyB;AAAyB;AAEtF,MAAa,YAAY,OAAO,MAAM,CACpC,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,YAAY;CAAG,MAAM,OAAO;AAAO,CAAC,GACzE,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,SAAS;CAAG,OAAO,OAAO;AAAO,CAAC,CAC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AO,MAAM,YAAY,IAAI;CAC3C,MAAM,UAAU,KACd,OACAA,MAAI,QAAQ,SAAS,MAAM,SAAS,IAAI,MAAM,eAAeC,SAAI,SAAS,SAAS,CAAC,CAAC,IAAI,CAAC,CAC5F;CACA,MAAM,QAAQ,OAAO,OAAO,QAAQ,UAAU,SAAS,SAAS,MAAM,IAAI,GAAG,EAC3E,aAAa,iBACf,CAAC;CACD,OAAOD,MAAI,SAAS,KAAK;AAC3B,CAAC;;AAGD,MAAa,mBAAmB,OAAO,GAAG,kBAAkB,CAAC,CAAC,UAAU,iBACtE,MACA;CACA,MAAM,QAAQ,OAAO,YAAY,IAAI;CACrC,OAAO,KACL,OACAA,MAAI,KAAK,CAAC,eAAe,SAAS,CACpC;AACF,CAAC;;AAGD,MAAa,sBAAsB,OAAO,GAAG,qBAAqB,CAAC,CAAC,UAAU,oBAC5E,MACA;CACA,MAAM,QAAQ,OAAO,YAAY,IAAI;CACrC,OAAO,KACL,OACAA,MAAI,SAAS,CAAC,WAAW,YACvB,KACE,OAAO,oBAAoB,YAAY,CAAC,CAAC,MAAM,GAC/C,OAAO,KAAK,YAAgC;EAAE,GAAG;EAAW,GAAG,SAAS,MAAM;CAAE,EAAE,GAClF,OAAO,OACT,CACF,CACF;AACF,CAAC"}
|
package/dist/refs.mjs
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
3
|
-
import { t as runCli } from "./runtime-
|
|
4
|
-
import { a as groupOf, n as RepositoryFiles } from "./repository-files-
|
|
5
|
-
import { a as sent, i as publicLookup, n as githubToken,
|
|
6
|
-
import {
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-CPR_cj8F.mjs";
|
|
3
|
+
import { t as runCli } from "./runtime-mDBC8Yey.mjs";
|
|
4
|
+
import { a as groupOf, n as RepositoryFiles } from "./repository-files-mOPItI5o.mjs";
|
|
5
|
+
import { a as sent, i as publicLookup, n as githubToken, r as jsonLookup } from "./lookup-DjQU0W6q.mjs";
|
|
6
|
+
import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
|
|
7
7
|
import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
8
|
+
import { NO_PATH, describeReference, linksIn, referenceOf } from "@r_masseater/y8";
|
|
8
9
|
import { HttpClientResponse } from "effect/http";
|
|
10
|
+
// src/features/check-references/model/markdown-texts.ts
|
|
11
|
+
const MARKDOWN = ".md";
|
|
12
|
+
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
13
|
+
const READ_CONCURRENCY = 16;
|
|
14
|
+
/** @internal */
|
|
15
|
+
const markdownTexts = Effect.fn("markdownTexts")(function* markdownTexts(root) {
|
|
16
|
+
const files = yield* RepositoryFiles;
|
|
17
|
+
const listed = yield* files.listedFiles(root);
|
|
18
|
+
const documents = pipe(listed, Array.filter((file) => String$1.endsWith(MARKDOWN)(file) && !FIXTURE.test(file)), Array.map((file) => files.join(root, file)));
|
|
19
|
+
const read = yield* Effect.forEach(documents, (file) => Effect.map(files.readFile(file), Option.map((source) => ({
|
|
20
|
+
file,
|
|
21
|
+
source
|
|
22
|
+
}))), { concurrency: READ_CONCURRENCY });
|
|
23
|
+
return Array.getSomes(read);
|
|
24
|
+
});
|
|
9
25
|
// src/features/check-references/model/declared-symbols.ts
|
|
10
26
|
const GRAMMAR_OF = {
|
|
11
27
|
ts: "typescript",
|
|
@@ -65,6 +81,7 @@ const ABBREVIATED = "application/vnd.npm.install-v1+json";
|
|
|
65
81
|
const NOT_FOUND = 404;
|
|
66
82
|
const MULTIPLE_CHOICES = 300;
|
|
67
83
|
const SEPARATOR = "/";
|
|
84
|
+
const LATEST = "latest";
|
|
68
85
|
const found = { kind: "found" };
|
|
69
86
|
const broken = (reason) => ({
|
|
70
87
|
kind: "broken",
|
|
@@ -81,7 +98,7 @@ const Repository = Schema.Struct({
|
|
|
81
98
|
});
|
|
82
99
|
const Version = Schema.Struct({ deprecated: Schema.optional(Schema.String) });
|
|
83
100
|
const Packument = Schema.Struct({
|
|
84
|
-
"dist-tags": Schema.
|
|
101
|
+
"dist-tags": Schema.Record(Schema.String, Schema.String),
|
|
85
102
|
versions: Schema.Record(Schema.String, Version)
|
|
86
103
|
});
|
|
87
104
|
const answered = (lookup, missing, next) => Effect.flatMap(sent(lookup), (response) => {
|
|
@@ -107,8 +124,10 @@ const symbolOutcome = Effect.fn("symbolOutcome")(function* symbolOutcome({ path
|
|
|
107
124
|
}
|
|
108
125
|
});
|
|
109
126
|
});
|
|
110
|
-
const
|
|
111
|
-
const
|
|
127
|
+
const repositoryContentsOutcome = (reference, repository, token) => {
|
|
128
|
+
const checked = repositoryOutcome(reference, repository);
|
|
129
|
+
if (checked.kind !== "found" || reference.path === NO_PATH) return Effect.succeed(checked);
|
|
130
|
+
const branch = Option.getOrElse(reference.ref, () => repository.default_branch);
|
|
112
131
|
const url = `${GITHUB}${reference.owner}/${reference.repo}/contents/${encodedPath(reference.path)}?ref=${encodeURIComponent(branch)}`;
|
|
113
132
|
const missing = `${reference.path} does not exist on ${branch} of ${reference.owner}/${reference.repo}. Point at where it lives now.`;
|
|
114
133
|
return Option.match(reference.symbol, {
|
|
@@ -123,11 +142,6 @@ const pathOutcome = (reference, defaultBranch, token) => {
|
|
|
123
142
|
}, missing, (response) => response.text.pipe(Effect.flatMap((source) => symbolOutcome(reference, symbol, source))))
|
|
124
143
|
});
|
|
125
144
|
};
|
|
126
|
-
const repositoryStep = (reference, token) => (response) => Effect.flatMap(HttpClientResponse.schemaBodyJson(Repository)(response), (repository) => {
|
|
127
|
-
const checked = repositoryOutcome(reference, repository);
|
|
128
|
-
if (checked.kind !== "found" || reference.path === "") return Effect.succeed(checked);
|
|
129
|
-
return pathOutcome(reference, repository.default_branch, token);
|
|
130
|
-
});
|
|
131
145
|
const githubOutcome = Effect.fn("githubOutcome")(function* githubOutcome(reference) {
|
|
132
146
|
const token = yield* githubToken;
|
|
133
147
|
const lookup = jsonLookup({
|
|
@@ -135,16 +149,26 @@ const githubOutcome = Effect.fn("githubOutcome")(function* githubOutcome(referen
|
|
|
135
149
|
token
|
|
136
150
|
});
|
|
137
151
|
const missing = `${reference.owner}/${reference.repo} does not exist, or the token in GH_TOKEN cannot read it.`;
|
|
138
|
-
return yield* answered(lookup, missing,
|
|
152
|
+
return yield* answered(lookup, missing, (response) => Effect.flatMap(HttpClientResponse.schemaBodyJson(Repository)(response), (repository) => repositoryContentsOutcome(reference, repository, token)));
|
|
153
|
+
});
|
|
154
|
+
const versionOf = ({ "dist-tags": tags }, requested) => Option.match(requested, {
|
|
155
|
+
onNone: () => Option.fromNullishOr(tags[LATEST]),
|
|
156
|
+
onSome: (asked) => Option.some(Option.getOrElse(Option.fromNullishOr(tags[asked]), () => asked))
|
|
157
|
+
});
|
|
158
|
+
const versionOutcome = ({ name, version }, packument) => Option.match(versionOf(packument, version), {
|
|
159
|
+
onNone: () => broken(`${name} has no ${LATEST} tag.`),
|
|
160
|
+
onSome: (resolved) => Option.match(Option.fromNullishOr(packument.versions[resolved]), {
|
|
161
|
+
onNone: () => broken(`${name}@${resolved} is not published on npm.`),
|
|
162
|
+
onSome: ({ deprecated }) => Option.match(Option.fromNullishOr(deprecated), {
|
|
163
|
+
onNone: () => found,
|
|
164
|
+
onSome: (message) => broken(`${name}@${resolved} is deprecated: ${message}`)
|
|
165
|
+
})
|
|
166
|
+
})
|
|
139
167
|
});
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
...publicLookup(`${NPM}${String$1.replace("/", "%2f")(name)}`),
|
|
168
|
+
const npmOutcome = (reference) => answered({
|
|
169
|
+
...publicLookup(`${NPM}${String$1.replace("/", "%2f")(reference.name)}`),
|
|
143
170
|
accept: ABBREVIATED
|
|
144
|
-
}, `${name} is not published on npm.`, (response) => Effect.map(HttpClientResponse.schemaBodyJson(Packument)(response), (packument) =>
|
|
145
|
-
onNone: () => found,
|
|
146
|
-
onSome: (message) => broken(`${name} is deprecated: ${message}`)
|
|
147
|
-
})));
|
|
171
|
+
}, `${reference.name} is not published on npm.`, (response) => Effect.map(HttpClientResponse.schemaBodyJson(Packument)(response), (packument) => versionOutcome(reference, packument)));
|
|
148
172
|
/** @internal */
|
|
149
173
|
const resolveReference = (reference) => Match.value(reference).pipe(Match.discriminatorsExhaustive("kind")({
|
|
150
174
|
github: githubOutcome,
|
|
@@ -155,9 +179,9 @@ const resolveReference = (reference) => Match.value(reference).pipe(Match.discri
|
|
|
155
179
|
}));
|
|
156
180
|
// src/features/check-references/model/unresolved-references.ts
|
|
157
181
|
const LOOKUP_CONCURRENCY = 4;
|
|
158
|
-
const occurrencesIn = (
|
|
159
|
-
file,
|
|
160
|
-
line
|
|
182
|
+
const occurrencesIn = (links) => pipe(links, Array.flatMap(({ path, line, destination }) => pipe(referenceOf(destination), Option.map((reference) => ({
|
|
183
|
+
file: path,
|
|
184
|
+
line,
|
|
161
185
|
reference
|
|
162
186
|
})), Option.toArray)));
|
|
163
187
|
const unresolvedAt = (place) => (outcome) => {
|
|
@@ -180,7 +204,11 @@ const unresolvedOf = (outcomes) => ({ file, line, reference }) => {
|
|
|
180
204
|
const unresolvedReferences = Effect.fn("unresolvedReferences")(function* unresolvedReferences(root) {
|
|
181
205
|
const files = yield* RepositoryFiles;
|
|
182
206
|
const texts = yield* markdownTexts(root);
|
|
183
|
-
const
|
|
207
|
+
const links = yield* linksIn(pipe(texts, Array.map(({ file, source }) => ({
|
|
208
|
+
path: files.relative(root, file),
|
|
209
|
+
text: source
|
|
210
|
+
}))));
|
|
211
|
+
const occurrences = occurrencesIn(links);
|
|
184
212
|
const distinct = pipe(occurrences, Array.dedupeWith((left, right) => describeReference(left.reference) === describeReference(right.reference)), Array.map(({ reference }) => reference));
|
|
185
213
|
const resolved = yield* Effect.forEach(distinct, (reference) => Effect.map(resolveReference(reference), (outcome) => [describeReference(reference), outcome]), { concurrency: LOOKUP_CONCURRENCY });
|
|
186
214
|
const outcomes = HashMap.fromIterable(resolved);
|
package/dist/refs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.mjs","names":["SEPARATOR","Rec","Arr","Str","Arr","Arr"],"sources":["../src/features/check-references/model/declared-symbols.ts","../src/features/check-references/model/resolve-reference.ts","../src/features/check-references/model/unresolved-references.ts","../bin/msch-refs.ts"],"sourcesContent":["import { Array as Arr, Effect, HashSet, Option, Record as Rec, pipe } from \"effect\";\n\nimport { groupOf } from \"#/shared/lib/match-groups.ts\";\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { SyntaxNode } from \"#/shared/lib/tree-sitter.ts\";\n\nconst GRAMMAR_OF: Readonly<Record<string, string>> = {\n ts: \"typescript\",\n mts: \"typescript\",\n cts: \"typescript\",\n tsx: \"tsx\",\n js: \"javascript\",\n mjs: \"javascript\",\n cjs: \"javascript\",\n jsx: \"javascript\",\n rs: \"rust\",\n py: \"python\",\n go: \"go\",\n java: \"java\",\n rb: \"ruby\",\n php: \"php\",\n cs: \"c-sharp\",\n cpp: \"cpp\",\n};\nconst IMPLEMENTATION = \"impl_item\";\nconst NAME_FIELD = \"name\";\nconst TYPE_FIELD = \"type\";\nconst SEPARATOR = \".\";\nconst EXTENSION = /\\.(?<extension>[^./]+)$/u;\nconst FIRST = 0;\nconst ONE = 1;\n\nexport const supportedExtensions: readonly string[] = Rec.keys(GRAMMAR_OF);\n\nexport const grammarOf = (path: string): Option.Option<string> =>\n pipe(\n groupOf(\"extension\")(EXTENSION.exec(path)),\n Option.flatMap((extension) => Rec.get(GRAMMAR_OF, extension)),\n );\n\nconst implementedType = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.liftPredicate(node, ({ type }) => type === IMPLEMENTATION),\n Option.flatMap((implementation) =>\n Option.fromNullishOr(implementation.childForFieldName(TYPE_FIELD)),\n ),\n );\n\nconst nameNodeOf = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.fromNullishOr(node.childForFieldName(NAME_FIELD)),\n Option.orElse(() => implementedType(node)),\n );\n\nconst suffixesOf = (chain: readonly string[]): readonly string[] =>\n pipe(\n Arr.range(FIRST, chain.length - ONE),\n Arr.map((from) => Arr.join(Arr.drop(chain, from), SEPARATOR)),\n );\n\nconst childrenOf = (node: SyntaxNode): readonly SyntaxNode[] =>\n pipe(\n node.namedChildren,\n Arr.flatMap((child) => Option.toArray(Option.fromNullishOr(child))),\n );\n\nconst namesUnder = (node: SyntaxNode, enclosing: readonly string[]): readonly string[] => {\n const own = Option.map(nameNodeOf(node), ({ text }) => text);\n const chain = Option.match(own, {\n onNone: () => enclosing,\n onSome: (name) => [...enclosing, name],\n });\n const declared = Option.match(own, { onNone: () => [], onSome: () => suffixesOf(chain) });\n return [...declared, ...Arr.flatMap(childrenOf(node), (child) => namesUnder(child, chain))];\n};\n\nexport const declaredSymbols = Effect.fn(\"declaredSymbols\")(function* declaredSymbols(\n grammar: string,\n source: string,\n) {\n const language = yield* loadLanguage(grammar);\n return pipe(\n readTree({ language, source, read: (root) => HashSet.fromIterable(namesUnder(root, [])) }),\n Option.getOrElse(() => HashSet.empty<string>()),\n );\n});\n","import { Array as Arr, Effect, HashSet, Match, Option, Schema, String as Str, pipe } from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient, HttpClientError } from \"effect/http\";\n\nimport { githubToken, jsonLookup, publicLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport type { Lookup } from \"#/shared/lib/lookup.ts\";\n\nimport { declaredSymbols, grammarOf, supportedExtensions } from \"./declared-symbols.ts\";\nimport { NO_PATH } from \"./reference.ts\";\nimport type { GithubReference, NpmReference, Reference } from \"./reference.ts\";\n\nconst GITHUB = \"https://api.github.com/repos/\";\nconst NPM = \"https://registry.npmjs.org/\";\nconst RAW = \"application/vnd.github.raw+json\";\nconst ABBREVIATED = \"application/vnd.npm.install-v1+json\";\nconst NOT_FOUND = 404;\nconst MULTIPLE_CHOICES = 300;\nconst SEPARATOR = \"/\";\n\n/** @internal */\nexport type Outcome =\n | { readonly kind: \"found\" }\n | { readonly kind: \"broken\"; readonly reason: string }\n | { readonly kind: \"unchecked\"; readonly reason: string };\n\nconst found: Outcome = { kind: \"found\" };\nconst broken = (reason: string): Outcome => ({ kind: \"broken\", reason });\nconst unchecked = (reason: string): Outcome => ({ kind: \"unchecked\", reason });\n\nconst Repository = Schema.Struct({\n full_name: Schema.String,\n archived: Schema.Boolean,\n default_branch: Schema.String,\n});\nconst Version = Schema.Struct({ deprecated: Schema.optional(Schema.String) });\nconst Packument = Schema.Struct({\n \"dist-tags\": Schema.Struct({ latest: Schema.String }),\n versions: Schema.Record(Schema.String, Version),\n});\n\ntype Failure = HttpClientError.HttpClientError | Schema.SchemaError;\ntype Lookups = Effect.Effect<Outcome, Failure, HttpClient.HttpClient>;\n\nconst answered = (\n lookup: Lookup,\n missing: string,\n next: (response: HttpClientResponse.HttpClientResponse) => Lookups,\n): Lookups =>\n Effect.flatMap(sent(lookup), (response) => {\n if (response.status === NOT_FOUND) {\n return Effect.succeed(broken(missing));\n }\n if (response.status >= MULTIPLE_CHOICES) {\n return Effect.succeed(unchecked(`the lookup answered HTTP ${String(response.status)}`));\n }\n return next(response);\n });\n\nconst encodedPath = (path: string): string =>\n pipe(Str.split(path, SEPARATOR), Arr.map(encodeURIComponent), Arr.join(SEPARATOR));\n\nconst repositoryOutcome = (\n { owner, repo }: GithubReference,\n repository: typeof Repository.Type,\n): Outcome => {\n if (Str.toLowerCase(repository.full_name) !== Str.toLowerCase(`${owner}/${repo}`)) {\n return broken(`${owner}/${repo} has moved to ${repository.full_name}. Point at the new name.`);\n }\n if (repository.archived) {\n return broken(\n `${owner}/${repo} is archived. Point at the repository that replaced it, or drop the pointer.`,\n );\n }\n return found;\n};\n\nconst symbolOutcome = Effect.fn(\"symbolOutcome\")(function* symbolOutcome(\n { path }: GithubReference,\n symbol: string,\n source: string,\n) {\n const grammar = grammarOf(path);\n if (Option.isNone(grammar)) {\n return broken(\n `${path} is not a file msch can read symbols from. Drop #${symbol}, or point at a file with one of the extensions ${Arr.join(supportedExtensions, \", \")}.`,\n );\n }\n const declared = yield* Effect.option(declaredSymbols(grammar.value, source));\n return Option.match(declared, {\n onNone: () => unchecked(`the ${grammar.value} grammar could not read ${path}`),\n onSome: (names) => {\n if (HashSet.has(names, symbol)) {\n return found;\n }\n return broken(`${path} declares no ${symbol}. Fix the name or point at where it lives now.`);\n },\n });\n});\n\nconst pathOutcome = (\n reference: GithubReference,\n defaultBranch: string,\n token: Option.Option<string>,\n): Lookups => {\n const branch = Option.getOrElse(reference.ref, () => defaultBranch);\n const url = `${GITHUB}${reference.owner}/${reference.repo}/contents/${encodedPath(reference.path)}?ref=${encodeURIComponent(branch)}`;\n const missing = `${reference.path} does not exist on ${branch} of ${reference.owner}/${reference.repo}. Point at where it lives now.`;\n return Option.match(reference.symbol, {\n onNone: () => answered(jsonLookup({ url, token }), missing, () => Effect.succeed(found)),\n onSome: (symbol) =>\n answered({ url, token, accept: RAW }, missing, (response) =>\n response.text.pipe(Effect.flatMap((source) => symbolOutcome(reference, symbol, source))),\n ),\n });\n};\n\nconst repositoryStep =\n (reference: GithubReference, token: Option.Option<string>) =>\n (response: HttpClientResponse.HttpClientResponse): Lookups =>\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Repository)(response), (repository) => {\n const checked = repositoryOutcome(reference, repository);\n if (checked.kind !== \"found\" || reference.path === NO_PATH) {\n return Effect.succeed(checked);\n }\n return pathOutcome(reference, repository.default_branch, token);\n });\n\nconst githubOutcome = Effect.fn(\"githubOutcome\")(function* githubOutcome(\n reference: GithubReference,\n) {\n const token = yield* githubToken;\n const lookup = jsonLookup({ url: `${GITHUB}${reference.owner}/${reference.repo}`, token });\n const missing = `${reference.owner}/${reference.repo} does not exist, or the token in GH_TOKEN cannot read it.`;\n return yield* answered(lookup, missing, repositoryStep(reference, token));\n});\n\nconst deprecation = ({\n \"dist-tags\": tags,\n versions,\n}: typeof Packument.Type): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(versions[tags.latest]),\n Option.flatMap(({ deprecated }) => Option.fromNullishOr(deprecated)),\n );\n\nconst npmOutcome = ({ name }: NpmReference): Lookups =>\n answered(\n {\n ...publicLookup(`${NPM}${Str.replace(\"/\", \"%2f\")(name)}`),\n accept: ABBREVIATED,\n },\n `${name} is not published on npm.`,\n (response) =>\n Effect.map(HttpClientResponse.schemaBodyJson(Packument)(response), (packument) =>\n Option.match(deprecation(packument), {\n onNone: () => found,\n onSome: (message) => broken(`${name} is deprecated: ${message}`),\n }),\n ),\n );\n\n/** @internal */\nexport const resolveReference = (\n reference: Reference,\n): Effect.Effect<Outcome, never, HttpClient.HttpClient> =>\n Match.value(reference).pipe(\n Match.discriminatorsExhaustive(\"kind\")({ github: githubOutcome, npm: npmOutcome }),\n Effect.match({\n onFailure: (failure) => unchecked(`the lookup failed: ${String(failure)}`),\n onSuccess: (outcome) => outcome,\n }),\n );\n","import { Array as Arr, Effect, HashMap, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { linksIn, markdownTexts, referenceOf } from \"./reference-links.ts\";\nimport { describeReference } from \"./reference.ts\";\nimport type { Reference } from \"./reference.ts\";\nimport { resolveReference } from \"./resolve-reference.ts\";\nimport type { Outcome } from \"./resolve-reference.ts\";\n\nconst LOOKUP_CONCURRENCY = 4;\n\n/** @internal */\nexport interface UnresolvedReference {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n readonly outcome: \"broken\" | \"unchecked\";\n readonly reason: string;\n}\n\ninterface Occurrence {\n readonly file: string;\n readonly line: number;\n readonly reference: Reference;\n}\n\nconst occurrencesIn = (file: string, source: string): readonly Occurrence[] =>\n pipe(\n linksIn(source),\n Arr.flatMap(({ destination, index }) =>\n pipe(\n referenceOf(destination),\n Option.map((reference): Occurrence => ({\n file,\n line: positionOf(source)(index).line,\n reference,\n })),\n Option.toArray,\n ),\n ),\n );\n\ninterface Place {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n}\n\nconst unresolvedAt =\n (place: Place) =>\n (outcome: Outcome): Option.Option<UnresolvedReference> => {\n if (outcome.kind === \"found\") {\n return Option.none();\n }\n return Option.some({ ...place, outcome: outcome.kind, reason: outcome.reason });\n };\n\nconst unresolvedOf =\n (outcomes: HashMap.HashMap<string, Outcome>) =>\n ({ file, line, reference }: Occurrence): readonly UnresolvedReference[] => {\n const described = describeReference(reference);\n return pipe(\n outcomes,\n HashMap.get(described),\n Option.flatMap(unresolvedAt({ file, line, reference: described })),\n Option.toArray,\n );\n };\n\n/** @internal */\nexport const unresolvedReferences = Effect.fn(\"unresolvedReferences\")(\n function* unresolvedReferences(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* markdownTexts(root);\n const occurrences = pipe(\n texts,\n Arr.flatMap(({ file, source }) => occurrencesIn(files.relative(root, file), source)),\n );\n const distinct = pipe(\n occurrences,\n Arr.dedupeWith(\n (left, right) => describeReference(left.reference) === describeReference(right.reference),\n ),\n Arr.map(({ reference }) => reference),\n );\n const resolved = yield* Effect.forEach(\n distinct,\n (reference) =>\n Effect.map(\n resolveReference(reference),\n (outcome) => [describeReference(reference), outcome] as const,\n ),\n { concurrency: LOOKUP_CONCURRENCY },\n );\n const outcomes = HashMap.fromIterable(resolved);\n return pipe(occurrences, Arr.flatMap(unresolvedOf(outcomes)));\n },\n);\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { unresolvedReferences } from \"#/features/check-references/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n reference: Schema.String,\n outcome: Schema.Literals([\"broken\", \"unchecked\"]),\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst VERDICTS: Readonly<Record<RowType[\"outcome\"], string>> = {\n broken: \"is stale:\",\n unchecked: \"could not be checked:\",\n};\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.reference} ${VERDICTS[row.outcome]} ${row.reason}`;\n\nrunCli(lookupReport({ row: Row, rows: unresolvedReferences, describe: describeRow }));\n"],"mappings":";;;;;;;;;AAMA,MAAM,aAA+C;CACnD,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ,KAAK;CACL,IAAI;CACJ,KAAK;AACP;AACA,MAAM,iBAAiB;AACvB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAMA,cAAY;AAClB,MAAM,YAAY;AAClB,MAAM,QAAQ;AACd,MAAM,MAAM;AAEZ,MAAa,sBAAyCC,OAAI,KAAK,UAAU;AAEzE,MAAa,aAAa,SACxB,KACE,QAAQ,WAAW,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,GACzC,OAAO,SAAS,cAAcA,OAAI,IAAI,YAAY,SAAS,CAAC,CAC9D;AAEF,MAAM,mBAAmB,SACvB,KACE,OAAO,cAAc,OAAO,EAAE,WAAW,SAAS,cAAc,GAChE,OAAO,SAAS,mBACd,OAAO,cAAc,eAAe,kBAAkB,UAAU,CAAC,CACnE,CACF;AAEF,MAAM,cAAc,SAClB,KACE,OAAO,cAAc,KAAK,kBAAkB,UAAU,CAAC,GACvD,OAAO,aAAa,gBAAgB,IAAI,CAAC,CAC3C;AAEF,MAAM,cAAc,UAClB,KACEC,MAAI,MAAM,OAAO,MAAM,SAAS,GAAG,GACnCA,MAAI,KAAK,SAASA,MAAI,KAAKA,MAAI,KAAK,OAAO,IAAI,GAAGF,WAAS,CAAC,CAC9D;AAEF,MAAM,cAAc,SAClB,KACE,KAAK,eACLE,MAAI,SAAS,UAAU,OAAO,QAAQ,OAAO,cAAc,KAAK,CAAC,CAAC,CACpE;AAEF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AAC,GACjE,OAAO,OACT;AACF;;AAGF,MAAa,uBAAuB,OAAO,GAAG,sBAAsB,CAAC,CACnE,UAAU,qBAAqB,MAAc;CAC3C,MAAM,QAAQ,OAAO;CACrB,MAAM,QAAQ,OAAO,cAAc,IAAI;CACvC,MAAM,cAAc,KAClB,OACAA,MAAI,SAAS,EAAE,MAAM,aAAa,cAAc,MAAM,SAAS,MAAM,IAAI,GAAG,MAAM,CAAC,CACrF;CACA,MAAM,WAAW,KACf,aACAA,MAAI,YACD,MAAM,UAAU,kBAAkB,KAAK,SAAS,MAAM,kBAAkB,MAAM,SAAS,CAC1F,GACAA,MAAI,KAAK,EAAE,gBAAgB,SAAS,CACtC;CACA,MAAM,WAAW,OAAO,OAAO,QAC7B,WACC,cACC,OAAO,IACL,iBAAiB,SAAS,IACzB,YAAY,CAAC,kBAAkB,SAAS,GAAG,OAAO,CACrD,GACF,EAAE,aAAa,mBAAmB,CACpC;CACA,MAAM,WAAW,QAAQ,aAAa,QAAQ;CAC9C,OAAO,KAAK,aAAaA,MAAI,QAAQ,aAAa,QAAQ,CAAC,CAAC;AAC9D,CACF;;AC5FA,MAAM,MAAM,OAAO,OAAO;CACxB,MAAM,OAAO;CACb,MAAM,OAAO;CACb,WAAW,OAAO;CAClB,SAAS,OAAO,SAAS,CAAC,UAAU,WAAW,CAAC;CAChD,QAAQ,OAAO;AACjB,CAAC;AAID,MAAM,WAAyD;CAC7D,QAAQ;CACR,WAAW;AACb;AAEA,MAAM,eAAe,QACnB,GAAG,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,IAAI,UAAU,GAAG,SAAS,IAAI,SAAS,GAAG,IAAI;AAEnF,OAAO,aAAa;CAAE,KAAK;CAAK,MAAM;CAAsB,UAAU;AAAY,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"refs.mjs","names":["Arr","Str","SEPARATOR","Rec","Arr","Str","Arr","Arr"],"sources":["../src/features/check-references/model/markdown-texts.ts","../src/features/check-references/model/declared-symbols.ts","../src/features/check-references/model/resolve-reference.ts","../src/features/check-references/model/unresolved-references.ts","../bin/msch-refs.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst MARKDOWN = \".md\";\nconst FIXTURE = /(?:^|\\/)fixtures\\//u;\nconst READ_CONCURRENCY = 16;\n\n/** @internal */\nexport interface MarkdownText {\n readonly file: string;\n readonly source: string;\n}\n\n/** @internal */\nexport const markdownTexts = Effect.fn(\"markdownTexts\")(function* markdownTexts(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const documents = pipe(\n listed,\n Arr.filter((file) => Str.endsWith(MARKDOWN)(file) && !FIXTURE.test(file)),\n Arr.map((file) => files.join(root, file)),\n );\n const read = yield* Effect.forEach(\n documents,\n (file) =>\n Effect.map(\n files.readFile(file),\n Option.map((source): MarkdownText => ({ file, source })),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(read);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, HashSet, Option, Record as Rec, pipe } from \"effect\";\n\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { SyntaxNode } from \"#/shared/lib/tree-sitter.ts\";\n\nconst GRAMMAR_OF: Readonly<Record<string, string>> = {\n ts: \"typescript\",\n mts: \"typescript\",\n cts: \"typescript\",\n tsx: \"tsx\",\n js: \"javascript\",\n mjs: \"javascript\",\n cjs: \"javascript\",\n jsx: \"javascript\",\n rs: \"rust\",\n py: \"python\",\n go: \"go\",\n java: \"java\",\n rb: \"ruby\",\n php: \"php\",\n cs: \"c-sharp\",\n cpp: \"cpp\",\n};\nconst IMPLEMENTATION = \"impl_item\";\nconst NAME_FIELD = \"name\";\nconst TYPE_FIELD = \"type\";\nconst SEPARATOR = \".\";\nconst EXTENSION = /\\.(?<extension>[^./]+)$/u;\nconst FIRST = 0;\nconst ONE = 1;\n\nexport const supportedExtensions: readonly string[] = Rec.keys(GRAMMAR_OF);\n\nexport const grammarOf = (path: string): Option.Option<string> =>\n pipe(\n groupOf(\"extension\")(EXTENSION.exec(path)),\n Option.flatMap((extension) => Rec.get(GRAMMAR_OF, extension)),\n );\n\nconst implementedType = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.liftPredicate(node, ({ type }) => type === IMPLEMENTATION),\n Option.flatMap((implementation) =>\n Option.fromNullishOr(implementation.childForFieldName(TYPE_FIELD)),\n ),\n );\n\nconst nameNodeOf = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.fromNullishOr(node.childForFieldName(NAME_FIELD)),\n Option.orElse(() => implementedType(node)),\n );\n\nconst suffixesOf = (chain: readonly string[]): readonly string[] =>\n pipe(\n Arr.range(FIRST, chain.length - ONE),\n Arr.map((from) => Arr.join(Arr.drop(chain, from), SEPARATOR)),\n );\n\nconst childrenOf = (node: SyntaxNode): readonly SyntaxNode[] =>\n pipe(\n node.namedChildren,\n Arr.flatMap((child) => Option.toArray(Option.fromNullishOr(child))),\n );\n\nconst namesUnder = (node: SyntaxNode, enclosing: readonly string[]): readonly string[] => {\n const own = Option.map(nameNodeOf(node), ({ text }) => text);\n const chain = Option.match(own, {\n onNone: () => enclosing,\n onSome: (name) => [...enclosing, name],\n });\n const declared = Option.match(own, { onNone: () => [], onSome: () => suffixesOf(chain) });\n return [...declared, ...Arr.flatMap(childrenOf(node), (child) => namesUnder(child, chain))];\n};\n\nexport const declaredSymbols = Effect.fn(\"declaredSymbols\")(function* declaredSymbols(\n grammar: string,\n source: string,\n) {\n const language = yield* loadLanguage(grammar);\n return pipe(\n readTree({ language, source, read: (root) => HashSet.fromIterable(namesUnder(root, [])) }),\n Option.getOrElse(() => HashSet.empty<string>()),\n );\n});\n","import { NO_PATH } from \"@r_masseater/y8\";\nimport type { GithubReference, NpmReference, Reference } from \"@r_masseater/y8\";\nimport { Array as Arr, Effect, HashSet, Match, Option, Schema, String as Str, pipe } from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient, HttpClientError } from \"effect/http\";\n\nimport { githubToken, jsonLookup, publicLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport type { Lookup } from \"#/shared/lib/lookup.ts\";\n\nimport { declaredSymbols, grammarOf, supportedExtensions } from \"./declared-symbols.ts\";\n\nconst GITHUB = \"https://api.github.com/repos/\";\nconst NPM = \"https://registry.npmjs.org/\";\nconst RAW = \"application/vnd.github.raw+json\";\nconst ABBREVIATED = \"application/vnd.npm.install-v1+json\";\nconst NOT_FOUND = 404;\nconst MULTIPLE_CHOICES = 300;\nconst SEPARATOR = \"/\";\nconst LATEST = \"latest\";\n\n/** @internal */\nexport type Outcome =\n | { readonly kind: \"found\" }\n | { readonly kind: \"broken\"; readonly reason: string }\n | { readonly kind: \"unchecked\"; readonly reason: string };\n\nconst found: Outcome = { kind: \"found\" };\nconst broken = (reason: string): Outcome => ({ kind: \"broken\", reason });\nconst unchecked = (reason: string): Outcome => ({ kind: \"unchecked\", reason });\n\nconst Repository = Schema.Struct({\n full_name: Schema.String,\n archived: Schema.Boolean,\n default_branch: Schema.String,\n});\nconst Version = Schema.Struct({ deprecated: Schema.optional(Schema.String) });\nconst Packument = Schema.Struct({\n \"dist-tags\": Schema.Record(Schema.String, Schema.String),\n versions: Schema.Record(Schema.String, Version),\n});\n\ntype Failure = HttpClientError.HttpClientError | Schema.SchemaError;\ntype Lookups = Effect.Effect<Outcome, Failure, HttpClient.HttpClient>;\n\nconst answered = (\n lookup: Lookup,\n missing: string,\n next: (response: HttpClientResponse.HttpClientResponse) => Lookups,\n): Lookups =>\n Effect.flatMap(sent(lookup), (response) => {\n if (response.status === NOT_FOUND) {\n return Effect.succeed(broken(missing));\n }\n if (response.status >= MULTIPLE_CHOICES) {\n return Effect.succeed(unchecked(`the lookup answered HTTP ${String(response.status)}`));\n }\n return next(response);\n });\n\nconst encodedPath = (path: string): string =>\n pipe(Str.split(path, SEPARATOR), Arr.map(encodeURIComponent), Arr.join(SEPARATOR));\n\nconst repositoryOutcome = (\n { owner, repo }: GithubReference,\n repository: typeof Repository.Type,\n): Outcome => {\n if (Str.toLowerCase(repository.full_name) !== Str.toLowerCase(`${owner}/${repo}`)) {\n return broken(`${owner}/${repo} has moved to ${repository.full_name}. Point at the new name.`);\n }\n if (repository.archived) {\n return broken(\n `${owner}/${repo} is archived. Point at the repository that replaced it, or drop the pointer.`,\n );\n }\n return found;\n};\n\nconst symbolOutcome = Effect.fn(\"symbolOutcome\")(function* symbolOutcome(\n { path }: GithubReference,\n symbol: string,\n source: string,\n) {\n const grammar = grammarOf(path);\n if (Option.isNone(grammar)) {\n return broken(\n `${path} is not a file msch can read symbols from. Drop #${symbol}, or point at a file with one of the extensions ${Arr.join(supportedExtensions, \", \")}.`,\n );\n }\n const declared = yield* Effect.option(declaredSymbols(grammar.value, source));\n return Option.match(declared, {\n onNone: () => unchecked(`the ${grammar.value} grammar could not read ${path}`),\n onSome: (names) => {\n if (HashSet.has(names, symbol)) {\n return found;\n }\n return broken(`${path} declares no ${symbol}. Fix the name or point at where it lives now.`);\n },\n });\n});\n\nconst repositoryContentsOutcome = (\n reference: GithubReference,\n repository: typeof Repository.Type,\n token: Option.Option<string>,\n): Lookups => {\n const checked = repositoryOutcome(reference, repository);\n if (checked.kind !== \"found\" || reference.path === NO_PATH) {\n return Effect.succeed(checked);\n }\n const branch = Option.getOrElse(reference.ref, () => repository.default_branch);\n const url = `${GITHUB}${reference.owner}/${reference.repo}/contents/${encodedPath(reference.path)}?ref=${encodeURIComponent(branch)}`;\n const missing = `${reference.path} does not exist on ${branch} of ${reference.owner}/${reference.repo}. Point at where it lives now.`;\n return Option.match(reference.symbol, {\n onNone: () => answered(jsonLookup({ url, token }), missing, () => Effect.succeed(found)),\n onSome: (symbol) =>\n answered({ url, token, accept: RAW }, missing, (response) =>\n response.text.pipe(Effect.flatMap((source) => symbolOutcome(reference, symbol, source))),\n ),\n });\n};\n\nconst githubOutcome = Effect.fn(\"githubOutcome\")(function* githubOutcome(\n reference: GithubReference,\n) {\n const token = yield* githubToken;\n const lookup = jsonLookup({ url: `${GITHUB}${reference.owner}/${reference.repo}`, token });\n const missing = `${reference.owner}/${reference.repo} does not exist, or the token in GH_TOKEN cannot read it.`;\n return yield* answered(lookup, missing, (response) =>\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Repository)(response), (repository) =>\n repositoryContentsOutcome(reference, repository, token),\n ),\n );\n});\n\nconst versionOf = (\n { \"dist-tags\": tags }: typeof Packument.Type,\n requested: Option.Option<string>,\n): Option.Option<string> =>\n Option.match(requested, {\n onNone: () => Option.fromNullishOr(tags[LATEST]),\n onSome: (asked) =>\n Option.some(Option.getOrElse(Option.fromNullishOr(tags[asked]), () => asked)),\n });\n\nconst versionOutcome = (\n { name, version }: NpmReference,\n packument: typeof Packument.Type,\n): Outcome =>\n Option.match(versionOf(packument, version), {\n onNone: () => broken(`${name} has no ${LATEST} tag.`),\n onSome: (resolved) =>\n Option.match(Option.fromNullishOr(packument.versions[resolved]), {\n onNone: () => broken(`${name}@${resolved} is not published on npm.`),\n onSome: ({ deprecated }) =>\n Option.match(Option.fromNullishOr(deprecated), {\n onNone: () => found,\n onSome: (message) => broken(`${name}@${resolved} is deprecated: ${message}`),\n }),\n }),\n });\n\nconst npmOutcome = (reference: NpmReference): Lookups =>\n answered(\n {\n ...publicLookup(`${NPM}${Str.replace(\"/\", \"%2f\")(reference.name)}`),\n accept: ABBREVIATED,\n },\n `${reference.name} is not published on npm.`,\n (response) =>\n Effect.map(HttpClientResponse.schemaBodyJson(Packument)(response), (packument) =>\n versionOutcome(reference, packument),\n ),\n );\n\n/** @internal */\nexport const resolveReference = (\n reference: Reference,\n): Effect.Effect<Outcome, never, HttpClient.HttpClient> =>\n Match.value(reference).pipe(\n Match.discriminatorsExhaustive(\"kind\")({ github: githubOutcome, npm: npmOutcome }),\n Effect.match({\n onFailure: (failure) => unchecked(`the lookup failed: ${String(failure)}`),\n onSuccess: (outcome) => outcome,\n }),\n );\n","import { describeReference, linksIn, referenceOf } from \"@r_masseater/y8\";\nimport type { LinkAt, Reference } from \"@r_masseater/y8\";\nimport { Array as Arr, Effect, HashMap, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { markdownTexts } from \"./markdown-texts.ts\";\nimport { resolveReference } from \"./resolve-reference.ts\";\nimport type { Outcome } from \"./resolve-reference.ts\";\n\nconst LOOKUP_CONCURRENCY = 4;\n\n/** @internal */\nexport interface UnresolvedReference {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n readonly outcome: \"broken\" | \"unchecked\";\n readonly reason: string;\n}\n\ninterface Occurrence {\n readonly file: string;\n readonly line: number;\n readonly reference: Reference;\n}\n\nconst occurrencesIn = (links: readonly LinkAt[]): readonly Occurrence[] =>\n pipe(\n links,\n Arr.flatMap(({ path, line, destination }) =>\n pipe(\n referenceOf(destination),\n Option.map((reference): Occurrence => ({ file: path, line, reference })),\n Option.toArray,\n ),\n ),\n );\n\ninterface Place {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n}\n\nconst unresolvedAt =\n (place: Place) =>\n (outcome: Outcome): Option.Option<UnresolvedReference> => {\n if (outcome.kind === \"found\") {\n return Option.none();\n }\n return Option.some({ ...place, outcome: outcome.kind, reason: outcome.reason });\n };\n\nconst unresolvedOf =\n (outcomes: HashMap.HashMap<string, Outcome>) =>\n ({ file, line, reference }: Occurrence): readonly UnresolvedReference[] => {\n const described = describeReference(reference);\n return pipe(\n outcomes,\n HashMap.get(described),\n Option.flatMap(unresolvedAt({ file, line, reference: described })),\n Option.toArray,\n );\n };\n\n/** @internal */\nexport const unresolvedReferences = Effect.fn(\"unresolvedReferences\")(\n function* unresolvedReferences(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* markdownTexts(root);\n const links = yield* linksIn(\n pipe(\n texts,\n Arr.map(({ file, source }) => ({ path: files.relative(root, file), text: source })),\n ),\n );\n const occurrences = occurrencesIn(links);\n const distinct = pipe(\n occurrences,\n Arr.dedupeWith(\n (left, right) => describeReference(left.reference) === describeReference(right.reference),\n ),\n Arr.map(({ reference }) => reference),\n );\n const resolved = yield* Effect.forEach(\n distinct,\n (reference) =>\n Effect.map(\n resolveReference(reference),\n (outcome) => [describeReference(reference), outcome] as const,\n ),\n { concurrency: LOOKUP_CONCURRENCY },\n );\n const outcomes = HashMap.fromIterable(resolved);\n return pipe(occurrences, Arr.flatMap(unresolvedOf(outcomes)));\n },\n);\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { unresolvedReferences } from \"#/features/check-references/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n reference: Schema.String,\n outcome: Schema.Literals([\"broken\", \"unchecked\"]),\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst VERDICTS: Readonly<Record<RowType[\"outcome\"], string>> = {\n broken: \"is stale:\",\n unchecked: \"could not be checked:\",\n};\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.reference} ${VERDICTS[row.outcome]} ${row.reason}`;\n\nrunCli(lookupReport({ row: Row, rows: unresolvedReferences, describe: describeRow }));\n"],"mappings":";;;;;;;;;;AAIA,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,mBAAmB;;AASzB,MAAa,gBAAgB,OAAO,GAAG,eAAe,CAAC,CAAC,UAAU,cAAc,MAAc;CAC5F,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,OAAO,MAAM,YAAY,IAAI;CAC5C,MAAM,YAAY,KAChB,QACAA,MAAI,QAAQ,SAASC,SAAI,SAAS,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,GACxED,MAAI,KAAK,SAAS,MAAM,KAAK,MAAM,I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AC;AAID,MAAM,WAAyD;CAC7D,QAAQ;CACR,WAAW;AACb;AAEA,MAAM,eAAe,QACnB,GAAG,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,IAAI,UAAU,GAAG,SAAS,IAAI,SAAS,GAAG,IAAI;AAEnF,OAAO,aAAa;CAAE,KAAK;CAAK,MAAM;CAAsB,UAAU;AAAY,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Array, Context, Effect, FileSystem, Layer, Option, Path, Stream, String, pipe } from "effect";
|
|
1
|
+
import { Array, Context, Effect, FileSystem, Layer, Option, Order, Path, Stream, String, pipe } from "effect";
|
|
2
2
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
3
3
|
import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
|
|
4
4
|
import { Digest } from "effect/crypto";
|
|
5
|
-
|
|
5
|
+
Order.mapInput(String.Order, ([key]) => key);
|
|
6
6
|
const groupOf = (name) => (found) => pipe(Option.fromNullishOr(found), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups[name])));
|
|
7
7
|
// src/shared/lib/repository-files.ts
|
|
8
8
|
/** @internal */
|
|
@@ -123,4 +123,4 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
|
|
|
123
123
|
})).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
|
|
124
124
|
export { groupOf as a, nodeServicesLayer as i, RepositoryFiles as n, nodeRepositoryFiles as r, NODE_MODULES as t };
|
|
125
125
|
|
|
126
|
-
//# sourceMappingURL=repository-files-
|
|
126
|
+
//# sourceMappingURL=repository-files-mOPItI5o.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-files-mOPItI5o.mjs","names":["Str","Str","Arr"],"sources":["../../lint-host/src/shared/lib/collections.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import { Array as Arr, Option, Order, Record as Rec, String as Str, pipe } from \"effect\";\n\nconst byKey = Order.mapInput(Str.Order, ([key]: readonly [string, unknown]) => key);\n\nexport const sortedRecord = <Value>(\n entries: readonly (readonly [string, Value])[],\n): Readonly<Record<string, Value>> => Rec.fromEntries(Arr.sort(entries, byKey));\n\nconst NEXT = 1;\n\nexport interface Grouped<Head, Item> {\n readonly head: Head;\n readonly items: readonly Item[];\n}\n\nexport const groupedUnder =\n <Item, Head>(asHead: (item: Item) => Option.Option<Head>) =>\n (closes: (head: Head, item: Item) => boolean) =>\n (items: readonly Item[]): readonly Grouped<Head, Item>[] =>\n pipe(\n items,\n Arr.flatMap((item, index) =>\n pipe(\n asHead(item),\n Option.map((head): Grouped<Head, Item> => ({\n head,\n items: pipe(\n items,\n Arr.drop(index + NEXT),\n Arr.takeWhile((next) => !closes(head, next)),\n ),\n })),\n Option.toArray,\n ),\n ),\n );\n\nexport const ancestorsBy =\n <Node>(parentOf: (node: Node) => Option.Option<Node>) =>\n (node: Node): readonly Node[] =>\n Arr.unfold(parentOf(node), (current) =>\n pipe(\n current,\n Option.map((found) => [found, parentOf(found)] as const),\n ),\n );\n\nexport const groupOf =\n (name: string) =>\n (found: RegExpMatchArray | null): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(found),\n Option.flatMap((match) => Option.fromNullishOr(match.groups)),\n Option.flatMap((groups) => Option.fromNullishOr(groups[name])),\n );\n","import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Digest } from \"effect/crypto\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\nconst MISSING_SIZE = 0;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst OWNED_PATHSPECS = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\nexport const NODE_MODULES = \"node_modules\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\", `--exclude=${NODE_MODULES}/`];\nconst IGNORED_ARGS = [\"--others\", \"--ignored\", \"--exclude-standard\"];\nconst TRACKED_ARGS = [\"--cached\"];\nconst STAGED_ARGS = [\"--stage\"];\nconst LINK_ENTRY = /^120000 \\S+ \\d+\\t(?<name>.+)$/u;\n\nexport class RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly walkDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly writeFile: (file: string, text: string) => Effect.Effect<void>;\n readonly removeFile: (file: string) => Effect.Effect<void>;\n readonly hash: (text: string) => Effect.Effect<string>;\n readonly hashFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly ownedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly linkedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly readLink: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly mergeBase: (root: string, revision: string) => Effect.Effect<Option.Option<string>>;\n readonly readAtRevision: (\n root: string,\n revision: string,\n name: string,\n ) => Effect.Effect<Option.Option<string>>;\n readonly matchingFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly trackedFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredPaths: (\n root: string,\n paths: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/shared/lib/repository-files/RepositoryFiles\") {}\n\nconst SUCCESS = 0;\n\ntype GitText = (root: string, args: readonly string[]) => Effect.Effect<Option.Option<string>>;\n\nconst gitTextService = Effect.gen(function* gitTextService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitText: GitText = (root, args) =>\n Effect.gen(function* readText() {\n const handle = yield* ChildProcess.make(\"git\", args, { cwd: root, stdin: \"ignore\" });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return Option.liftPredicate(text, () => code === SUCCESS);\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return gitText;\n});\n\ntype GitPaths = (\n root: string,\n args: readonly string[],\n separator: string,\n) => Effect.Effect<readonly string[]>;\n\nconst gitPathsService = Effect.gen(function* gitPathsService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitPaths: GitPaths = (root, args, separator) =>\n Effect.gen(function* listPaths() {\n const handle = yield* ChildProcess.make(\"git\", args, {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, separator), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return gitPaths;\n});\n\nconst linkName = (entry: string): readonly string[] =>\n Option.toArray(groupOf(\"name\")(LINK_ENTRY.exec(entry)));\n\ntype CacheOperations = Pick<\n typeof RepositoryFiles.Service,\n \"walkDirectory\" | \"writeFile\" | \"removeFile\" | \"hash\" | \"hashFile\"\n>;\n\nconst encoder = new TextEncoder();\n\nconst cacheOperations = (\n fs: FileSystem.FileSystem,\n path: Path.Path,\n digest: Digest.Digest[\"Service\"],\n): CacheOperations => ({\n walkDirectory: (directory) =>\n fs\n .readDirectory(directory, { recursive: true })\n .pipe(Effect.orElseSucceed((): readonly string[] => [])),\n writeFile: (file, text) =>\n fs\n .makeDirectory(path.dirname(file), { recursive: true })\n .pipe(Effect.andThen(fs.writeFileString(file, text)), Effect.ignore),\n removeFile: (file) => fs.remove(file, { force: true }).pipe(Effect.ignore),\n hash: (text) => digest.digestHex(Digest.sha256, encoder.encode(text)),\n hashFile: (file) =>\n fs.readFile(file).pipe(\n Effect.flatMap((bytes) => digest.digestHex(Digest.sha256, bytes)),\n Effect.option,\n ),\n});\n\nexport const nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const digest = yield* Digest.Digest;\n const gitPaths = yield* gitPathsService;\n const gitText = yield* gitTextService;\n const gitFiles = (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n gitPaths(root, [\"ls-files\", \"-z\", ...args], \"\\0\");\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n listedFiles: (root) => gitFiles(root, LISTED_ARGS),\n ownedFiles: (root) => gitFiles(root, [...LISTED_ARGS, \"--\", ...OWNED_PATHSPECS]),\n linkedFiles: (root) => gitFiles(root, STAGED_ARGS).pipe(Effect.map(Arr.flatMap(linkName))),\n readLink: (file) => fs.readLink(file).pipe(Effect.option),\n mergeBase: (root, revision) =>\n gitText(root, [\"merge-base\", \"HEAD\", revision]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n readAtRevision: (root, revision, name) => gitText(root, [\"show\", `${revision}:${name}`]),\n matchingFiles: (root, pathspecs) => gitFiles(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n trackedFiles: (root, pathspecs) => gitFiles(root, [...TRACKED_ARGS, \"--\", ...pathspecs]),\n ignoredFiles: (root, pathspecs) => gitFiles(root, [...IGNORED_ARGS, \"--\", ...pathspecs]),\n ignoredPaths: (root, paths) => gitPaths(root, [\"check-ignore\", \"--\", ...paths], \"\\n\"),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n ...cacheOperations(fs, path, digest),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));\n"],"mappings":";;;;AAEc,MAAM,SAASA,OAAI,QAAQ,CAAC,SAAqC,GAAG;AA6ClF,MAAa,WACV,UACA,UACC,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,SAAS,UAAU,OAAO,cAAc,MAAM,MAAM,CAAC,GAC5D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MAAM;EAC9D,SAAS,SAAS,GAAG,OAAO,IAAI,CAAC,CAAC,KAAK,OAAO,oBAAoB,KAAK,CAAC;EACxE,WAAW,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,OAAO,oBAAoB,IAAI,CAAC;EAC3E,gBAAgB,cACd,GAAG,cAAc,SAAS,CAAC,CAAC,KAAK,OAAO,oBAAuC,CAAC,CAAC,CAAC;EACpF,GAAG,gBAAgB,IAAI,MAAM,MAAM;EACnC,cAAc,SACZ,GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,KAAK,SAAS,WAAW,GAC9C,OAAO,MACT;EACF,WAAW,SACT,GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,OAAO,KAAK,IAAI,CAAC,GACtC,OAAO,oBAAoB,YAAY,CACzC;EACF,OAAO,GAAG,aAAa,KAAK,KAAK,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as nodeRepositoryFiles } from "./repository-files-
|
|
1
|
+
import { r as nodeRepositoryFiles } from "./repository-files-mOPItI5o.mjs";
|
|
2
2
|
import { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from "effect";
|
|
3
3
|
import { FetchHttpClient } from "effect/http";
|
|
4
4
|
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
@@ -42,4 +42,4 @@ const runCli = (program) => {
|
|
|
42
42
|
};
|
|
43
43
|
export { ProblemsFound as n, writeStdout as r, runCli as t };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=runtime-
|
|
45
|
+
//# sourceMappingURL=runtime-mDBC8Yey.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-
|
|
1
|
+
{"version":3,"file":"runtime-mDBC8Yey.mjs","names":["nodeServices"],"sources":["../src/app/output.ts","../../node-main/src/features/run-main/model/run-main.ts","../src/app/runtime.ts"],"sourcesContent":["import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n","import { runMain as nodeRuntimeRunMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport type { NodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, Layer, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\n\n/** @internal */\nexport type Platform = NodeServices | HttpClient.HttpClient;\n\n/** @internal */\nexport type Run<Provided> = <Success, Failure>(\n program: Effect.Effect<Success, Failure, Platform | Provided>,\n) => void;\n\n/** @internal */\nexport type Report<Provided> = <Failure>(\n cause: Cause.Cause<Failure>,\n) => Effect.Effect<void, never, Platform | Provided>;\n\nconst platform = Layer.mergeAll(nodeServices, FetchHttpClient.layer);\n\nconst runWithTracingAnd =\n <Provided, LayerFailure>({\n serviceName,\n services,\n onFailure,\n }: Readonly<{\n serviceName: string;\n services: Layer.Layer<Provided, LayerFailure, Platform>;\n onFailure?: Report<Provided>;\n }>): Run<Provided> =>\n (program) => {\n const tracing = Otlp.layerFromConfig({ resource: { serviceName } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n );\n const provided = Layer.provideMerge(services, platform);\n const report = Option.fromNullishOr(onFailure);\n const reported = Option.match(report, {\n onNone: () => program,\n onSome: (handler) => Effect.tapCause(program, handler),\n });\n nodeRuntimeRunMain(\n Layer.mergeAll(tracing, provided).pipe(\n Layer.build,\n Effect.flatMap((context) => Effect.provideContext(reported, context)),\n Effect.scoped,\n ),\n { disableErrorReporting: Option.isSome(report) },\n );\n };\n\nconst runWithTracing = (serviceName: string): Run<never> =>\n runWithTracingAnd({ serviceName, services: Layer.empty });\n\n/** @internal */\nexport const runMainWith = runWithTracingAnd;\n\n/** @internal */\nexport const runMain = runWithTracing;\n","import { runMainWith } from \"@r_masseater/node-main\";\nimport { Cause, Effect, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport type { HttpClient } from \"effect/http\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\n/** @internal */\nexport const runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n | HttpClient.HttpClient\n >,\n): void => {\n runMainWith({\n serviceName: \"msch\",\n services: nodeRep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AG,MAAM,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AAC9F,CAAC;;AAGH,MAAa,UACX,YAUS;CACT,YAAY;EACV,aAAa;EACb,UAAU;EACV,WAAW;CACb,CAAC,CAAC,CAAC,OAAO;AACZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as NODE_MODULES } from "./repository-files-
|
|
1
|
+
import { t as NODE_MODULES } from "./repository-files-mOPItI5o.mjs";
|
|
2
2
|
import { Array, Option, String, pipe } from "effect";
|
|
3
3
|
import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
|
|
4
4
|
import { isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBlock, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportAssignment, isExportDeclaration, isExpressionStatement, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isLiteralTypeNode, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, isPropertySignatureDeclaration, isReturnStatement, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
|
|
@@ -80,4 +80,4 @@ const moduleSpecifierOf = (statement) => {
|
|
|
80
80
|
const importedModulesOf = (sourceFile) => pipe(sourceFile.statements, Array.map((statement) => moduleSpecifierOf(statement)), Array.getSomes);
|
|
81
81
|
export { isPropertyAccessExpression as $, getNameOfDeclaration as A, isExportDeclaration as B, IndexKind as C, SyntaxKind as D, SymbolFlags$1 as E, isBlock as F, isImportDeclaration as G, isFunctionDeclaration as H, isCallExpression as I, isModuleDeclaration as J, isInterfaceDeclaration as K, isClassDeclaration as L, isArrayLiteralExpression as M, isArrowFunction as N, getJSDocTags as O, isBinaryExpression as P, isParenthesizedExpression as Q, isElementAccessExpression as R, API as S, SignatureKind as T, isFunctionExpression as U, isExpressionStatement as V, isIdentifier as W, isNumericLiteral as X, isNewExpression as Y, isObjectLiteralExpression as Z, referencedSymbols as _, declarationsOf as a, isSpreadElement as at, symbolAtLocation as b, importedModulesOf as c, isTypeLiteralNode as ct, isInsideAny as d, isVariableDeclaration as dt, isPropertyAssignment as et, isOutsideDeclaration as f, isVariableDeclarationList as ft, propertyNamesOf as g, packageOf as h, contains as i, isSourceFile as it, getTextOfJSDocComment as j, getLeadingCommentRanges as k, isExternalDeclaration as l, isTypeReferenceNode as lt, lineOf as m, childrenOf as n, isSatisfiesExpression as nt, declaresAType as o, isStringLiteral as ot, isTypeDeclaration as p, isVariableStatement as pt, isModuleBlock as q, columnOf as r, isSignatureDeclaration as rt, descendantsOf as s, isTypeAliasDeclaration as st, carriesTag as t, isReturnStatement as tt, isGenericDeclaration as u, isUnionTypeNode as ut, resolvedSymbol as v, InternalSymbolName as w, uniqueByReference as x, symbolAt as y, isEnumDeclaration as z };
|
|
82
82
|
|
|
83
|
-
//# sourceMappingURL=syntax-
|
|
83
|
+
//# sourceMappingURL=syntax-A3ga4Ksb.mjs.map
|