@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies-B6p7x90y.mjs","names":["MANIFEST_FILE","Str","Arr","Rec","Arr","Str"],"sources":["../src/entities/workspace/model/workspace-unreadable.ts","../src/entities/workspace/model/workspace-manifest.ts","../src/entities/workspace/model/workspace-projects.ts","../src/entities/package/model/dependencies.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class WorkspaceUnreadable extends taggedError<\n WorkspaceUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceUnreadable\", { root: Schema.String, reason: Schema.String }) {}\n","import { readWorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-reader\";\nimport type { WorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-reader\";\nimport { Effect, Option } from \"effect\";\n\nimport { WorkspaceUnreadable } from \"./workspace-unreadable.ts\";\n\n/** @internal */\nexport const workspaceManifest = (root: string): Effect.Effect<Option.Option<WorkspaceManifest>> =>\n Effect.tryPromise({\n try: () => readWorkspaceManifest(root),\n catch: (cause) => WorkspaceUnreadable.make({ root, reason: String(cause) }),\n }).pipe(\n Effect.map(Option.fromUndefinedOr),\n Effect.orElseSucceed(() => Option.none()),\n );\n","import { findWorkspaceProjectsNoCheck } from \"@pnpm/workspace.projects-reader\";\nimport type { Project } from \"@pnpm/workspace.projects-reader\";\nimport { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceManifest } from \"./workspace-manifest.ts\";\nimport { WorkspaceUnreadable } from \"./workspace-unreadable.ts\";\n\nconst MANIFEST_FILE = \"package.json\";\nconst ROOT_DIRECTORY = \"\";\n\nexport interface WorkspaceProject {\n readonly directory: string;\n readonly packageName: Option.Option<string>;\n readonly description: Option.Option<string>;\n readonly published: boolean;\n readonly keywords: readonly string[];\n readonly files: Option.Option<readonly string[]>;\n}\n\nconst byDirectory = Order.mapInput(Str.Order, ({ directory }: WorkspaceProject) => directory);\n\nconst projectsMatching = (\n root: string,\n patterns: readonly string[],\n): Effect.Effect<readonly Project[]> =>\n Effect.tryPromise({\n try: () => findWorkspaceProjectsNoCheck(root, { patterns: [...patterns] }),\n catch: (cause) => WorkspaceUnreadable.make({ root, reason: String(cause) }),\n }).pipe(Effect.orElseSucceed((): readonly Project[] => []));\n\n/** @internal */\nexport const workspaceProjects = Effect.fn(\"workspaceProjects\")(function* workspaceProjects(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* workspaceManifest(root);\n const patterns = pipe(\n manifest,\n Option.flatMap(({ packages }) => Option.fromNullishOr(packages)),\n Option.getOrElse((): readonly string[] => []),\n );\n if (!Arr.isReadonlyArrayNonEmpty(patterns)) {\n return [];\n }\n const projects = yield* projectsMatching(root, patterns);\n const found = pipe(\n projects,\n Arr.map(({ rootDir, manifest: own }): WorkspaceProject => ({\n directory: files.relative(root, rootDir),\n packageName: Option.fromUndefinedOr(own.name),\n description: Option.filter(Option.fromUndefinedOr(own.description), Str.isNonEmpty),\n published: own.private !== true,\n keywords: Option.getOrElse(Option.fromUndefinedOr(own.keywords), () => []),\n files: Option.fromUndefinedOr(own.files),\n })),\n Arr.filter(({ directory }) => Str.isNonEmpty(directory)),\n );\n return Arr.sort(found, byDirectory);\n});\n\n/** @internal */\nexport const workspaceDirectories = Effect.fn(\"workspaceDirectories\")(\n function* workspaceDirectories(root: string) {\n const projects = yield* workspaceProjects(root);\n return pipe(\n projects,\n Arr.map(({ directory }) => directory),\n );\n },\n);\n\nconst Strings = Schema.Array(Schema.String);\nconst RootManifest = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n description: Schema.optional(Schema.String),\n private: Schema.optional(Schema.Boolean),\n keywords: Schema.optional(Strings),\n files: Schema.optional(Strings),\n }),\n);\n\nconst rootProject = Effect.fn(\"rootProject\")(function* rootProject(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(Schema.decodeOption(RootManifest)),\n Option.map((own): WorkspaceProject => ({\n directory: ROOT_DIRECTORY,\n packageName: Option.some(own.name),\n description: Option.filter(Option.fromUndefinedOr(own.description), Str.isNonEmpty),\n published: own.private !== true,\n keywords: own.keywords ?? [],\n files: Option.fromUndefinedOr(own.files),\n })),\n );\n});\n\n/** @internal */\nexport const publishedProjects = Effect.fn(\"publishedProjects\")(function* publishedProjects(\n root: string,\n) {\n const [own, members] = yield* Effect.all([rootProject(root), workspaceProjects(root)], {\n concurrency: \"unbounded\",\n });\n return pipe(\n Option.toArray(own),\n Arr.appendAll(members),\n Arr.filter(({ published }) => published),\n );\n});\n","import {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Schema,\n String as Str,\n Record as Rec,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles, NODE_MODULES } from \"#/shared/lib/repository-files.ts\";\n\nexport interface DependencyEntry {\n readonly packageName: string;\n readonly specifier: string;\n readonly declarationsPath: string;\n}\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\n\nconst PackageManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: DependencyMap,\n devDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n exports: Schema.optional(Schema.Unknown),\n types: Schema.optional(Schema.String),\n typings: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n native: Schema.optional(Schema.Unknown),\n});\n\nexport type Manifest = typeof PackageManifest.Type;\n\nexport const MANIFEST_FILE = \"package.json\";\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst ROOT_SUBPATH = \".\";\nconst SUBPATH_PREFIX = \"./\";\nconst WILDCARD = \"*\";\nconst TYPES_CONDITION = \"types\";\nconst TYPES_SCOPE = \"@types/\";\nconst TYPES_SCOPE_SEPARATOR = \"__\";\nconst CONDITION_DEPTH_LIMIT = 8;\nconst ROOT_DEPTH = 0;\nconst DEPTH_STEP = 1;\nconst DECLARATIONS_SUFFIX = /\\.d\\.[cm]?ts$|\\.[cm]?tsx?$/u;\nconst SCRIPT_SUFFIX = /\\.(?<module>[cm]?)js$/u;\n\nexport const readManifest = Effect.fn(\"readManifest\")(function* readManifest(directory: string) {\n const files = yield* RepositoryFiles;\n const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const text = yield* Effect.fromOption(manifestText);\n return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);\n}, Effect.option);\n\nconst conditionsOf = (held: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(held)) {\n return [];\n }\n return Rec.toEntries(held);\n};\n\nconst typesConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n const entries = conditionsOf(held);\n const declared = Arr.findFirst(entries, ([condition, target]) =>\n Option.liftPredicate(\n target,\n (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate),\n ),\n ).pipe(Option.filter(Predicate.isString));\n return Option.orElse(declared, () =>\n Arr.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)),\n );\n};\n\nconst anyConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (Predicate.isString(held)) {\n return Option.some(held);\n }\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n return Arr.findFirst(conditionsOf(held), ([, nested]) =>\n anyConditionIn(nested, depth + DEPTH_STEP),\n );\n};\n\nconst targetPathsOf = (target: unknown): readonly string[] =>\n Arr.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);\n\ninterface SubpathTarget {\n readonly subpath: string;\n readonly target: unknown;\n}\n\nconst subpathTargetsOf = (exportsField: unknown): readonly SubpathTarget[] => {\n if (Predicate.isString(exportsField)) {\n return [{ subpath: ROOT_SUBPATH, target: exportsField }];\n }\n const entries = conditionsOf(exportsField);\n if (\n !pipe(\n entries,\n Arr.some(([subpath]) => Str.startsWith(ROOT_SUBPATH)(subpath)),\n )\n ) {\n return Arr.match(entries, {\n onEmpty: () => [],\n onNonEmpty: () => [{ subpath: ROOT_SUBPATH, target: exportsField }],\n });\n }\n return pipe(\n entries,\n Arr.filter(([subpath]) => subpath === ROOT_SUBPATH || Str.startsWith(SUBPATH_PREFIX)(subpath)),\n Arr.filter(([subpath]) => !Str.includes(WILDCARD)(subpath)),\n Arr.map(([subpath, target]) => ({ subpath, target })),\n );\n};\n\nconst declarationsCandidateFor = (entryPath: string): Option.Option<string> => {\n if (DECLARATIONS_SUFFIX.test(entryPath)) {\n return Option.some(entryPath);\n }\n if (!SCRIPT_SUFFIX.test(entryPath)) {\n return Option.none();\n }\n return Option.some(Str.replace(SCRIPT_SUFFIX, \".d.$<module>ts\")(entryPath));\n};\n\nconst firstDeclarationsAmong = Effect.fn(\"firstDeclarationsAmong\")(function* firstDeclarations(\n directory: string,\n entryPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const candidates = Arr.getSomes(\n pipe(\n entryPaths,\n Arr.map((entryPath) => declarationsCandidateFor(entryPath)),\n ),\n );\n const existing = yield* Effect.filter(\n pipe(\n candidates,\n Arr.map((candidate) => files.join(directory, candidate)),\n ),\n (candidate) => files.exists(candidate),\n );\n return yield* Option.match(Arr.head(existing), {\n onNone: (): Effect.Effect<Option.Option<string>> => Effect.succeedNone,\n onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome),\n });\n});\n\nconst importNameOf = (packageName: string): string => {\n if (!Str.startsWith(TYPES_SCOPE)(packageName)) {\n return packageName;\n }\n const unscoped = Str.slice(TYPES_SCOPE.length)(packageName);\n if (!Str.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) {\n return unscoped;\n }\n return `@${Str.replace(TYPES_SCOPE_SEPARATOR, \"/\")(unscoped)}`;\n};\n\nconst specifierFor = (packageName: string, subpath: string): string => {\n const importName = importNameOf(packageName);\n if (subpath === ROOT_SUBPATH) {\n return importName;\n }\n return `${importName}/${Str.slice(SUBPATH_PREFIX.length)(subpath)}`;\n};\n\nconst rootEntryPaths = (manifest: Manifest): readonly string[] =>\n Arr.getSomes([\n Option.fromUndefinedOr(manifest.types),\n Option.fromUndefinedOr(manifest.typings),\n Option.fromUndefinedOr(manifest.main),\n ]);\n\nconst subpathEntriesOf = Effect.fn(\"subpathEntriesOf\")(function* subpathEntriesOf(\n packageName: string,\n directory: string,\n manifest: Manifest,\n) {\n const found = yield* Effect.forEach(\n subpathTargetsOf(manifest.exports),\n ({ subpath, target }) =>\n firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(\n Effect.map(\n Option.map((declarationsPath) => ({\n packageName,\n specifier: specifierFor(packageName, subpath),\n declarationsPath,\n })),\n ),\n ),\n { concurrency: 1 },\n );\n return Arr.getSomes(found);\n});\n\nconst entriesOfDependency = Effect.fn(\"entriesOfDependency\")(function* entriesOfDependency(\n packageName: string,\n directory: string,\n) {\n const manifest = yield* readManifest(directory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);\n const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);\n if (\n pipe(\n subpathEntries,\n Arr.some((entry) => entry.specifier === rootSpecifier),\n )\n ) {\n return subpathEntries;\n }\n const rootDeclarations = yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value));\n const rootEntries = rootDeclarations.pipe(\n Option.map((declarationsPath) => ({ packageName, specifier: rootSpecifier, declarationsPath })),\n Option.toArray,\n );\n return [...rootEntries, ...subpathEntries];\n});\n\nconst isWorkspaceRange = Str.startsWith(WORKSPACE_PROTOCOL);\n\nconst namesWhere = (\n keep: (range: string) => boolean,\n declared: Readonly<Record<string, string>>,\n): readonly string[] =>\n pipe(\n Rec.toEntries(declared),\n Arr.filter(([, range]) => keep(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst declaredDependencies = (manifest: Manifest): readonly string[] =>\n namesWhere((range) => !isWorkspaceRange(range), {\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n });\n\nexport const workspaceDependencies = (manifest: Manifest): readonly string[] =>\n namesWhere(isWorkspaceRange, { ...manifest.dependencies, ...manifest.devDependencies });\n\nconst entryOrder = Order.mapInput(Order.String, (entry: DependencyEntry) => entry.specifier);\n\nexport const dependencyEntries = Effect.fn(\"dependencyEntries\")(function* dependencyEntries(\n packageDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(packageDirectory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const entries = yield* Effect.forEach(\n declaredDependencies(manifest.value),\n (packageName) =>\n entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)),\n { concurrency: 1 },\n );\n return Arr.sort(\n Arr.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier),\n entryOrder,\n );\n});\n"],"mappings":";;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,sBAAb,cAAyC,YAGvC,CAAC,CAAC,uBAAuB;CAAE,MAAM,OAAO;CAAQ,QAAQ,OAAO;AAAO,CAAC,CAAC,CAAC,CAAC;;;ACA5E,MAAa,qBAAqB,SAChC,OAAO,WAAW;CAChB,WAAW,sBAAsB,IAAI;CACrC,QAAQ,UAAU,oBAAoB,KAAK;EAAE;EAAM,QAAQ,OAAO,KAAK;CAAE,CAAC;AAC5E,CAAC,CAAC,CAAC,KACD,OAAO,IAAI,OAAO,eAAe,GACjC,OAAO,oBAAoB,OAAO,KAAK,CAAC,CAC1C;;ACLF,MAAMA,kBAAgB;AACtB,MAAM,iBAAiB;AAWvB,MAAM,cAAc,MAAM,SAASC,SAAI,QAAQ,EAAE,gBAAkC,SAAS;AAE5F,MAAM,oBACJ,MACA,aAEA,OAAO,WAAW;CAChB,WAAW,6BAA6B,MAAM,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAE,CAAC;CACzE,QAAQ,UAAU,oBAAoB,KAAK;EAAE;EAAM,QAAQ,OAAO,KAAK;CAAE,CAAC;AAC5E,CAAC,CAAC,CAAC,KAAK,OAAO,oBAAwC,CAAC,CAAC,CAAC;;AAG5D,MAAa,oBAAoB,OAAO,GAAG,mBAAmB,CAAC,CAAC,UAAU,kBACxE,MACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,WAAW,OAAO,kBAA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AW,CAAC,GAC1F,EAAE,aAAa,EAAE,CACnB;CACA,OAAOA,MAAI,KACTA,MAAI,WAAW,QAAQ,KAAK,IAAI,MAAM,UAAU,KAAK,cAAc,MAAM,SAAS,GAClF,UACF;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-DmifnzVb.mjs","names":["Str","Arr"],"sources":["../src/shared/lib/text-position.ts","../src/shared/lib/lookup.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { Problem } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nexport const positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n","import { Config, Effect, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport type { HttpClientError } from \"effect/http\";\n\nconst USER_AGENT = \"msch (https://github.com/masseater/ecosystems/tree/main/libs/msch)\";\n\n/** @internal */\nexport const JSON_ACCEPT = \"application/json\";\n\n/** @internal */\nexport interface Lookup {\n readonly url: string;\n readonly token: Option.Option<string>;\n readonly accept: string;\n}\n\nconst requestOf = ({ url, token, accept }: Lookup): HttpClientRequest.HttpClientRequest => {\n const request = HttpClientRequest.get(url).pipe(\n HttpClientRequest.setHeader(\"user-agent\", USER_AGENT),\n HttpClientRequest.setHeader(\"accept\", accept),\n );\n return Option.match(token, {\n onNone: () => request,\n onSome: (value) => HttpClientRequest.bearerToken(value)(request),\n });\n};\n\n/** @internal */\nexport const sent = (\n lookup: Lookup,\n): Effect.Effect<\n HttpClientResponse.HttpClientResponse,\n HttpClientError.HttpClientError,\n HttpClient.HttpClient\n> => HttpClient.HttpClient.pipe(Effect.flatMap((client) => client.execute(requestOf(lookup))));\n\n/** @internal */\nexport const fetched = (\n lookup: Lookup,\n): Effect.Effect<\n HttpClientResponse.HttpClientResponse,\n HttpClientError.HttpClientError,\n HttpClient.HttpClient\n> => sent(lookup).pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));\n\n/** @internal */\nexport const jsonLookup = ({\n url,\n token,\n}: {\n readonly url: string;\n readonly token: Option.Option<string>;\n}): Lookup => ({\n url,\n token,\n accept: JSON_ACCEPT,\n});\n\n/** @internal */\nexport const publicLookup = (url: string): Lookup => jsonLookup({ url, token: Option.none() });\n\n/** @internal */\nexport const githubToken: Effect.Effect<Option.Option<string>> = Config.option(\n Config.String(\"GH_TOKEN\").pipe(Config.orElse(() => Config.String(\"GITHUB_TOKEN\"))),\n).pipe(Effect.orElseSucceed(() => Option.none<string>()));\n"],"mappings":";;;AAIA,MAAM,QAAQ;AACd,MAAM,eAAe;AAErB,MAAa,cACV,YACA,UAAoD;CACnD,MAAM,SAAS,KAAK,QAAQA,OAAI,MAAM,OAAO,KAAK,GAAGA,OAAI,MAAM,IAAI,CAAC;CACpE,OAAO;EACL,MAAM,OAAO;EACb,QAAQ,KACNC,MAAI,KAAK,MAAM,GACf,OAAO,MAAM;GAAE,cAAc;GAAc,SAAS,SAAS,KAAK,SAAS;EAAa,CAAC,CAC3F;CACF;AACF;;ACdF,MAAM,aAAa;;AAGnB,MAAa,cAAc;AAS3B,MAAM,aAAa,EAAE,KAAK,OAAO,aAA0D;CACzF,MAAM,UAAU,kBAAkB,IAAI,GAAG,CAAC,CAAC,KACzC,kBAAkB,UAAU,cAAc,UAAU,GACpD,kBAAkB,UAAU,UAAU,MAAM,CAC9C;CACA,OAAO,OAAO,MAAM,OAAO;EACzB,cAAc;EACd,SAAS,UAAU,kBAAkB,YAAY,KAAK,CAAC,CAAC,OAAO;CACjE,CAAC;AACH;;AAGA,MAAa,QACX,WAKG,WAAW,WAAW,KAAK,OAAO,SAAS,WAAW,OAAO,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC;;AAG7F,MAAa,WACX,WAKG,KAAK,MAAM,CAAC,CAAC,KAAK,OAAO,QAAQ,mBAAmB,cAAc,CAAC;;AAGxE,MAAa,cAAc,EACzB,KACA,aAIa;CACb;CACA;CACA,QAAQ;AACV;;AAGA,MAAa,gBAAgB,QAAwB,WAAW;CAAE;CAAK,OAAO,OAAO,KAAK;AAAE,CAAC;;AAG7F,MAAa,cAAoD,OAAO,OACtE,OAAO,OAAO,UAAU,CAAC,CAAC,KAAK,OAAO,aAAa,OAAO,OAAO,cAAc,CAAC,CAAC,CACnF,CAAC,CAAC,KAAK,OAAO,oBAAoB,OAAO,KAAa,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-report-ARfHc4ey.mjs","names":["Arr"],"sources":["../src/app/lookup-report.ts"],"sourcesContent":["import { Array as Arr, Effect, Order, Schema, Stdio, pipe } from \"effect\";\n\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\n\nconst NONE_FOUND = 0;\nconst LINE_BREAK = \"\\n\";\n\nconst byPlace = Order.Struct({ file: Order.String, line: Order.Number });\n\n/** @internal */\nexport interface Place {\n readonly file: string;\n readonly line: number;\n}\n\n/** @internal */\nexport interface LookupReport<Row extends Place, Requirements> {\n readonly row: Schema.Codec<Row>;\n readonly rows: (root: string) => Effect.Effect<readonly Row[], never, Requirements>;\n readonly describe: (row: Row) => string;\n}\n\nconst textOf =\n <Row extends Place>(row: Schema.Codec<Row>, describe: (row: Row) => string) =>\n (json: boolean, rows: readonly Row[]): Effect.Effect<string, Schema.SchemaError> => {\n if (json) {\n return Schema.encodeEffect(row.pipe(Schema.Array, Schema.fromJsonString))(rows);\n }\n return Effect.succeed(\n pipe(\n rows,\n Arr.map((found) => `${describe(found)}${LINE_BREAK}`),\n Arr.join(\"\"),\n ),\n );\n };\n\n/** @internal */\nexport const lookupReport = <Row extends Place, Requirements>({\n row,\n rows,\n describe,\n}: LookupReport<Row, Requirements>): Effect.Effect<\n number,\n Schema.SchemaError | ProblemsFound,\n Requirements | RepositoryFiles | Stdio.Stdio\n> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const found = yield* rows(files.resolve(\".\"));\n const text = yield* textOf(row, describe)(\n Arr.contains(args, JSON_FLAG),\n Arr.sort(found, byPlace),\n );\n yield* writeStdout(text);\n if (found.length > NONE_FOUND) {\n return yield* ProblemsFound.make({ count: found.length });\n }\n return NONE_FOUND;\n });\n"],"mappings":";;;;;AAOA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAM,OAAO;CAAE,MAAM,MAAM;CAAQ,MAAM,MAAM;AAAO,CAAC;AAevE,MAAM,UACgB,KAAwB,cAC3C,MAAe,SAAoE;CAClF,IAAI,MACF,OAAO,OAAO,aAAa,IAAI,KAAK,OAAO,OAAO,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI;CAEhF,OAAO,OAAO,QACZ,KACE,MACAA,MAAI,KAAK,UAAU,GAAG,SAAS,KAAK,IAAI,YAAY,GACpDA,MAAI,KAAK,EAAE,CACb,CACF;AACF;;AAGF,MAAa,gBAAiD,EAC5D,KACA,MACA,eAMA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,QAAQ,OAAO,KAAK,MAAM,QAAQ,GAAG,CAAC;CAC5C,MAAM,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CACvCA,MAAI,SAAS,MAAM,SAAS,GAC5BA,MAAI,KAAK,OAAO,OAAO,CACzB;CACA,OAAO,YAAY,IAAI;CACvB,IAAI,MAAM,SAAS,YACjB,OAAO,OAAO,cAAc,KAAK,EAAE,OAAO,MAAM,OAAO,CAAC;CAE1D,OAAO;AACT,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pass-records-CFIrQmB5.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","Arr","Str","Arr"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/pass-records.ts"],"sourcesContent":["import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\nexport type Value = string | number;\n\nexport interface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nexport const literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nexport const literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nexport const schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nexport const finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nexport const vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nexport const isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nexport const sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n carriesTag,\n declaresAType,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n readonly typeNames: readonly string[];\n readonly tagNames: readonly string[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [], typeNames: [], tagNames: [] };\n\nexport const isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { ...EMPTY_INDEX, vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n ...EMPTY_INDEX,\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n typeNames: pipe(\n indexes,\n Arr.flatMap((index) => index.typeNames),\n ),\n tagNames: pipe(\n indexes,\n Arr.flatMap((index) => index.tagNames),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst typeNameIndex = (visit: Visit, symbol: TypeSymbol): LibraryIndex => {\n const declarations = declarationsOf(symbol);\n const typeNames = pipe(\n [visit.exported.name],\n Arr.filter(() => declaresAType(declarations)),\n );\n const tagNames = pipe(\n typeNames,\n Arr.filter((name) => carriesTag(name)(declarations)),\n );\n return { ...EMPTY_INDEX, typeNames, tagNames };\n};\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([\n declaredTypeIndex(walk, named),\n schemaValueIndex(walk, named),\n typeNameIndex(visit, symbol),\n ]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nexport const libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nexport const annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nexport const withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nexport const mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), {\n concurrency: 1,\n });\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (parent !== directory && !(yield* files.exists(files.join(directory, MANIFEST_FILE)))) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* Effect.forEach(\n names,\n (name) => files.realPath(files.join(directory, NODE_MODULES, name)),\n {\n concurrency: 1,\n },\n );\n});\n\nexport const workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(\n start: string,\n) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }),\n );\n return Arr.flatten(nested);\n});\n\nexport const installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* Effect.forEach(\n names,\n (name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n { concurrency: 1 },\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* Effect.forEach(\n Arr.dedupe([root, ...directories]),\n (directory) => installedPackages(root, directory),\n { concurrency: 1 },\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst PASSED = \"\";\nconst UNREADABLE = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nexport interface Records {\n readonly directory: string;\n readonly passed: readonly string[];\n}\n\nexport type NamedFile = readonly [name: string, file: string];\n\nexport const contentKey = Effect.fn(\"contentKey\")(function* contentKey(\n salt: readonly string[],\n named: readonly NamedFile[],\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* Effect.forEach(\n named,\n ([name, file]) =>\n files\n .hashFile(file)\n .pipe(\n Effect.map(\n (found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`,\n ),\n ),\n { concurrency: 1 },\n );\n return yield* files.hash(Arr.join([...salt, ...entries], LINE_SEPARATOR));\n});\n\nexport const recordsIn = Effect.fn(\"recordsIn\")(function* recordsIn(directory: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.readDirectory(directory);\n return { directory, passed: present } satisfies Records;\n});\n\nexport const keepOnly = Effect.fn(\"keepOnly\")(function* keepOnly(\n records: Records,\n keys: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const stale = pipe(\n records.passed,\n Arr.filter((key) => !Arr.contains(keys, key)),\n );\n yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {\n concurrency: 1,\n discard: true,\n });\n yield* Effect.forEach(\n keys,\n (key) => files.writeFile(files.join(records.directory, key), PASSED),\n { concurrency: 1, discard: true },\n );\n});\n"],"mappings":";;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS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MAAM,KAAK,QAAQ,WAAW,GAAG,CAAC,GAAG;EAC1F,aAAa;EACb,SAAS;CACX,CAAC;CACD,OAAO,OAAO,QACZ,OACC,QAAQ,MAAM,UAAU,MAAM,KAAK,QAAQ,WAAW,GAAG,GAAG,MAAM,GACnE;EAAE,aAAa;EAAG,SAAS;CAAK,CAClC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"published-BIexKvdJ.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\n/** @internal */\nexport const wantedLockfile = (\n root: string,\n): Effect.Effect<Option.Option<WantedLockfile>, 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));\n\n/** @internal */\nexport const lockedPackages = (\n root: string,\n): Effect.Effect<Option.Option<readonly string[]>, LockfileUnreadable> =>\n wantedLockfile(root).pipe(\n Effect.map(Option.flatMap(({ packages }) => Option.fromUndefinedOr(packages))),\n Effect.map(Option.map(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 type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst ROOT_SUBPATH = \".\";\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 subpathsOf = (exportsField: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(exportsField)) {\n return [[ROOT_SUBPATH, exportsField]];\n }\n const entries = Rec.toEntries(exportsField);\n if (\n pipe(\n entries,\n Arr.some(([key]) => Str.startsWith(ROOT_SUBPATH)(key)),\n )\n ) {\n return entries;\n }\n return [[ROOT_SUBPATH, exportsField]];\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 [...subpathsOf(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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} from "./lookup-DmifnzVb.mjs";
|
|
3
|
-
import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
|
|
4
|
-
import { Array, Effect, Match, Option, Result, Schema, String as String$1, pipe } from "effect";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
7
|
-
import remarkParse from "remark-parse";
|
|
8
|
-
import { unified } from "unified";
|
|
9
|
-
import { visit } from "unist-util-visit";
|
|
10
|
-
// src/shared/lib/tree-sitter.ts
|
|
11
|
-
const taggedError = Schema.TaggedError;
|
|
12
|
-
var GrammarUnreadable = class extends taggedError()("GrammarUnreadable", {
|
|
13
|
-
grammar: Schema.String,
|
|
14
|
-
message: Schema.String
|
|
15
|
-
}) {};
|
|
16
|
-
const PARSER_KEY = "parser";
|
|
17
|
-
const initParser = startedOnce();
|
|
18
|
-
const loadOnce = startedOnce();
|
|
19
|
-
const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
|
|
20
|
-
const loadLanguage = (grammar) => {
|
|
21
|
-
const unreadable = (cause) => GrammarUnreadable.make({
|
|
22
|
-
grammar,
|
|
23
|
-
message: String(cause)
|
|
24
|
-
});
|
|
25
|
-
return Effect.tryPromise({
|
|
26
|
-
try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),
|
|
27
|
-
catch: unreadable
|
|
28
|
-
}).pipe(Effect.andThen(Effect.tryPromise({
|
|
29
|
-
try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),
|
|
30
|
-
catch: unreadable
|
|
31
|
-
})));
|
|
32
|
-
};
|
|
33
|
-
const readTree = ({ language, source, read }) => {
|
|
34
|
-
const parser = new treeSitter.Parser();
|
|
35
|
-
parser.setLanguage(language);
|
|
36
|
-
const tree = parser.parse(source);
|
|
37
|
-
parser.delete();
|
|
38
|
-
return Option.map(Option.fromNullishOr(tree), (parsed) => {
|
|
39
|
-
const result = read(parsed.rootNode);
|
|
40
|
-
parsed.delete();
|
|
41
|
-
return result;
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
// src/features/check-references/model/reference.ts
|
|
45
|
-
const REFERENCE_SCHEME = /^(?<scheme>github|npm):/u;
|
|
46
|
-
const BRANCH_LINK = /^https:\/\/github\.com\/(?<owner>[A-Za-z\d](?:[A-Za-z\d-]*[A-Za-z\d])?)\/(?<repo>[\w.-]+)\/(?:tree|blob)\/(?<ref>[^/#?]+)(?:\/(?<path>[^#?]*[^/#?]))?(?:[#?].*)?$/u;
|
|
47
|
-
const COMMIT = /^[0-9a-f]{40}$/u;
|
|
48
|
-
const GITHUB_REFERENCE = /^github:(?<owner>[A-Za-z\d](?:[A-Za-z\d-]*[A-Za-z\d])?)\/(?<repo>[\w.-]+)(?:\/(?<path>[^#]+))?(?:#(?<symbol>.+))?$/u;
|
|
49
|
-
const NPM_REFERENCE = /^npm:(?<name>(?:@[a-z\d~-][a-z\d._~-]*\/)?[a-z\d~-][a-z\d._~-]*)$/u;
|
|
50
|
-
const SYMBOL = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u;
|
|
51
|
-
const LINE_ANCHOR = /^L\d+(?:-L\d+)?$/u;
|
|
52
|
-
const UNUSABLE_SEGMENT = /^\.{0,2}$/u;
|
|
53
|
-
const SEPARATOR = "/";
|
|
54
|
-
const GRAMMAR = "`github:<owner>/<repo>[/<path>][#<symbol>]` or `npm:<package>`, where the path names a file or directory of the default branch and the symbol is a declared name such as `Config` or `Config.validate`";
|
|
55
|
-
const pathProblem = (path) => {
|
|
56
|
-
const segments = String$1.split(path, SEPARATOR);
|
|
57
|
-
return Option.liftPredicate(`The path ${path} has an empty, \`.\` or \`..\` segment or a trailing slash. Write the path from the repository root without a trailing slash.`, () => pipe(segments, Array.some((segment) => UNUSABLE_SEGMENT.test(segment))));
|
|
58
|
-
};
|
|
59
|
-
const symbolProblem = (symbol) => {
|
|
60
|
-
if (LINE_ANCHOR.test(symbol)) return Option.some(`#${symbol} is a line number, and a line number goes stale as soon as the file changes. Name the declaration instead, such as #Config.`);
|
|
61
|
-
return Option.liftPredicate(`#${symbol} is not a declared name. Write a name such as #Config or #Config.validate.`, () => !SYMBOL.test(symbol));
|
|
62
|
-
};
|
|
63
|
-
const pathlessSymbol = (path, symbol) => Option.liftPredicate("A symbol needs the file that declares it. Write github:<owner>/<repo>/<path>#<symbol>.", () => Option.isNone(path) && Option.isSome(symbol));
|
|
64
|
-
const githubReference = (destination) => {
|
|
65
|
-
const found = GITHUB_REFERENCE.exec(destination);
|
|
66
|
-
const path = groupOf("path")(found);
|
|
67
|
-
const symbol = groupOf("symbol")(found);
|
|
68
|
-
const problem = pipe(path, Option.flatMap(pathProblem), Option.orElse(() => pipe(symbol, Option.flatMap(symbolProblem))), Option.orElse(() => pathlessSymbol(path, symbol)));
|
|
69
|
-
if (Option.isSome(problem)) return Result.fail(problem.value);
|
|
70
|
-
return pipe(Option.all({
|
|
71
|
-
owner: groupOf("owner")(found),
|
|
72
|
-
repo: groupOf("repo")(found)
|
|
73
|
-
}), Option.map(({ owner, repo }) => ({
|
|
74
|
-
kind: "github",
|
|
75
|
-
owner,
|
|
76
|
-
repo,
|
|
77
|
-
path: Option.getOrElse(path, () => ""),
|
|
78
|
-
symbol,
|
|
79
|
-
ref: Option.none()
|
|
80
|
-
})), Result.fromOption(() => `${destination} is not a repository path. Write ${GRAMMAR}.`));
|
|
81
|
-
};
|
|
82
|
-
const npmReference = (destination) => pipe(groupOf("name")(NPM_REFERENCE.exec(destination)), Option.map((name) => ({
|
|
83
|
-
kind: "npm",
|
|
84
|
-
name
|
|
85
|
-
})), Result.fromOption(() => `${destination} is not a package name. Write ${GRAMMAR}.`));
|
|
86
|
-
const parseReference = (destination) => {
|
|
87
|
-
if (Option.contains(groupOf("scheme")(REFERENCE_SCHEME.exec(destination)), "npm")) return npmReference(destination);
|
|
88
|
-
return githubReference(destination);
|
|
89
|
-
};
|
|
90
|
-
const githubDescription = ({ owner, repo, path, symbol, ref }) => {
|
|
91
|
-
return `github:${Option.match(Option.liftPredicate(path, String$1.isNonEmpty), {
|
|
92
|
-
onNone: () => `${owner}/${repo}`,
|
|
93
|
-
onSome: (found) => `${owner}/${repo}/${found}`
|
|
94
|
-
})}${Option.match(symbol, {
|
|
95
|
-
onNone: () => "",
|
|
96
|
-
onSome: (found) => `#${found}`
|
|
97
|
-
})}${Option.match(ref, {
|
|
98
|
-
onNone: () => "",
|
|
99
|
-
onSome: (found) => ` on ${found}`
|
|
100
|
-
})}`;
|
|
101
|
-
};
|
|
102
|
-
const describeReference = (reference) => Match.value(reference).pipe(Match.discriminatorsExhaustive("kind")({
|
|
103
|
-
github: githubDescription,
|
|
104
|
-
npm: ({ name }) => `npm:${name}`
|
|
105
|
-
}));
|
|
106
|
-
const branchLinkReference = (destination) => {
|
|
107
|
-
const found = BRANCH_LINK.exec(destination);
|
|
108
|
-
const branch = pipe(groupOf("ref")(found), Option.filter((ref) => !COMMIT.test(ref)));
|
|
109
|
-
return pipe(Option.all({
|
|
110
|
-
owner: groupOf("owner")(found),
|
|
111
|
-
repo: groupOf("repo")(found),
|
|
112
|
-
ref: branch
|
|
113
|
-
}), Option.map(({ owner, repo, ref }) => ({
|
|
114
|
-
kind: "github",
|
|
115
|
-
owner,
|
|
116
|
-
repo,
|
|
117
|
-
path: Option.getOrElse(groupOf("path")(found), () => ""),
|
|
118
|
-
symbol: Option.none(),
|
|
119
|
-
ref: Option.some(ref)
|
|
120
|
-
})));
|
|
121
|
-
};
|
|
122
|
-
// src/features/check-references/model/reference-links.ts
|
|
123
|
-
const RULE = "reference-link";
|
|
124
|
-
const MARKDOWN = ".md";
|
|
125
|
-
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
126
|
-
const READ_CONCURRENCY = 16;
|
|
127
|
-
const parser = unified().use(remarkParse);
|
|
128
|
-
const linkAt = (node) => pipe(Option.fromNullishOr(node.position), Option.flatMap(({ start }) => Option.fromNullishOr(start.offset)), Option.map((index) => ({
|
|
129
|
-
destination: node.url,
|
|
130
|
-
index
|
|
131
|
-
})));
|
|
132
|
-
/** @internal */
|
|
133
|
-
const linksIn = (source) => {
|
|
134
|
-
const found = [];
|
|
135
|
-
const tree = parser.parse(source);
|
|
136
|
-
visit(tree, (node) => {
|
|
137
|
-
if (node.type === "link" || node.type === "definition") found.push(...Option.toArray(linkAt(node)));
|
|
138
|
-
});
|
|
139
|
-
return found;
|
|
140
|
-
};
|
|
141
|
-
/** @internal */
|
|
142
|
-
const referenceMessage = (destination) => pipe(Option.liftPredicate(destination, (text) => REFERENCE_SCHEME.test(text)), Option.flatMap((text) => Result.match(parseReference(text), {
|
|
143
|
-
onFailure: Option.some,
|
|
144
|
-
onSuccess: () => Option.none()
|
|
145
|
-
})));
|
|
146
|
-
/** @internal */
|
|
147
|
-
const referenceOf = (destination) => pipe(Option.liftPredicate(destination, (text) => REFERENCE_SCHEME.test(text)), Option.flatMap((text) => Result.getSuccess(parseReference(text))), Option.orElse(() => branchLinkReference(destination)));
|
|
148
|
-
/** @internal */
|
|
149
|
-
const markdownTexts = Effect.fn("markdownTexts")(function* markdownTexts(root) {
|
|
150
|
-
const files = yield* RepositoryFiles;
|
|
151
|
-
const listed = yield* files.listedFiles(root);
|
|
152
|
-
const documents = pipe(listed, Array.filter((file) => String$1.endsWith(MARKDOWN)(file) && !FIXTURE.test(file)), Array.map((file) => files.join(root, file)));
|
|
153
|
-
const read = yield* Effect.forEach(documents, (file) => Effect.map(files.readFile(file), Option.map((source) => ({
|
|
154
|
-
file,
|
|
155
|
-
source
|
|
156
|
-
}))), { concurrency: READ_CONCURRENCY });
|
|
157
|
-
return Array.getSomes(read);
|
|
158
|
-
});
|
|
159
|
-
const problemsIn = ({ file, source }) => Array.flatMap(linksIn(source), ({ destination, index }) => pipe(referenceMessage(destination), Option.map((message) => ({
|
|
160
|
-
file,
|
|
161
|
-
...positionOf(source)(index),
|
|
162
|
-
rule: RULE,
|
|
163
|
-
message
|
|
164
|
-
})), Option.toArray));
|
|
165
|
-
/** @internal */
|
|
166
|
-
const checkReferenceLinks = Effect.fn("checkReferenceLinks")(function* checkReferenceLinks(root) {
|
|
167
|
-
const texts = yield* markdownTexts(root);
|
|
168
|
-
return pipe(texts, Array.flatMap(problemsIn));
|
|
169
|
-
});
|
|
170
|
-
export { describeReference as a, referenceOf as i, linksIn as n, loadLanguage as o, markdownTexts as r, readTree as s, checkReferenceLinks as t };
|
|
171
|
-
|
|
172
|
-
//# sourceMappingURL=reference-links-B9NZUUF8.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reference-links-B9NZUUF8.mjs","names":["Str","Arr","Arr","Str"],"sources":["../src/shared/lib/tree-sitter.ts","../src/features/check-references/model/reference.ts","../src/features/check-references/model/reference-links.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\n\nimport treeSitter from \"@vscode/tree-sitter-wasm\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { startedOnce } from \"./started-once.ts\";\n\nexport type Language = treeSitter.Language;\n\nexport type SyntaxNode = treeSitter.Node;\n\nexport interface TreeReading<Result> {\n readonly language: Language;\n readonly source: string;\n readonly read: (root: SyntaxNode) => Result;\n}\n\nconst taggedError = Schema.TaggedError;\n\nexport class GrammarUnreadable extends taggedError<\n GrammarUnreadable,\n { readonly brand: unique symbol }\n>()(\"GrammarUnreadable\", { grammar: Schema.String, message: Schema.String }) {}\n\nconst PARSER_KEY = \"parser\";\n\nconst initParser = startedOnce<unknown>();\n\nconst loadOnce = startedOnce<Language>();\n\nconst grammarFile = (grammar: string): string =>\n fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));\n\nexport const loadLanguage = (grammar: string): Effect.Effect<Language, GrammarUnreadable> => {\n const unreadable = (cause: unknown): GrammarUnreadable =>\n GrammarUnreadable.make({ grammar, message: String(cause) });\n return Effect.tryPromise({\n try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),\n catch: unreadable,\n }).pipe(\n Effect.andThen(\n Effect.tryPromise({\n try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),\n catch: unreadable,\n }),\n ),\n );\n};\n\nexport const readTree = <Result>({\n language,\n source,\n read,\n}: TreeReading<Result>): Option.Option<Result> => {\n const parser = new treeSitter.Parser();\n parser.setLanguage(language);\n const tree = parser.parse(source);\n parser.delete();\n return Option.map(Option.fromNullishOr(tree), (parsed) => {\n const result = read(parsed.rootNode);\n parsed.delete();\n return result;\n });\n};\n","import { Array as Arr, Match, Option, Result, String as Str, pipe } from \"effect\";\n\nimport { groupOf } from \"#/shared/lib/match-groups.ts\";\n\nexport interface GithubReference {\n readonly kind: \"github\";\n readonly owner: string;\n readonly repo: string;\n readonly path: string;\n readonly symbol: Option.Option<string>;\n readonly ref: Option.Option<string>;\n}\n\nexport interface NpmReference {\n readonly kind: \"npm\";\n readonly name: string;\n}\n\nexport type Reference = GithubReference | NpmReference;\n\nexport const REFERENCE_SCHEME = /^(?<scheme>github|npm):/u;\nconst BRANCH_LINK =\n /^https:\\/\\/github\\.com\\/(?<owner>[A-Za-z\\d](?:[A-Za-z\\d-]*[A-Za-z\\d])?)\\/(?<repo>[\\w.-]+)\\/(?:tree|blob)\\/(?<ref>[^/#?]+)(?:\\/(?<path>[^#?]*[^/#?]))?(?:[#?].*)?$/u;\nconst COMMIT = /^[0-9a-f]{40}$/u;\nconst GITHUB_REFERENCE =\n /^github:(?<owner>[A-Za-z\\d](?:[A-Za-z\\d-]*[A-Za-z\\d])?)\\/(?<repo>[\\w.-]+)(?:\\/(?<path>[^#]+))?(?:#(?<symbol>.+))?$/u;\nconst NPM_REFERENCE = /^npm:(?<name>(?:@[a-z\\d~-][a-z\\d._~-]*\\/)?[a-z\\d~-][a-z\\d._~-]*)$/u;\nconst SYMBOL = /^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*$/u;\nconst LINE_ANCHOR = /^L\\d+(?:-L\\d+)?$/u;\nconst UNUSABLE_SEGMENT = /^\\.{0,2}$/u;\nconst SEPARATOR = \"/\";\n\nexport const NO_PATH = \"\";\n\nexport const GRAMMAR =\n \"`github:<owner>/<repo>[/<path>][#<symbol>]` or `npm:<package>`, where the path names a file or directory of the default branch and the symbol is a declared name such as `Config` or `Config.validate`\";\n\nconst pathProblem = (path: string): Option.Option<string> => {\n const segments = Str.split(path, SEPARATOR);\n return Option.liftPredicate(\n `The path ${path} has an empty, \\`.\\` or \\`..\\` segment or a trailing slash. Write the path from the repository root without a trailing slash.`,\n () =>\n pipe(\n segments,\n Arr.some((segment) => UNUSABLE_SEGMENT.test(segment)),\n ),\n );\n};\n\nconst symbolProblem = (symbol: string): Option.Option<string> => {\n if (LINE_ANCHOR.test(symbol)) {\n return Option.some(\n `#${symbol} is a line number, and a line number goes stale as soon as the file changes. Name the declaration instead, such as #Config.`,\n );\n }\n return Option.liftPredicate(\n `#${symbol} is not a declared name. Write a name such as #Config or #Config.validate.`,\n () => !SYMBOL.test(symbol),\n );\n};\n\nconst pathlessSymbol = (\n path: Option.Option<string>,\n symbol: Option.Option<string>,\n): Option.Option<string> =>\n Option.liftPredicate(\n \"A symbol needs the file that declares it. Write github:<owner>/<repo>/<path>#<symbol>.\",\n () => Option.isNone(path) && Option.isSome(symbol),\n );\n\nconst githubReference = (destination: string): Result.Result<Reference, string> => {\n const found = GITHUB_REFERENCE.exec(destination);\n const path = groupOf(\"path\")(found);\n const symbol = groupOf(\"symbol\")(found);\n const problem = pipe(\n path,\n Option.flatMap(pathProblem),\n Option.orElse(() => pipe(symbol, Option.flatMap(symbolProblem))),\n Option.orElse(() => pathlessSymbol(path, symbol)),\n );\n if (Option.isSome(problem)) {\n return Result.fail(problem.value);\n }\n return pipe(\n Option.all({ owner: groupOf(\"owner\")(found), repo: groupOf(\"repo\")(found) }),\n Option.map(({ owner, repo }): Reference => ({\n kind: \"github\",\n owner,\n repo,\n path: Option.getOrElse(path, () => NO_PATH),\n symbol,\n ref: Option.none(),\n })),\n Result.fromOption(() => `${destination} is not a repository path. Write ${GRAMMAR}.`),\n );\n};\n\nconst npmReference = (destination: string): Result.Result<Reference, string> =>\n pipe(\n groupOf(\"name\")(NPM_REFERENCE.exec(destination)),\n Option.map((name): Reference => ({ kind: \"npm\", name })),\n Result.fromOption(() => `${destination} is not a package name. Write ${GRAMMAR}.`),\n );\n\nexport const parseReference = (destination: string): Result.Result<Reference, string> => {\n if (Option.contains(groupOf(\"scheme\")(REFERENCE_SCHEME.exec(destination)), \"npm\")) {\n return npmReference(destination);\n }\n return githubReference(destination);\n};\n\nconst githubDescription = ({ owner, repo, path, symbol, ref }: GithubReference): string => {\n const place = Option.match(Option.liftPredicate(path, Str.isNonEmpty), {\n onNone: () => `${owner}/${repo}`,\n onSome: (found) => `${owner}/${repo}/${found}`,\n });\n const fragment = Option.match(symbol, {\n onNone: () => \"\",\n onSome: (found) => `#${found}`,\n });\n const branch = Option.match(ref, {\n onNone: () => \"\",\n onSome: (found) => ` on ${found}`,\n });\n return `github:${place}${fragment}${branch}`;\n};\n\nexport const describeReference = (reference: Reference): string =>\n Match.value(reference).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n github: githubDescription,\n npm: ({ name }) => `npm:${name}`,\n }),\n );\n\nexport const branchLinkReference = (destination: string): Option.Option<Reference> => {\n const found = BRANCH_LINK.exec(destination);\n const branch = pipe(\n groupOf(\"ref\")(found),\n Option.filter((ref) => !COMMIT.test(ref)),\n );\n return pipe(\n Option.all({ owner: groupOf(\"owner\")(found), repo: groupOf(\"repo\")(found), ref: branch }),\n Option.map(({ owner, repo, ref }): Reference => ({\n kind: \"github\",\n owner,\n repo,\n path: Option.getOrElse(groupOf(\"path\")(found), () => NO_PATH),\n symbol: Option.none(),\n ref: Option.some(ref),\n })),\n );\n};\n","import { Array as Arr, Effect, Option, Result, String as Str, pipe } from \"effect\";\nimport type { Definition, Link, Root } from \"mdast\";\nimport remarkParse from \"remark-parse\";\nimport { unified } from \"unified\";\nimport { visit } from \"unist-util-visit\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nimport { REFERENCE_SCHEME, branchLinkReference, parseReference } from \"./reference.ts\";\nimport type { Reference } from \"./reference.ts\";\n\nconst RULE: RuleName = \"reference-link\";\nconst MARKDOWN = \".md\";\nconst FIXTURE = /(?:^|\\/)fixtures\\//u;\nconst READ_CONCURRENCY = 16;\n\nconst parser = unified().use(remarkParse);\n\n/** @internal */\nexport interface LinkAt {\n readonly destination: string;\n readonly index: number;\n}\n\n/** @internal */\nexport interface MarkdownText {\n readonly file: string;\n readonly source: string;\n}\n\nconst linkAt = (node: Link | Definition): Option.Option<LinkAt> =>\n pipe(\n Option.fromNullishOr(node.position),\n Option.flatMap(({ start }) => Option.fromNullishOr(start.offset)),\n Option.map((index): LinkAt => ({ destination: node.url, index })),\n );\n\n/** @internal */\nexport const linksIn = (source: string): readonly LinkAt[] => {\n const found: LinkAt[] = [];\n const tree: Root = parser.parse(source);\n visit(tree, (node) => {\n if (node.type === \"link\" || node.type === \"definition\") {\n found.push(...Option.toArray(linkAt(node)));\n }\n });\n return found;\n};\n\n/** @internal */\nexport const referenceMessage = (destination: string): Option.Option<string> =>\n pipe(\n Option.liftPredicate(destination, (text) => REFERENCE_SCHEME.test(text)),\n Option.flatMap((text) =>\n Result.match(parseReference(text), {\n onFailure: Option.some,\n onSuccess: () => Option.none(),\n }),\n ),\n );\n\n/** @internal */\nexport const referenceOf = (destination: string): Option.Option<Reference> =>\n pipe(\n Option.liftPredicate(destination, (text) => REFERENCE_SCHEME.test(text)),\n Option.flatMap((text) => Result.getSuccess(parseReference(text))),\n Option.orElse(() => branchLinkReference(destination)),\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\nconst problemsIn = ({ file, source }: MarkdownText): readonly Problem[] =>\n Arr.flatMap(linksIn(source), ({ destination, index }) =>\n pipe(\n referenceMessage(destination),\n Option.map((message): Problem => ({\n file,\n ...positionOf(source)(index),\n rule: RULE,\n message,\n })),\n Option.toArray,\n ),\n );\n\n/** @internal */\nexport const checkReferenceLinks = Effect.fn(\"checkReferenceLinks\")(function* checkReferenceLinks(\n root: string,\n) {\n const texts = yield* markdownTexts(root);\n return pipe(texts, Arr.flatMap(problemsIn));\n});\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,cAAc,OAAO;AAE3B,IAAa,oBAAb,cAAuC,YAGrC,CAAC,CAAC,qBAAqB;CAAE,SAAS,OAAO;CAAQ,SAAS,OAAO;AAAO,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,aAAa;AAEnB,MAAM,aAAa,YAAqB;AAExC,MAAM,WAAW,YAAsB;AAEvC,MAAM,eAAe,YACnB,cAAc,YAAY,QAAQ,6CAA6C,QAAQ,MAAM,CAAC;AAEhG,MAAa,gBAAgB,YAAgE;CAC3F,MAAM,cAAc,UAClB,kBAAkB,KAAK;EAAE;EAAS,SAAS,OAAO,KAAK;CAAE,CAAC;CAC5D,OAAO,OAAO,WAAW;EACvB,WAAW,WAAW,kBAAkB,WAAW,OAAO,KAAK,CAAC;EAChE,OAAO;CACT,CAAC,CAAC,CAAC,KACD,OAAO,QACL,OAAO,WAAW;EAChB,WAAW,SAAS,eAAe,WAAW,SAAS,KAAK,YAAY,OAAO,CAAC,CAAC;EACjF,OAAO;CACT,CAAC,CACH,CACF;AACF;A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C,OAAO,KAAK,OAAOA,MAAI,QAAQ,UAAU,CAAC;AAC5C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository-files-B5sRbxlz.mjs","names":["Str","Arr"],"sources":["../src/shared/lib/match-groups.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import { Option, pipe } from \"effect\";\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 {\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\nimport { groupOf } from \"./match-groups.ts\";\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":";;;;;AAEA,MAAa,WACV,UACA,UACC,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,SAAS,UAAU,OAAO,cAAc,MAAM,MAAM,CAAC,GAC5D,OAAO,SAAS,WAAW,OAAO,cAAc,OAAO,KAAK,CAAC,CAC/D;;;ACeJ,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;AAEA,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB,CAAC,qCAAqC,oCAAoC;AAClG,MAAa,eAAe;AAC5B,MAAM,cAAc;CAAC;CAAY;CAAY;CAAsB,aAAa,aAAa;AAAE;AAC/F,MAAM,eAAe;CAAC;CAAY;CAAa;AAAoB;AACnE,MAAM,eAAe,CAAC,UAAU;AAChC,MAAM,cAAc,CAAC,SAAS;AAC9B,MAAM,aAAa;AAEnB,IAAa,kBAAb,cAAqC,QAAQ,QA+C3C,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAEtE,MAAM,UAAU;AAIhB,MAAM,iBAAiB,OA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