@r_masseater/msch 0.67.0 → 0.69.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.
Files changed (41) hide show
  1. package/dist/cargo-inputs.mjs +2 -2
  2. package/dist/changed.mjs +4 -4
  3. package/dist/cli.mjs +22 -14
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/config.mjs +1 -1
  6. package/dist/config.mjs.map +1 -1
  7. package/dist/{dependencies-B9hf2aIC.mjs → dependencies-C3kCe35Q.mjs} +2 -2
  8. package/dist/{dependencies-B9hf2aIC.mjs.map → dependencies-C3kCe35Q.mjs.map} +1 -1
  9. package/dist/exits.mjs +4 -4
  10. package/dist/{ignored-directories-DzwJE3Y7.mjs → ignored-directories-BW8gCBE1.mjs} +2 -2
  11. package/dist/{ignored-directories-DzwJE3Y7.mjs.map → ignored-directories-BW8gCBE1.mjs.map} +1 -1
  12. package/dist/{lookup-report-FU7iFxSa.mjs → lookup-report-D1VTEK5k.mjs} +3 -3
  13. package/dist/{lookup-report-FU7iFxSa.mjs.map → lookup-report-D1VTEK5k.mjs.map} +1 -1
  14. package/dist/{manifest-texts-B8NV4YCS.mjs → manifest-texts-K650kDy8.mjs} +2 -2
  15. package/dist/{manifest-texts-B8NV4YCS.mjs.map → manifest-texts-K650kDy8.mjs.map} +1 -1
  16. package/dist/oxlint.mjs +2 -2
  17. package/dist/{pass-records-C5tcV6Qh.mjs → pass-records-kbx5VgwI.mjs} +4 -4
  18. package/dist/{pass-records-C5tcV6Qh.mjs.map → pass-records-kbx5VgwI.mjs.map} +1 -1
  19. package/dist/{problem-BvRpVt97.mjs → problem-Ciud2WGj.mjs} +2 -2
  20. package/dist/{problem-BvRpVt97.mjs.map → problem-Ciud2WGj.mjs.map} +1 -1
  21. package/dist/publish.mjs +55 -8
  22. package/dist/publish.mjs.map +1 -1
  23. package/dist/{published-l5wN7u0m.mjs → published-CpfXkChq.mjs} +3 -3
  24. package/dist/{published-l5wN7u0m.mjs.map → published-CpfXkChq.mjs.map} +1 -1
  25. package/dist/published.mjs +44 -26
  26. package/dist/published.mjs.map +1 -1
  27. package/dist/refs.mjs +3 -3
  28. package/dist/{repository-files-BxmKrOgg.mjs → repository-files-C2gVviac.mjs} +10 -1
  29. package/dist/repository-files-C2gVviac.mjs.map +1 -0
  30. package/dist/{runtime-C6khg0XJ.mjs → runtime-1exMm81b.mjs} +2 -2
  31. package/dist/{runtime-C6khg0XJ.mjs.map → runtime-1exMm81b.mjs.map} +1 -1
  32. package/dist/{syntax-V4CunkGE.mjs → syntax-Dx4HQIK-.mjs} +2 -2
  33. package/dist/{syntax-V4CunkGE.mjs.map → syntax-Dx4HQIK-.mjs.map} +1 -1
  34. package/dist/{upstream-exits-DLZh68ZH.mjs → upstream-exits-Clnl4-G5.mjs} +3 -3
  35. package/dist/{upstream-exits-DLZh68ZH.mjs.map → upstream-exits-Clnl4-G5.mjs.map} +1 -1
  36. package/dist/wake.mjs +1 -1
  37. package/dist/workspace-settings.mjs +4 -4
  38. package/package.json +2 -2
  39. package/skills/msch-checks/SKILL.md +2 -2
  40. package/skills/msch-publishing/SKILL.md +7 -6
  41. package/dist/repository-files-BxmKrOgg.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"published-l5wN7u0m.mjs","names":["Arr","Rec","CONFIG_FILE","taggedError","Arr","Rec","Arr","SEPARATOR","Str","Str","Rec","Arr","READ_CONCURRENCY","Arr","taggedError","Rec","Rec","Arr","Arr","Rec","Str","Str","Rec","Arr","Arr","Str","Rec","MANIFEST_FILE"],"sources":["../src/entities/workspace/model/config-literal.ts","../src/entities/workspace/model/workspace-config-source.ts","../src/entities/workspace/model/workspace-tasks.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/shadcn-ui.ts","../src/entities/workspace/model/deploy-entries.ts","../src/entities/workspace/model/lockfile-unreadable.ts","../src/entities/workspace/model/locked-packages.ts","../src/entities/workspace/model/locked-graph.ts","../src/entities/workspace/model/locked-links.ts","../src/entities/package/model/public-entries.ts","../src/entities/package/model/published.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nexport type Literal = string | number | boolean | null | readonly Literal[] | LiteralObject;\n\nexport interface LiteralObject {\n readonly [key: string]: Literal;\n}\n\nconst WRAPPERS = [\"TSAsExpression\", \"TSSatisfiesExpression\", \"ParenthesizedExpression\"] as const;\n\nexport const KeySchema = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"Literal\"), value: Schema.String }),\n]);\nconst Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });\nconst PropertyNode = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n});\nconst WrappedNode = Schema.Struct({ type: Schema.Literals(WRAPPERS), expression: Schema.Unknown });\nconst ValueNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"Literal\"),\n value: Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]),\n }),\n Schema.Struct({\n type: Schema.Literal(\"TemplateLiteral\"),\n expressions: Schema.Tuple([]),\n quasis: Schema.Array(Quasi),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ArrayExpression\"),\n elements: Schema.Array(Schema.Unknown),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(PropertyNode),\n }),\n]);\n\nconst decodeWrapped = Schema.decodeUnknownOption(WrappedNode);\nconst decodeValue = Schema.decodeUnknownOption(ValueNode);\nconst decodeProperty = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"Property\"), key: KeySchema, value: Schema.Unknown }),\n);\nconst decodeObject = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n);\n\nexport const keyName = (key: typeof KeySchema.Type): string =>\n Match.value(key).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Identifier: (identifier) => identifier.name,\n Literal: (literal) => literal.value,\n }),\n );\n\nexport const literalOf = (node: unknown): Option.Option<Literal> => {\n const wrapped = decodeWrapped(node);\n if (Option.isSome(wrapped)) {\n return literalOf(wrapped.value.expression);\n }\n return pipe(\n decodeValue(node),\n Option.flatMap((value) =>\n Match.value(value).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Literal: (scalar): Option.Option<Literal> => Option.some(scalar.value),\n TemplateLiteral: (template): Option.Option<Literal> =>\n Option.some(\n pipe(\n template.quasis,\n Arr.map((quasi) => quasi.value.cooked),\n Arr.join(\"\"),\n ),\n ),\n ArrayExpression: (array): Option.Option<Literal> =>\n pipe(array.elements, Arr.map(literalOf), Option.all),\n ObjectExpression: (object): Option.Option<Literal> =>\n pipe(\n object.properties,\n Arr.map((property) =>\n pipe(\n literalOf(property.value),\n Option.map((literal) => [keyName(property.key), literal] as const),\n ),\n ),\n Option.all,\n Option.map(Rec.fromEntries),\n ),\n }),\n ),\n ),\n );\n};\n\nexport const propertyValue =\n (name: string) =>\n (object: unknown): Option.Option<unknown> =>\n pipe(\n decodeObject(object),\n Option.flatMap(({ properties }) =>\n pipe(\n properties,\n Arr.findFirst((property) =>\n pipe(\n decodeProperty(property),\n Option.filter(({ key }) => keyName(key) === name),\n Option.map(({ value }) => value),\n ),\n ),\n ),\n ),\n );\n\nexport const childrenOf = (node: unknown): readonly unknown[] => {\n if (Arr.isArray(node)) {\n return node;\n }\n if (Predicate.isReadonlyObject(node)) {\n return Rec.values(node);\n }\n return [];\n};\n\nexport const nestedValues =\n (path: readonly [string, string]) =>\n (node: unknown): readonly unknown[] => {\n const [outer, inner] = path;\n const own = pipe(\n Option.some(node),\n Option.flatMap(propertyValue(outer)),\n Option.flatMap(propertyValue(inner)),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(nestedValues(path)))];\n };\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\nexport interface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nexport const stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { literalOf, nestedValues } from \"./config-literal.ts\";\n\nconst SINGLE = 1;\nconst CONFIG_FILE = \"vite.config.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceSettingsInvalid extends taggedError<\n WorkspaceSettingsInvalid,\n { readonly brand: unique symbol }\n>()(\"WorkspaceSettingsInvalid\", { file: Schema.String, message: Schema.String }) {}\n\nexport const settingsInvalid =\n (file: string) =>\n (reason: string): WorkspaceSettingsInvalid =>\n WorkspaceSettingsInvalid.make({ file, message: `${file}: ${reason}` });\n\nexport interface WorkspaceSource {\n readonly file: string;\n readonly directory: string;\n readonly program: unknown;\n}\n\nexport type SettingsPath = readonly [string, string];\n\nconst notLiteral = ([outer, inner]: SettingsPath): string =>\n `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Name a set the root config defines in use instead of importing values.`;\n\nexport const merged = <Value>(\n records: readonly Readonly<Record<string, Value>>[],\n): Record<string, Value> => pipe(records, Arr.flatMap(Rec.toEntries), Rec.fromEntries);\n\nexport const usedFrom = Effect.fn(\"usedFrom\")(function* usedFrom<Value>(\n file: string,\n sets: Readonly<Record<string, Value>>,\n used: readonly string[],\n) {\n const unknownSets = pipe(\n used,\n Arr.filter((name) => !Rec.has(sets, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(unknownSets)) {\n return yield* settingsInvalid(file)(\n `msch uses sets the root does not define: ${Arr.join(unknownSets, \", \")}. Defined: ${Arr.join(Rec.keys(sets), \", \")}.`,\n );\n }\n return pipe(\n used,\n Arr.flatMap((name) => Option.toArray(Rec.get(sets, name))),\n );\n});\n\nconst singleValue = Effect.fn(\"singleValue\")(function* singleValue(\n source: WorkspaceSource,\n path: SettingsPath,\n) {\n const found = nestedValues(path)(source.program);\n if (found.length > SINGLE) {\n return yield* settingsInvalid(source.file)(`${Arr.join(path, \".\")} appears more than once.`);\n }\n return Arr.head(found);\n});\n\nexport interface LiteralSettingsRequest<Settings> {\n readonly source: WorkspaceSource;\n readonly path: SettingsPath;\n readonly decode: (input: unknown) => Effect.Effect<Settings, Schema.SchemaError>;\n}\n\nexport const literalSettings = <Settings>({\n source,\n path,\n decode,\n}: LiteralSettingsRequest<Settings>): Effect.Effect<\n Option.Option<Settings>,\n WorkspaceSettingsInvalid\n> =>\n Effect.gen(function* literalSettingsIn() {\n const node = yield* singleValue(source, path);\n if (Option.isNone(node)) {\n return Option.none();\n }\n const literal = literalOf(node.value);\n if (Option.isNone(literal)) {\n return yield* settingsInvalid(source.file)(notLiteral(path));\n }\n const settings = yield* decode(literal.value).pipe(\n Effect.mapError((error) => settingsInvalid(source.file)(error.message)),\n );\n return Option.some(settings);\n });\n\nexport const programOf = Effect.fn(\"programOf\")(function* programOf(file: string, text: string) {\n const parsed = yield* Effect.promise(() => parse(file, text, { lang: \"ts\" }));\n if (Arr.isReadonlyArrayNonEmpty(parsed.errors)) {\n return yield* settingsInvalid(file)(\"vite.config.ts does not parse.\");\n }\n const program: unknown = parsed.program;\n return program;\n});\n\n/** @internal */\nexport interface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Manifest } from \"#/entities/package/@x/workspace.ts\";\n\nimport { nestedValues, propertyValue, stringsIn } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const VERIFY_TASK = [\"tasks\", \"verify\"] as const;\n\nexport const TEST_TASK = [\"tasks\", \"test\"] as const;\n\nconst NATIVE_TASK = [\"tasks\", \"native\"] as const;\n\nexport const RUN_TASKS = [\"run\", \"tasks\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n readonly native: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [], native: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nconst TEST_TASK_NAME = \"test\";\nconst DEPENDS_ON = \"dependsOn\";\n\nexport const testsItself = (program: unknown): boolean =>\n definesTask(TEST_TASK)(program) ||\n pipe(\n nestedValues(VERIFY_TASK)(program),\n Arr.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))),\n Arr.flatMap(stringsIn),\n Arr.some(({ text }) => text === TEST_TASK_NAME),\n );\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n return Option.exists(config, isVerified);\n});\n\nconst shipsAddon = (manifest: Option.Option<Manifest>): boolean =>\n Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));\n\nexport const tasksOf =\n (manifest: Option.Option<Manifest>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (name) => ({\n verify: Arr.getSomes([\n Option.liftPredicate(`${name}#verify`, () => definesTask(VERIFY_TASK)(program)),\n Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)),\n ]),\n native: Arr.filter(\n [`${name}#native`],\n () => definesTask(NATIVE_TASK)(program) || shipsAddon(manifest),\n ),\n }),\n }),\n );\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { prefixed, withoutRelative } from \"./workspace-patterns.ts\";\n\nconst SHADCN_FILE = \"components.json\";\nconst MANIFEST_FILE = \"package.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst ManifestImports = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\nconst decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));\n\nconst withoutWildcard = Str.replace(WILDCARD, \"\");\n\nconst importTarget =\n (alias: string) =>\n ([key, target]: readonly [string, string]): Option.Option<string> => {\n if (!Str.endsWith(WILDCARD)(key)) {\n return Option.some(target).pipe(Option.filter(() => key === alias));\n }\n const prefix = withoutWildcard(key);\n if (!Str.startsWith(prefix)(alias)) {\n return Option.none();\n }\n return Option.some(`${withoutWildcard(target)}${Str.slice(prefix.length)(alias)}`);\n };\n\nconst resolvedAlias = (\n imports: Readonly<Record<string, string>>,\n alias: string,\n): Option.Option<string> =>\n pipe(Rec.toEntries(imports), Arr.findFirst(importTarget(alias)), Option.map(withoutRelative));\n\nexport type ShadcnUi = Readonly<{\n file: string;\n alias: string;\n target: Option.Option<string>;\n}>;\n\nexport const shadcnUiOf = Effect.fn(\"shadcnUiOf\")(function* shadcnUiOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SHADCN_FILE);\n const configText = yield* files.readFile(file);\n const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodeManifestImports),\n Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }): ShadcnUi => ({\n file,\n alias: aliases.ui,\n target: pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n ),\n })),\n );\n});\n\nexport const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(\n root: string,\n directory: string,\n) {\n const found = yield* shadcnUiOf(root, directory);\n return pipe(\n found,\n Option.map(\n ({ alias, target }) =>\n `${prefixed(directory)(Option.getOrElse(target, () => alias))}${EVERYTHING}`,\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { KeySchema, childrenOf, keyName, stringsIn } from \"./config-literal.ts\";\n\nconst MAIN_KEY = \"main\";\nconst FRAMEWORK_SITES = \"Website\";\nconst READ_CONCURRENCY = 16;\nconst SCRIPT = /\\.[cm]?tsx?$/u;\nconst SKIPPED = /\\.test\\.|\\.d\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst MAIN_PROPERTY = /\\bmain\\s*:/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\nconst SiteNamespace = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(FRAMEWORK_SITES),\n});\nconst SiteResource = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n object: SiteNamespace,\n});\nconst FrameworkSite = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: SiteResource,\n});\nconst decodeFrameworkSite = Schema.decodeUnknownOption(FrameworkSite);\n\nconst isMainProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => keyName(key) === MAIN_KEY),\n );\n\ntype Skip = (node: unknown) => boolean;\n\nconst skipNothing: Skip = () => false;\n\nconst isFrameworkSite: Skip = (node) => Option.isSome(decodeFrameworkSite(node));\n\nconst mainTargetsIn = (skip: Skip): ((node: unknown) => readonly string[]) => {\n const visit = (node: unknown): readonly string[] => {\n if (skip(node)) {\n return [];\n }\n if (Predicate.isReadonlyObject(node) && isMainProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.head,\n Option.map(({ text }) => text),\n Option.toArray,\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(visit));\n };\n return visit;\n};\n\ninterface Declaring {\n readonly root: string;\n readonly file: string;\n readonly skip: Skip;\n}\n\nconst declaredIn = Effect.fn(\"declaredIn\")(function* declaredIn({ root, file, skip }: Declaring) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value) || !MAIN_PROPERTY.test(text.value)) {\n return [];\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return pipe(\n mainTargetsIn(skip)(parsed.program),\n Arr.map((target) => files.join(files.dirname(file), target)),\n );\n});\n\nconst entriesOutside = Effect.fn(\"entriesOutside\")(function* entriesOutside(\n root: string,\n skip: Skip,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const declaring = pipe(\n listed,\n Arr.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)),\n );\n const found = yield* Effect.forEach(declaring, (file) => declaredIn({ root, file, skip }), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(\n Arr.flatten(found),\n Arr.filter((file) => Arr.contains(listed, file)),\n Arr.dedupe,\n );\n});\n\nexport const deployEntries = Effect.fn(\"deployEntries\")(function* deployEntries(root: string) {\n return yield* entriesOutside(root, skipNothing);\n});\n\nexport const bundledEntries = Effect.fn(\"bundledEntries\")(function* bundledEntries(root: string) {\n return yield* entriesOutside(root, isFrameworkSite);\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class LockfileUnreadable extends taggedError<\n LockfileUnreadable,\n { readonly brand: unique symbol }\n>()(\"LockfileUnreadable\", { root: Schema.String, reason: Schema.String }) {}\n","import { readWantedLockfile } from \"@pnpm/lockfile.fs\";\nimport { Effect, Option, Record as Rec } from \"effect\";\n\nimport { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport type WantedLockfile = NonNullable<Awaited<ReturnType<typeof readWantedLockfile>>>;\n\nconst readLockfile =\n <Selected>(select: (lockfile: WantedLockfile) => Option.Option<Selected>) =>\n (root: string): Effect.Effect<Option.Option<Selected>, LockfileUnreadable> =>\n Effect.tryPromise({\n try: () => readWantedLockfile(root, { ignoreIncompatible: false }),\n catch: (cause) => LockfileUnreadable.make({ root, reason: String(cause) }),\n }).pipe(Effect.map(Option.fromNullishOr), Effect.map(Option.flatMap(select)));\n\n/** @internal */\nexport const wantedLockfile = readLockfile(Option.some);\n\n/** @internal */\nexport const lockedPackages = readLockfile(({ packages }) =>\n Option.map(Option.fromUndefinedOr(packages), Rec.keys),\n);\n","import { refToRelative } from \"@pnpm/deps.path\";\nimport { Array as Arr, Effect, Option, Record as Rec, pipe } from \"effect\";\n\nimport { wantedLockfile } from \"./locked-packages.ts\";\nimport type { WantedLockfile } from \"./locked-packages.ts\";\nimport type { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport interface LockedNode {\n readonly id: string;\n readonly dependencies: readonly string[];\n}\n\nconst MANIFEST = \"package.json\";\nconst ROOT_IMPORTER = \".\";\n\ntype ProjectSnapshot = WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]];\n\ntype ResolvedSections = Readonly<\n Partial<Pick<ProjectSnapshot, \"dependencies\" | \"devDependencies\" | \"optionalDependencies\">>\n>;\n\nexport type ResolvedDependencies = Readonly<\n NonNullable<WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]][\"dependencies\"]>\n>;\n\ninterface LockedSnapshots<Importer extends string, Package extends string> {\n readonly importers: Readonly<Record<Importer, ResolvedSections>>;\n readonly packages?: Readonly<Record<Package, ResolvedSections>> | undefined;\n}\n\nconst importerManifest = (id: string): string =>\n Option.match(\n Option.liftPredicate(id, (found) => found === ROOT_IMPORTER),\n {\n onNone: () => `${id}/${MANIFEST}`,\n onSome: () => MANIFEST,\n },\n );\n\nexport const depPathsOf = (resolved: ResolvedDependencies | undefined): readonly string[] =>\n pipe(\n Rec.toEntries(resolved ?? {}),\n Arr.flatMap(([name, reference]) =>\n Option.toArray(Option.fromNullishOr(refToRelative(reference, name))),\n ),\n );\n\nconst nodesOf = <Importer extends string, Package extends string>(\n lockfile: LockedSnapshots<Importer, Package>,\n): readonly LockedNode[] => [\n ...pipe(\n Rec.toEntries(lockfile.importers),\n Arr.map(([id, project]) => ({\n id: importerManifest(id),\n dependencies: [\n ...depPathsOf(project.dependencies),\n ...depPathsOf(project.devDependencies),\n ...depPathsOf(project.optionalDependencies),\n ],\n })),\n ),\n ...pipe(\n Option.match(Option.fromUndefinedOr(lockfile.packages), {\n onNone: (): readonly (readonly [Package, ResolvedSections])[] => [],\n onSome: Rec.toEntries,\n }),\n Arr.map(([id, snapshot]) => ({\n id,\n dependencies: [\n ...depPathsOf(snapshot.dependencies),\n ...depPathsOf(snapshot.optionalDependencies),\n ],\n })),\n ),\n];\n\n/** @internal */\nexport const lockedGraph = (\n root: string,\n): Effect.Effect<Option.Option<readonly LockedNode[]>, LockfileUnreadable> =>\n wantedLockfile(root).pipe(Effect.map(Option.map(nodesOf)));\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\nconst LINK = \"link:\";\n\nexport interface WorkspaceLink {\n readonly from: string;\n readonly to: string;\n}\n\nexport const linkedPaths = (\n sections: readonly (ResolvedDependencies | undefined)[],\n): readonly string[] =>\n pipe(\n sections,\n Arr.flatMap((resolved) => Rec.values(resolved ?? {})),\n Arr.filter(Str.startsWith(LINK)),\n Arr.map((reference) => Str.slice(LINK.length)(reference)),\n );\n\n/** @internal */\nexport const workspaceLinks = Effect.fn(\"workspaceLinks\")(function* workspaceLinks(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const linksOf = (id: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const from = files.relative(root, files.join(root, id));\n return pipe(\n paths,\n Arr.map((path): WorkspaceLink => ({\n from,\n to: files.relative(root, files.join(root, id, path)),\n })),\n );\n };\n return pipe(\n lockfile,\n Option.map(({ importers }) =>\n pipe(\n Rec.toEntries(importers),\n Arr.flatMap(([id, project]) =>\n linksOf(\n id,\n linkedPaths([\n project.dependencies,\n project.devDependencies,\n project.optionalDependencies,\n ]),\n ),\n ),\n ),\n ),\n Option.getOrElse((): readonly WorkspaceLink[] => []),\n );\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { exportEntriesOf } from \"./export-subpaths.ts\";\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport interface EntryManifest {\n readonly name?: string | undefined;\n readonly exports?: unknown;\n readonly bin?: unknown;\n}\n\nexport interface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nexport const isBinEntry = ({ label }: PublicEntry): boolean =>\n Str.startsWith(`${BIN_LABEL} `)(label);\n\nexport const targetsIn = (held: unknown): readonly string[] => {\n if (Predicate.isString(held)) {\n return [held];\n }\n if (!Predicate.isObject(held)) {\n return [];\n }\n return pipe(Rec.values(held), Arr.flatMap(targetsIn));\n};\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] => {\n if (Predicate.isString(manifest.bin)) {\n const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => \"\");\n return [[`${BIN_LABEL} ${name}`, manifest.bin]];\n }\n if (!Predicate.isObject(manifest.bin)) {\n return [];\n }\n return pipe(\n Rec.toEntries(manifest.bin),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n};\n\nexport const entryNameOf = (target: string): string => Str.replace(BUILT, \"\")(baseName(target));\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = entryNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nexport const publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...exportEntriesOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n\nconst EntryManifestFields = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nexport const EntryManifestJson = Schema.fromJsonString(EntryManifestFields);\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nexport const PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst AlwaysBundle = Schema.Array(Schema.String);\nconst PackDeps = Schema.Struct({ alwaysBundle: Schema.optional(AlwaysBundle) });\nconst PackSettings = Schema.Struct({\n entry: Schema.optional(PackEntry),\n deps: Schema.optional(PackDeps),\n});\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst PackConfig = Schema.Struct({ pack: Schema.optional(PackList) });\nconst BudgetConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n});\nconst PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(false)) });\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nexport interface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\nexport interface PackedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly packEntries: readonly PackEntrySource[];\n readonly alwaysBundle: readonly string[];\n}\n\nexport interface PublishedWorkspace extends PackedWorkspace {\n readonly installSize: string;\n readonly installBudget: number;\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nexport const entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packSettingsOf = (pack: typeof PackConfig.Type.pack): readonly (typeof PackSettings.Type)[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n );\n\nconst packEntriesOf = (pack: typeof PackConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst alwaysBundleOf = (pack: typeof PackConfig.Type.pack): readonly string[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.deps),\n Option.flatMap((deps) => Option.fromUndefinedOr(deps.alwaysBundle)),\n Option.getOrElse((): readonly string[] => []),\n ),\n ),\n Arr.dedupe,\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return config;\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return Option.exists(text, (found) =>\n Option.isSome(Schema.decodeOption(Schema.fromJsonString(PublicManifest))(found)),\n );\n});\n\nconst packedWorkspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ pack }: typeof PackConfig.Type): PackedWorkspace => ({\n directory,\n configFile,\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n alwaysBundle: alwaysBundleOf(pack),\n });\n\nconst budgetOf = ({\n msch,\n}: typeof BudgetConfig.Type): Pick<PublishedWorkspace, \"installSize\" | \"installBudget\"> => {\n const [amount, , unit] = msch.publish.installSize;\n return { installSize: `${amount} ${unit}`, installBudget: amount * bytesPer(unit) };\n};\n\nconst packedIn = Effect.fn(\"packedIn\")(function* packedIn(root: string, configName: string) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<readonly [PackedWorkspace, unknown]>();\n }\n const config = yield* settingsIn(configFile);\n return pipe(\n config,\n Option.flatMap((found) =>\n pipe(\n Schema.decodeUnknownOption(PackConfig)(found),\n Option.map(\n packedWorkspaceOf(directory, configFile, (source) => files.join(directory, source)),\n ),\n Option.map((workspace) => [workspace, found] as const),\n ),\n ),\n );\n});\n\nconst packedPairs = Effect.fn(\"packedPairs\")(function* packedPairs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const configs = pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n const found = yield* Effect.forEach(configs, (name) => packedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\n/** @internal */\nexport const packedWorkspaces = Effect.fn(\"packedWorkspaces\")(function* packedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.map(([workspace]) => workspace),\n );\n});\n\n/** @internal */\nexport const publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.flatMap(([workspace, config]) =>\n pipe(\n Schema.decodeUnknownOption(BudgetConfig)(config),\n Option.map((budget): PublishedWorkspace => ({ ...workspace, ...budg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AAoB,UAAU,CAAC,CAAC,KAAK,GAC5C,OAAO,IACL,kBAAkB,WAAW,aAAa,WAAW,MAAM,KAAK,WAAW,MAAM,CAAC,CACpF,GACA,OAAO,KAAK,cAAc,CAAC,WAAW,KAAK,CAAU,CACvD,CACF,CACF;AACF,CAAC;AAED,MAAM,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CAC/E,MAAM,QAAQ,OAAO;CACrB,MAAM,QAAQ,OAAO,MAAM,YAAY,IAAI;CAC3C,MAAM,UAAU,KACd,OACAA,MAAI,QAAQ,SAAS,MAAM,SAAS,IAAI,MAAM,eAAeC,SAAI,SAAS,SAAS,CAAC,CAAC,IAAI,CAAC,CAC5F;CACA,MAAM,QAAQ,OAAO,OAAO,QAAQ,UAAU,SAAS,SAAS,MAAM,IAAI,GAAG,EAC3E,aAAa,iBACf,CAAC;CACD,OAAOD,MAAI,SAAS,KAAK;AAC3B,CAAC;;AAGD,MAAa,mBAAmB,OAAO,GAAG,kBAAkB,CAAC,CAAC,UAAU,iBACtE,MACA;CACA,MAAM,QAAQ,OAAO,YAAY,IAAI;CACrC,OAAO,KACL,OACAA,MAAI,KAAK,CAAC,eAAe,SAAS,CACpC;AACF,CAAC;;AAGD,MAAa,sBAAsB,OAAO,GAAG,qBAAqB,CAAC,CAAC,UAAU,oBAC5E,MACA;CACA,MAAM,QAAQ,OAAO,YAAY,IAAI;CACrC,OAAO,KACL,OACAA,MAAI,SAAS,CAAC,WAAW,YACvB,KACE,OAAO,oBAAoB,YAAY,CAAC,CAAC,MAAM,GAC/C,OAAO,KAAK,YAAgC;EAAE,GAAG;EAAW,GAAG,SAAS,MAAM;CAAE,EAAE,GAClF,OAAO,OACT,CACF,CACF;AACF,CAAC"}
1
+ {"version":3,"file":"published-CpfXkChq.mjs","names":["Arr","Rec","CONFIG_FILE","taggedError","Arr","Rec","Arr","SEPARATOR","Str","Str","Rec","Arr","READ_CONCURRENCY","Arr","taggedError","Rec","Rec","Arr","Arr","Rec","Str","Str","Rec","Arr","Arr","Str","Rec","MANIFEST_FILE"],"sources":["../src/entities/workspace/model/config-literal.ts","../src/entities/workspace/model/workspace-config-source.ts","../src/entities/workspace/model/workspace-tasks.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/shadcn-ui.ts","../src/entities/workspace/model/deploy-entries.ts","../src/entities/workspace/model/lockfile-unreadable.ts","../src/entities/workspace/model/locked-packages.ts","../src/entities/workspace/model/locked-graph.ts","../src/entities/workspace/model/locked-links.ts","../src/entities/package/model/public-entries.ts","../src/entities/package/model/published.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nexport type Literal = string | number | boolean | null | readonly Literal[] | LiteralObject;\n\nexport interface LiteralObject {\n readonly [key: string]: Literal;\n}\n\nconst WRAPPERS = [\"TSAsExpression\", \"TSSatisfiesExpression\", \"ParenthesizedExpression\"] as const;\n\nexport const KeySchema = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"Literal\"), value: Schema.String }),\n]);\nconst Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });\nconst PropertyNode = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n});\nconst WrappedNode = Schema.Struct({ type: Schema.Literals(WRAPPERS), expression: Schema.Unknown });\nconst ValueNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"Literal\"),\n value: Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]),\n }),\n Schema.Struct({\n type: Schema.Literal(\"TemplateLiteral\"),\n expressions: Schema.Tuple([]),\n quasis: Schema.Array(Quasi),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ArrayExpression\"),\n elements: Schema.Array(Schema.Unknown),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(PropertyNode),\n }),\n]);\n\nconst decodeWrapped = Schema.decodeUnknownOption(WrappedNode);\nconst decodeValue = Schema.decodeUnknownOption(ValueNode);\nconst decodeProperty = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"Property\"), key: KeySchema, value: Schema.Unknown }),\n);\nconst decodeObject = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n);\n\nexport const keyName = (key: typeof KeySchema.Type): string =>\n Match.value(key).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Identifier: (identifier) => identifier.name,\n Literal: (literal) => literal.value,\n }),\n );\n\nexport const literalOf = (node: unknown): Option.Option<Literal> => {\n const wrapped = decodeWrapped(node);\n if (Option.isSome(wrapped)) {\n return literalOf(wrapped.value.expression);\n }\n return pipe(\n decodeValue(node),\n Option.flatMap((value) =>\n Match.value(value).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Literal: (scalar): Option.Option<Literal> => Option.some(scalar.value),\n TemplateLiteral: (template): Option.Option<Literal> =>\n Option.some(\n pipe(\n template.quasis,\n Arr.map((quasi) => quasi.value.cooked),\n Arr.join(\"\"),\n ),\n ),\n ArrayExpression: (array): Option.Option<Literal> =>\n pipe(array.elements, Arr.map(literalOf), Option.all),\n ObjectExpression: (object): Option.Option<Literal> =>\n pipe(\n object.properties,\n Arr.map((property) =>\n pipe(\n literalOf(property.value),\n Option.map((literal) => [keyName(property.key), literal] as const),\n ),\n ),\n Option.all,\n Option.map(Rec.fromEntries),\n ),\n }),\n ),\n ),\n );\n};\n\nexport const propertyValue =\n (name: string) =>\n (object: unknown): Option.Option<unknown> =>\n pipe(\n decodeObject(object),\n Option.flatMap(({ properties }) =>\n pipe(\n properties,\n Arr.findFirst((property) =>\n pipe(\n decodeProperty(property),\n Option.filter(({ key }) => keyName(key) === name),\n Option.map(({ value }) => value),\n ),\n ),\n ),\n ),\n );\n\nexport const childrenOf = (node: unknown): readonly unknown[] => {\n if (Arr.isArray(node)) {\n return node;\n }\n if (Predicate.isReadonlyObject(node)) {\n return Rec.values(node);\n }\n return [];\n};\n\nexport const nestedValues =\n (path: readonly [string, string]) =>\n (node: unknown): readonly unknown[] => {\n const [outer, inner] = path;\n const own = pipe(\n Option.some(node),\n Option.flatMap(propertyValue(outer)),\n Option.flatMap(propertyValue(inner)),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(nestedValues(path)))];\n };\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\nexport interface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nexport const stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { literalOf, nestedValues } from \"./config-literal.ts\";\n\nconst SINGLE = 1;\nconst CONFIG_FILE = \"vite.config.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceSettingsInvalid extends taggedError<\n WorkspaceSettingsInvalid,\n { readonly brand: unique symbol }\n>()(\"WorkspaceSettingsInvalid\", { file: Schema.String, message: Schema.String }) {}\n\nexport const settingsInvalid =\n (file: string) =>\n (reason: string): WorkspaceSettingsInvalid =>\n WorkspaceSettingsInvalid.make({ file, message: `${file}: ${reason}` });\n\nexport interface WorkspaceSource {\n readonly file: string;\n readonly directory: string;\n readonly program: unknown;\n}\n\nexport type SettingsPath = readonly [string, string];\n\nconst notLiteral = ([outer, inner]: SettingsPath): string =>\n `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Name a set the root config defines in use instead of importing values.`;\n\nexport const merged = <Value>(\n records: readonly Readonly<Record<string, Value>>[],\n): Record<string, Value> => pipe(records, Arr.flatMap(Rec.toEntries), Rec.fromEntries);\n\nexport const usedFrom = Effect.fn(\"usedFrom\")(function* usedFrom<Value>(\n file: string,\n sets: Readonly<Record<string, Value>>,\n used: readonly string[],\n) {\n const unknownSets = pipe(\n used,\n Arr.filter((name) => !Rec.has(sets, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(unknownSets)) {\n return yield* settingsInvalid(file)(\n `msch uses sets the root does not define: ${Arr.join(unknownSets, \", \")}. Defined: ${Arr.join(Rec.keys(sets), \", \")}.`,\n );\n }\n return pipe(\n used,\n Arr.flatMap((name) => Option.toArray(Rec.get(sets, name))),\n );\n});\n\nconst singleValue = Effect.fn(\"singleValue\")(function* singleValue(\n source: WorkspaceSource,\n path: SettingsPath,\n) {\n const found = nestedValues(path)(source.program);\n if (found.length > SINGLE) {\n return yield* settingsInvalid(source.file)(`${Arr.join(path, \".\")} appears more than once.`);\n }\n return Arr.head(found);\n});\n\nexport interface LiteralSettingsRequest<Settings> {\n readonly source: WorkspaceSource;\n readonly path: SettingsPath;\n readonly decode: (input: unknown) => Effect.Effect<Settings, Schema.SchemaError>;\n}\n\nexport const literalSettings = <Settings>({\n source,\n path,\n decode,\n}: LiteralSettingsRequest<Settings>): Effect.Effect<\n Option.Option<Settings>,\n WorkspaceSettingsInvalid\n> =>\n Effect.gen(function* literalSettingsIn() {\n const node = yield* singleValue(source, path);\n if (Option.isNone(node)) {\n return Option.none();\n }\n const literal = literalOf(node.value);\n if (Option.isNone(literal)) {\n return yield* settingsInvalid(source.file)(notLiteral(path));\n }\n const settings = yield* decode(literal.value).pipe(\n Effect.mapError((error) => settingsInvalid(source.file)(error.message)),\n );\n return Option.some(settings);\n });\n\nexport const programOf = Effect.fn(\"programOf\")(function* programOf(file: string, text: string) {\n const parsed = yield* Effect.promise(() => parse(file, text, { lang: \"ts\" }));\n if (Arr.isReadonlyArrayNonEmpty(parsed.errors)) {\n return yield* settingsInvalid(file)(\"vite.config.ts does not parse.\");\n }\n const program: unknown = parsed.program;\n return program;\n});\n\n/** @internal */\nexport interface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Manifest } from \"#/entities/package/@x/workspace.ts\";\n\nimport { nestedValues, propertyValue, stringsIn } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const VERIFY_TASK = [\"tasks\", \"verify\"] as const;\n\nexport const TEST_TASK = [\"tasks\", \"test\"] as const;\n\nconst NATIVE_TASK = [\"tasks\", \"native\"] as const;\n\nexport const RUN_TASKS = [\"run\", \"tasks\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n readonly native: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [], native: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nconst TEST_TASK_NAME = \"test\";\nconst DEPENDS_ON = \"dependsOn\";\n\nexport const testsItself = (program: unknown): boolean =>\n definesTask(TEST_TASK)(program) ||\n pipe(\n nestedValues(VERIFY_TASK)(program),\n Arr.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))),\n Arr.flatMap(stringsIn),\n Arr.some(({ text }) => text === TEST_TASK_NAME),\n );\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n return Option.exists(config, isVerified);\n});\n\nconst shipsAddon = (manifest: Option.Option<Manifest>): boolean =>\n Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));\n\nexport const tasksOf =\n (manifest: Option.Option<Manifest>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (name) => ({\n verify: Arr.getSomes([\n Option.liftPredicate(`${name}#verify`, () => definesTask(VERIFY_TASK)(program)),\n Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)),\n ]),\n native: Arr.filter(\n [`${name}#native`],\n () => definesTask(NATIVE_TASK)(program) || shipsAddon(manifest),\n ),\n }),\n }),\n );\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { prefixed, withoutRelative } from \"./workspace-patterns.ts\";\n\nconst SHADCN_FILE = \"components.json\";\nconst MANIFEST_FILE = \"package.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst ManifestImports = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\nconst decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));\n\nconst withoutWildcard = Str.replace(WILDCARD, \"\");\n\nconst importTarget =\n (alias: string) =>\n ([key, target]: readonly [string, string]): Option.Option<string> => {\n if (!Str.endsWith(WILDCARD)(key)) {\n return Option.some(target).pipe(Option.filter(() => key === alias));\n }\n const prefix = withoutWildcard(key);\n if (!Str.startsWith(prefix)(alias)) {\n return Option.none();\n }\n return Option.some(`${withoutWildcard(target)}${Str.slice(prefix.length)(alias)}`);\n };\n\nconst resolvedAlias = (\n imports: Readonly<Record<string, string>>,\n alias: string,\n): Option.Option<string> =>\n pipe(Rec.toEntries(imports), Arr.findFirst(importTarget(alias)), Option.map(withoutRelative));\n\nexport type ShadcnUi = Readonly<{\n file: string;\n alias: string;\n target: Option.Option<string>;\n}>;\n\nexport const shadcnUiOf = Effect.fn(\"shadcnUiOf\")(function* shadcnUiOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SHADCN_FILE);\n const configText = yield* files.readFile(file);\n const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodeManifestImports),\n Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }): ShadcnUi => ({\n file,\n alias: aliases.ui,\n target: pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n ),\n })),\n );\n});\n\nexport const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(\n root: string,\n directory: string,\n) {\n const found = yield* shadcnUiOf(root, directory);\n return pipe(\n found,\n Option.map(\n ({ alias, target }) =>\n `${prefixed(directory)(Option.getOrElse(target, () => alias))}${EVERYTHING}`,\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { KeySchema, childrenOf, keyName, stringsIn } from \"./config-literal.ts\";\n\nconst MAIN_KEY = \"main\";\nconst FRAMEWORK_SITES = \"Website\";\nconst READ_CONCURRENCY = 16;\nconst SCRIPT = /\\.[cm]?tsx?$/u;\nconst SKIPPED = /\\.test\\.|\\.d\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst MAIN_PROPERTY = /\\bmain\\s*:/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\nconst SiteNamespace = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(FRAMEWORK_SITES),\n});\nconst SiteResource = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n object: SiteNamespace,\n});\nconst FrameworkSite = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: SiteResource,\n});\nconst decodeFrameworkSite = Schema.decodeUnknownOption(FrameworkSite);\n\nconst isMainProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => keyName(key) === MAIN_KEY),\n );\n\ntype Skip = (node: unknown) => boolean;\n\nconst skipNothing: Skip = () => false;\n\nconst isFrameworkSite: Skip = (node) => Option.isSome(decodeFrameworkSite(node));\n\nconst mainTargetsIn = (skip: Skip): ((node: unknown) => readonly string[]) => {\n const visit = (node: unknown): readonly string[] => {\n if (skip(node)) {\n return [];\n }\n if (Predicate.isReadonlyObject(node) && isMainProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.head,\n Option.map(({ text }) => text),\n Option.toArray,\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(visit));\n };\n return visit;\n};\n\ninterface Declaring {\n readonly root: string;\n readonly file: string;\n readonly skip: Skip;\n}\n\nconst declaredIn = Effect.fn(\"declaredIn\")(function* declaredIn({ root, file, skip }: Declaring) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value) || !MAIN_PROPERTY.test(text.value)) {\n return [];\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return pipe(\n mainTargetsIn(skip)(parsed.program),\n Arr.map((target) => files.join(files.dirname(file), target)),\n );\n});\n\nconst entriesOutside = Effect.fn(\"entriesOutside\")(function* entriesOutside(\n root: string,\n skip: Skip,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const declaring = pipe(\n listed,\n Arr.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)),\n );\n const found = yield* Effect.forEach(declaring, (file) => declaredIn({ root, file, skip }), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(\n Arr.flatten(found),\n Arr.filter((file) => Arr.contains(listed, file)),\n Arr.dedupe,\n );\n});\n\nexport const deployEntries = Effect.fn(\"deployEntries\")(function* deployEntries(root: string) {\n return yield* entriesOutside(root, skipNothing);\n});\n\nexport const bundledEntries = Effect.fn(\"bundledEntries\")(function* bundledEntries(root: string) {\n return yield* entriesOutside(root, isFrameworkSite);\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class LockfileUnreadable extends taggedError<\n LockfileUnreadable,\n { readonly brand: unique symbol }\n>()(\"LockfileUnreadable\", { root: Schema.String, reason: Schema.String }) {}\n","import { readWantedLockfile } from \"@pnpm/lockfile.fs\";\nimport { Effect, Option, Record as Rec } from \"effect\";\n\nimport { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport type WantedLockfile = NonNullable<Awaited<ReturnType<typeof readWantedLockfile>>>;\n\nconst readLockfile =\n <Selected>(select: (lockfile: WantedLockfile) => Option.Option<Selected>) =>\n (root: string): Effect.Effect<Option.Option<Selected>, LockfileUnreadable> =>\n Effect.tryPromise({\n try: () => readWantedLockfile(root, { ignoreIncompatible: false }),\n catch: (cause) => LockfileUnreadable.make({ root, reason: String(cause) }),\n }).pipe(Effect.map(Option.fromNullishOr), Effect.map(Option.flatMap(select)));\n\n/** @internal */\nexport const wantedLockfile = readLockfile(Option.some);\n\n/** @internal */\nexport const lockedPackages = readLockfile(({ packages }) =>\n Option.map(Option.fromUndefinedOr(packages), Rec.keys),\n);\n","import { refToRelative } from \"@pnpm/deps.path\";\nimport { Array as Arr, Effect, Option, Record as Rec, pipe } from \"effect\";\n\nimport { wantedLockfile } from \"./locked-packages.ts\";\nimport type { WantedLockfile } from \"./locked-packages.ts\";\nimport type { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport interface LockedNode {\n readonly id: string;\n readonly dependencies: readonly string[];\n}\n\nconst MANIFEST = \"package.json\";\nconst ROOT_IMPORTER = \".\";\n\ntype ProjectSnapshot = WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]];\n\ntype ResolvedSections = Readonly<\n Partial<Pick<ProjectSnapshot, \"dependencies\" | \"devDependencies\" | \"optionalDependencies\">>\n>;\n\nexport type ResolvedDependencies = Readonly<\n NonNullable<WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]][\"dependencies\"]>\n>;\n\ninterface LockedSnapshots<Importer extends string, Package extends string> {\n readonly importers: Readonly<Record<Importer, ResolvedSections>>;\n readonly packages?: Readonly<Record<Package, ResolvedSections>> | undefined;\n}\n\nconst importerManifest = (id: string): string =>\n Option.match(\n Option.liftPredicate(id, (found) => found === ROOT_IMPORTER),\n {\n onNone: () => `${id}/${MANIFEST}`,\n onSome: () => MANIFEST,\n },\n );\n\nexport const depPathsOf = (resolved: ResolvedDependencies | undefined): readonly string[] =>\n pipe(\n Rec.toEntries(resolved ?? {}),\n Arr.flatMap(([name, reference]) =>\n Option.toArray(Option.fromNullishOr(refToRelative(reference, name))),\n ),\n );\n\nconst nodesOf = <Importer extends string, Package extends string>(\n lockfile: LockedSnapshots<Importer, Package>,\n): readonly LockedNode[] => [\n ...pipe(\n Rec.toEntries(lockfile.importers),\n Arr.map(([id, project]) => ({\n id: importerManifest(id),\n dependencies: [\n ...depPathsOf(project.dependencies),\n ...depPathsOf(project.devDependencies),\n ...depPathsOf(project.optionalDependencies),\n ],\n })),\n ),\n ...pipe(\n Option.match(Option.fromUndefinedOr(lockfile.packages), {\n onNone: (): readonly (readonly [Package, ResolvedSections])[] => [],\n onSome: Rec.toEntries,\n }),\n Arr.map(([id, snapshot]) => ({\n id,\n dependencies: [\n ...depPathsOf(snapshot.dependencies),\n ...depPathsOf(snapshot.optionalDependencies),\n ],\n })),\n ),\n];\n\n/** @internal */\nexport const lockedGraph = (\n root: string,\n): Effect.Effect<Option.Option<readonly LockedNode[]>, LockfileUnreadable> =>\n wantedLockfile(root).pipe(Effect.map(Option.map(nodesOf)));\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\nconst LINK = \"link:\";\n\nexport interface WorkspaceLink {\n readonly from: string;\n readonly to: string;\n}\n\nexport const linkedPaths = (\n sections: readonly (ResolvedDependencies | undefined)[],\n): readonly string[] =>\n pipe(\n sections,\n Arr.flatMap((resolved) => Rec.values(resolved ?? {})),\n Arr.filter(Str.startsWith(LINK)),\n Arr.map((reference) => Str.slice(LINK.length)(reference)),\n );\n\n/** @internal */\nexport const workspaceLinks = Effect.fn(\"workspaceLinks\")(function* workspaceLinks(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const linksOf = (id: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const from = files.relative(root, files.join(root, id));\n return pipe(\n paths,\n Arr.map((path): WorkspaceLink => ({\n from,\n to: files.relative(root, files.join(root, id, path)),\n })),\n );\n };\n return pipe(\n lockfile,\n Option.map(({ importers }) =>\n pipe(\n Rec.toEntries(importers),\n Arr.flatMap(([id, project]) =>\n linksOf(\n id,\n linkedPaths([\n project.dependencies,\n project.devDependencies,\n project.optionalDependencies,\n ]),\n ),\n ),\n ),\n ),\n Option.getOrElse((): readonly WorkspaceLink[] => []),\n );\n});\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { exportEntriesOf } from \"./export-subpaths.ts\";\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport interface EntryManifest {\n readonly name?: string | undefined;\n readonly exports?: unknown;\n readonly bin?: unknown;\n}\n\nexport interface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nexport const isBinEntry = ({ label }: PublicEntry): boolean =>\n Str.startsWith(`${BIN_LABEL} `)(label);\n\nexport const targetsIn = (held: unknown): readonly string[] => {\n if (Predicate.isString(held)) {\n return [held];\n }\n if (!Predicate.isObject(held)) {\n return [];\n }\n return pipe(Rec.values(held), Arr.flatMap(targetsIn));\n};\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] => {\n if (Predicate.isString(manifest.bin)) {\n const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => \"\");\n return [[`${BIN_LABEL} ${name}`, manifest.bin]];\n }\n if (!Predicate.isObject(manifest.bin)) {\n return [];\n }\n return pipe(\n Rec.toEntries(manifest.bin),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n};\n\nexport const entryNameOf = (target: string): string => Str.replace(BUILT, \"\")(baseName(target));\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = entryNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nexport const publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...exportEntriesOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n\nconst EntryManifestFields = Schema.Struct({\n name: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n bin: Schema.optional(Schema.Unknown),\n});\n\nexport const EntryManifestJson = Schema.fromJsonString(EntryManifestFields);\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nexport const PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst AlwaysBundle = Schema.Array(Schema.String);\nconst PackDeps = Schema.Struct({ alwaysBundle: Schema.optional(AlwaysBundle) });\nconst PackSettings = Schema.Struct({\n entry: Schema.optional(PackEntry),\n deps: Schema.optional(PackDeps),\n});\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst PackConfig = Schema.Struct({ pack: Schema.optional(PackList) });\nconst BudgetConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n});\nconst PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(false)) });\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nexport interface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\nexport interface PackedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly packEntries: readonly PackEntrySource[];\n readonly alwaysBundle: readonly string[];\n}\n\nexport interface PublishedWorkspace extends PackedWorkspace {\n readonly installSize: string;\n readonly installBudget: number;\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nexport const entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packSettingsOf = (pack: typeof PackConfig.Type.pack): readonly (typeof PackSettings.Type)[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n );\n\nconst packEntriesOf = (pack: typeof PackConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst alwaysBundleOf = (pack: typeof PackConfig.Type.pack): readonly string[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.deps),\n Option.flatMap((deps) => Option.fromUndefinedOr(deps.alwaysBundle)),\n Option.getOrElse((): readonly string[] => []),\n ),\n ),\n Arr.dedupe,\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return config;\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return Option.exists(text, (found) =>\n Option.isSome(Schema.decodeOption(Schema.fromJsonString(PublicManifest))(found)),\n );\n});\n\nconst packedWorkspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ pack }: typeof PackConfig.Type): PackedWorkspace => ({\n directory,\n configFile,\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n alwaysBundle: alwaysBundleOf(pack),\n });\n\nconst budgetOf = ({\n msch,\n}: typeof BudgetConfig.Type): Pick<PublishedWorkspace, \"installSize\" | \"installBudget\"> => {\n const [amount, , unit] = msch.publish.installSize;\n return { installSize: `${amount} ${unit}`, installBudget: amount * bytesPer(unit) };\n};\n\nconst packedIn = Effect.fn(\"packedIn\")(function* packedIn(root: string, configName: string) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<readonly [PackedWorkspace, unknown]>();\n }\n const config = yield* settingsIn(configFile);\n return pipe(\n config,\n Option.flatMap((found) =>\n pipe(\n Schema.decodeUnknownOption(PackConfig)(found),\n Option.map(\n packedWorkspaceOf(directory, configFile, (source) => files.join(directory, source)),\n ),\n Option.map((workspace) => [workspace, found] as const),\n ),\n ),\n );\n});\n\nconst packedPairs = Effect.fn(\"packedPairs\")(function* packedPairs(root: string) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const configs = pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n const found = yield* Effect.forEach(configs, (name) => packedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\n/** @internal */\nexport const packedWorkspaces = Effect.fn(\"packedWorkspaces\")(function* packedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.map(([workspace]) => workspace),\n );\n});\n\n/** @internal */\nexport const publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.flatMap(([workspace, config]) =>\n pipe(\n Schema.decodeUnknownOption(BudgetConfig)(config),\n Option.map((budget): PublishedWorkspace => ({ ...workspace, ...budgetOf(budget) })),\n Option.toArray,\n ),\n ),\n );\n});\n"],"mappings":";;;;;;;;;AASA,MAAM,WAAW;CAAC;CAAkB;CAAyB;AAAyB;AAEtF,MAAa,YAAY,OAAO,MAAM,CACpC,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,YAAY;CAAG,MAAM,OAAO;AAAO,CAAC,GACzE,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,SAAS;CAAG,OAAO,OAAO;AAAO,CAAC,CACzE,CAAC;AACD,MAAM,QAAQ,OAAO,OAAO,EAAE,OAAO,OAAO,OAAO,EAAE,QAAQ,OAAO,OAAO,CAAC,EAAE,CAAC;AAC/E,MAAM,eAAe,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU,OAAO,QAAQ,KAAK;CAC9B,KAAK;CACL,OAAO,OAAO;AAChB,CAAC;AACD,MAAM,cAAc,OAAO,OAAO;CAAE,MAAM,OAAO,SAAS,QAAQ;CAAG,YAAY,OAAO;AAAQ,CAAC;AACjG,MAAM,YAAY,OAAO,MAAM;CAC7B,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,SAAS;EAC9B,OAAO,OAAO,MAAM;GAAC,OAAO;GAAQ,OAAO;GAAQ,OAAO;GAAS,OAAO;EAAI,CAAC;CACjF,CAAC;CACD,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,iBAAiB;EACtC,aAAa,OAAO,MAAM,CAAC,CAAC;EAC5B,QAAQ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,CAAC,WAAW,YACvB,KACE,OAAO,oBAAoB,YAAY,CAAC,CAAC,MAAM,GAC/C,OAAO,KAAK,YAAgC;EAAE,GAAG;EAAW,GAAG,SAAS,MAAM;CAAE,EAAE,GAClF,OAAO,OACT,CACF,CACF;AACF,CAAC"}
@@ -1,13 +1,30 @@
1
1
  #!/usr/bin/env node
2
- import { t as lookupReport } from "./lookup-report-FU7iFxSa.mjs";
3
- import { t as runCli } from "./runtime-C6khg0XJ.mjs";
4
- import { a as fieldsOf, c as namedCatalogsOf, d as specifiedIn, i as decodeManifest, n as baseName, t as manifestTexts } from "./manifest-texts-B8NV4YCS.mjs";
2
+ import { t as lookupReport } from "./lookup-report-D1VTEK5k.mjs";
3
+ import { t as runCli } from "./runtime-1exMm81b.mjs";
4
+ import { a as fieldsOf, c as namedCatalogsOf, d as specifiedIn, i as decodeManifest, n as baseName, t as manifestTexts } from "./manifest-texts-K650kDy8.mjs";
5
5
  import { t as workspaceManifest } from "./workspace-manifest-BC-1cRIJ.mjs";
6
6
  import { a as sent, i as publicLookup } from "./lookup-DjQU0W6q.mjs";
7
- import { n as RepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
8
- import { Array, Effect, HashMap, Option, Record, Schema, String as String$1, pipe } from "effect";
7
+ import { n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
8
+ import { Array, Clock, Effect, HashMap, Option, Record, Schema, String as String$1, pipe } from "effect";
9
9
  import semver from "semver";
10
10
  import { HttpClientResponse } from "effect/http";
11
+ // src/features/check-published-versions/model/overdue.ts
12
+ const PUBLISH_WINDOW_MS = 72e5;
13
+ const versionAt = (root, tip, { file }) => RepositoryFiles.pipe(Effect.flatMap((files) => files.readAtRevision(root, tip, file)), Effect.map((before) => pipe(before, Option.flatMap(decodeManifest), Option.map((fields) => fields["version"]))));
14
+ const publishWindowPassed = (root, { file }) => Effect.gen(function* passed() {
15
+ const committed = yield* (yield* RepositoryFiles).committedAt(root, file);
16
+ const now = yield* Clock.currentTimeMillis;
17
+ return Option.exists(committed, (at) => now - at >= PUBLISH_WINDOW_MS);
18
+ });
19
+ /** @internal */
20
+ const overdue = ({ root, tip, sibling }) => Option.match(sibling, {
21
+ onNone: () => Effect.succeed(true),
22
+ onSome: (found) => Effect.gen(function* overdueSibling() {
23
+ const before = yield* versionAt(root, tip, found);
24
+ if (!Option.contains(before, found.version)) return false;
25
+ return yield* publishWindowPassed(root, found);
26
+ })
27
+ });
11
28
  // src/features/check-published-versions/model/published-dependencies.ts
12
29
  const REGISTRY = "https://registry.npmjs.org/";
13
30
  const ABBREVIATED = "application/vnd.npm.install-v1+json";
@@ -57,27 +74,26 @@ const siblingWanted = (siblings, owner) => ({ name }) => pipe(HashMap.get(siblin
57
74
  range: sibling.version,
58
75
  sibling: Option.some(sibling)
59
76
  })), Option.toArray);
60
- const registryWanted = (catalog, owner) => (specified) => pipe(Option.liftPredicate(specified, ({ name }) => OWN_SCOPE.test(name)), Option.flatMap((own) => rangeOf(catalog, own)), Option.map((range) => ({
77
+ const registryWanted = ({ siblings, catalog }, owner) => (specified) => pipe(Option.liftPredicate(specified, ({ name }) => OWN_SCOPE.test(name)), Option.flatMap((own) => rangeOf(catalog, own)), Option.map((range) => ({
61
78
  owner,
62
79
  name: specified.name,
63
80
  range,
64
- sibling: Option.none()
81
+ sibling: pipe(HashMap.get(siblings, specified.name), Option.filter(({ version }) => semver.satisfies(version, range)))
65
82
  })), Option.toArray);
66
- const wantedBy = (siblings, catalog) => (owner) => pipe(owner.specified, Array.flatMap((specified) => {
67
- if (String$1.startsWith(WORKSPACE_PROTOCOL)(specified.specifier)) return siblingWanted(siblings, owner)(specified);
68
- return registryWanted(catalog, owner)(specified);
83
+ const wantedBy = (sources) => (owner) => pipe(owner.specified, Array.flatMap((specified) => {
84
+ if (String$1.startsWith(WORKSPACE_PROTOCOL)(specified.specifier)) return siblingWanted(sources.siblings, owner)(specified);
85
+ return registryWanted(sources, owner)(specified);
69
86
  }));
70
- const versionAtTip = (root, tip, { file }) => RepositoryFiles.pipe(Effect.flatMap((files) => files.readAtRevision(root, tip, file)), Effect.map((before) => pipe(before, Option.flatMap(decodeManifest), Option.flatMap((fields) => stringOf(fields["version"])))));
71
- const notBumpedHere = (root, tip) => ({ sibling }) => Option.match(sibling, {
72
- onNone: () => Effect.succeed(true),
73
- onSome: (found) => Effect.map(versionAtTip(root, tip, found), Option.contains(found.version))
74
- });
75
87
  const lookupsOf = (wanted) => pipe(wanted, Array.map(({ name }) => name), Array.dedupe, (names) => Effect.forEach(names, (name) => Effect.map(publishedVersions(name), (found) => [name, found]), { concurrency: LOOKUP_CONCURRENCY }), Effect.map(HashMap.fromIterable));
76
- const missingIn = (known) => ({ owner, name, range }) => pipe(HashMap.get(known, name), Option.flatten, Option.filter((published) => semver.maxSatisfying([...published], range) === null), Option.map(() => ({
88
+ const reasonOf = (sibling) => Option.match(sibling, {
89
+ onNone: () => "is not on npm. Publish it first, or lower the range to a version that is.",
90
+ onSome: ({ file }) => `is still not on npm two hours after ${file} reached main. Read the failed publish run for it.`
91
+ });
92
+ const missingIn = (known) => ({ owner, name, range, sibling }) => pipe(HashMap.get(known, name), Option.flatten, Option.filter((published) => semver.maxSatisfying([...published], range) === null), Option.map(() => ({
77
93
  file: owner.file,
78
94
  line: lineOf(owner.text, name),
79
95
  dependency: `${name}@${range}`,
80
- reason: "is not on npm. Publish it first, or lower the range to a version that is."
96
+ reason: reasonOf(sibling)
81
97
  })), Option.toArray);
82
98
  const wantedIn = Effect.fn("wantedIn")(function* wantedIn(root) {
83
99
  const manifests = yield* manifestTexts(root);
@@ -85,20 +101,22 @@ const wantedIn = Effect.fn("wantedIn")(function* wantedIn(root) {
85
101
  const siblings = HashMap.fromIterable(pipe(packages, Array.map((found) => [found.name, found])));
86
102
  const settings = yield* workspaceManifest(root);
87
103
  const catalog = catalogRanges(pipe(settings, Option.map(fieldsOf)));
88
- return pipe(packages, Array.flatMap(wantedBy(siblings, catalog)));
104
+ return pipe(packages, Array.flatMap(wantedBy({
105
+ siblings,
106
+ catalog
107
+ })));
89
108
  });
90
109
  /** @internal */
91
110
  const missingVersions = Effect.fn("missingVersions")(function* missingVersions(root) {
92
111
  const tip = yield* baseName;
93
112
  const wanted = yield* wantedIn(root);
94
- const keep = notBumpedHere(root, tip);
95
- const kept = yield* Effect.forEach(wanted, (found) => Effect.map(keep(found), (unbumped) => ({
96
- found,
97
- unbumped
98
- })), { concurrency: READ_CONCURRENCY });
99
- const unchanged = pipe(kept, Array.filter(({ unbumped }) => unbumped), Array.map(({ found }) => found));
100
- const known = yield* lookupsOf(unchanged);
101
- return pipe(unchanged, Array.flatMap(missingIn(known)));
113
+ const due = yield* Effect.filter(wanted, ({ sibling }) => overdue({
114
+ root,
115
+ tip,
116
+ sibling
117
+ }), { concurrency: READ_CONCURRENCY });
118
+ const known = yield* lookupsOf(due);
119
+ return pipe(due, Array.flatMap(missingIn(known)));
102
120
  });
103
121
  // bin/msch-published.ts
104
122
  const Row = Schema.Struct({
@@ -1 +1 @@
1
- {"version":3,"file":"published.mjs","names":["Arr","Rec","Str"],"sources":["../src/features/check-published-versions/model/published-dependencies.ts","../bin/msch-published.ts"],"sourcesContent":["import {\n Array as Arr,\n Effect,\n HashMap,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport semver from \"semver\";\n\nimport {\n decodeManifest,\n fieldsOf,\n namedCatalogsOf,\n specifiedIn,\n} from \"#/entities/package/index.ts\";\nimport type { Specified } from \"#/entities/package/index.ts\";\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport { baseName } from \"#/shared/lib/base-revision.ts\";\nimport { publicLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport { manifestTexts } from \"#/shared/lib/manifest-texts.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst REGISTRY = \"https://registry.npmjs.org/\";\nconst ABBREVIATED = \"application/vnd.npm.install-v1+json\";\nconst OWN_SCOPE = /^@(?:r_masseater|masseater\\.dev)\\//u;\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst CATALOG_PROTOCOL = \"catalog:\";\nconst UNVERSIONED = \"0.0.0\";\nconst FIRST_LINE = 1;\nconst READ_CONCURRENCY = 16;\nconst LOOKUP_CONCURRENCY = 4;\nconst SECTIONS = [\"dependencies\", \"optionalDependencies\"] as const;\n\n/** @internal */\nexport interface MissingVersion {\n readonly file: string;\n readonly line: number;\n readonly dependency: string;\n readonly reason: string;\n}\n\nconst Packument = Schema.Struct({ versions: Schema.Record(Schema.String, Schema.Unknown) });\n\ninterface Package {\n readonly file: string;\n readonly name: string;\n readonly version: string;\n readonly text: string;\n readonly specified: readonly Specified[];\n}\n\nconst stringOf = (value: unknown): Option.Option<string> =>\n Option.liftPredicate(value, (found): found is string => typeof found === \"string\");\n\nconst packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodeManifest(text),\n Option.filter((fields) => fields[\"private\"] !== true),\n Option.flatMap((fields) =>\n Option.all({ name: stringOf(fields[\"name\"]), version: stringOf(fields[\"version\"]) }).pipe(\n Option.filter(({ version }) => version !== UNVERSIONED),\n Option.map(({ name, version }): Package => ({\n file,\n name,\n version,\n text,\n specified: pipe(\n SECTIONS,\n Arr.flatMap((section) => specifiedIn(fieldsOf(fields)[section])),\n ),\n })),\n ),\n ),\n );\n\nconst OK = 200;\nconst NOT_FOUND = 404;\n\ntype Versions = Effect.Effect<Option.Option<readonly string[]>, unknown>;\n\nconst versionsIn = (response: HttpClientResponse.HttpClientResponse): Versions => {\n if (response.status === OK) {\n return HttpClientResponse.schemaBodyJson(Packument)(response).pipe(\n Effect.map(({ versions }) => Option.some(Rec.keys(versions))),\n );\n }\n if (response.status === NOT_FOUND) {\n return Effect.succeedSome<readonly string[]>([]);\n }\n return Effect.succeedNone;\n};\n\nconst publishedVersions = (\n name: string,\n): Effect.Effect<Option.Option<readonly string[]>, never, HttpClient.HttpClient> =>\n sent({\n ...publicLookup(`${REGISTRY}${Str.replace(\"/\", \"%2f\")(name)}`),\n accept: ABBREVIATED,\n }).pipe(\n Effect.flatMap(versionsIn),\n Effect.orElseSucceed(() => Option.none<readonly string[]>()),\n );\n\nconst catalogRanges = (\n settings: Option.Option<Readonly<Record<string, unknown>>>,\n): HashMap.HashMap<string, string> =>\n pipe(\n settings,\n Option.map((found) => [\n ...pipe(\n specifiedIn(found[\"catalog\"]),\n Arr.map(({ name, specifier }) => [name, specifier] as const),\n ),\n ...pipe(\n namedCatalogsOf(found),\n Arr.flatMap(([, held]) => specifiedIn(held)),\n Arr.map(({ name, specifier }) => [name, specifier] as const),\n ),\n ]),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n HashMap.fromIterable,\n );\n\nconst lineOf = (text: string, dependency: string): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes(`\"${dependency}\"`)(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\ninterface Wanted {\n readonly owner: Package;\n readonly name: string;\n readonly range: string;\n readonly sibling: Option.Option<Package>;\n}\n\nconst rangeOf = (\n catalog: HashMap.HashMap<string, string>,\n { name, specifier }: Specified,\n): Option.Option<string> => {\n if (Str.startsWith(CATALOG_PROTOCOL)(specifier)) {\n return HashMap.get(catalog, name);\n }\n return Option.some(specifier);\n};\n\nconst siblingWanted =\n (siblings: HashMap.HashMap<string, Package>, owner: Package) =>\n ({ name }: Specified): readonly Wanted[] =>\n pipe(\n HashMap.get(siblings, name),\n Option.map((sibling): Wanted => ({\n owner,\n name,\n range: sibling.version,\n sibling: Option.some(sibling),\n })),\n Option.toArray,\n );\n\nconst registryWanted =\n (catalog: HashMap.HashMap<string, string>, owner: Package) =>\n (specified: Specified): readonly Wanted[] =>\n pipe(\n Option.liftPredicate(specified, ({ name }) => OWN_SCOPE.test(name)),\n Option.flatMap((own) => rangeOf(catalog, own)),\n Option.map((range): Wanted => ({\n owner,\n name: specified.name,\n range,\n sibling: Option.none(),\n })),\n Option.toArray,\n );\n\nconst wantedBy =\n (siblings: HashMap.HashMap<string, Package>, catalog: HashMap.HashMap<string, string>) =>\n (owner: Package): readonly Wanted[] =>\n pipe(\n owner.specified,\n Arr.flatMap((specified) => {\n if (Str.startsWith(WORKSPACE_PROTOCOL)(specified.specifier)) {\n return siblingWanted(siblings, owner)(specified);\n }\n return registryWanted(catalog, owner)(specified);\n }),\n );\n\nconst versionAtTip = (\n root: string,\n tip: string,\n { file }: Package,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n RepositoryFiles.pipe(\n Effect.flatMap((files) => files.readAtRevision(root, tip, file)),\n Effect.map((before) =>\n pipe(\n before,\n Option.flatMap(decodeManifest),\n Option.flatMap((fields) => stringOf(fields[\"version\"])),\n ),\n ),\n );\n\nconst notBumpedHere =\n (root: string, tip: string) =>\n ({ sibling }: Wanted): Effect.Effect<boolean, never, RepositoryFiles> =>\n Option.match(sibling, {\n onNone: () => Effect.succeed(true),\n onSome: (found) => Effect.map(versionAtTip(root, tip, found), Option.contains(found.version)),\n });\n\nconst lookupsOf = (\n wanted: readonly Wanted[],\n): Effect.Effect<\n HashMap.HashMap<string, Option.Option<readonly string[]>>,\n never,\n HttpClient.HttpClient\n> =>\n pipe(\n wanted,\n Arr.map(({ name }) => name),\n Arr.dedupe,\n (names) =>\n Effect.forEach(\n names,\n (name) => Effect.map(publishedVersions(name), (found) => [name, found] as const),\n { concurrency: LOOKUP_CONCURRENCY },\n ),\n Effect.map(HashMap.fromIterable),\n );\n\nconst missingIn =\n (known: HashMap.HashMap<string, Option.Option<readonly string[]>>) =>\n ({ owner, name, range }: Wanted): readonly MissingVersion[] =>\n pipe(\n HashMap.get(known, name),\n Option.flatten,\n Option.filter((published) => semver.maxSatisfying([...published], range) === null),\n Option.map((): MissingVersion => ({\n file: owner.file,\n line: lineOf(owner.text, name),\n dependency: `${name}@${range}`,\n reason: \"is not on npm. Publish it first, or lower the range to a version that is.\",\n })),\n Option.toArray,\n );\n\nconst wantedIn = Effect.fn(\"wantedIn\")(function* wantedIn(root: string) {\n const manifests = yield* manifestTexts(root);\n const packages = pipe(\n manifests,\n Arr.flatMap(({ file, text }) => Option.toArray(packageAt(file, text))),\n );\n const siblings = HashMap.fromIterable(\n pipe(\n packages,\n Arr.map((found) => [found.name, found] as const),\n ),\n );\n const settings = yield* workspaceManifest(root);\n const catalog = catalogRanges(pipe(settings, Option.map(fieldsOf)));\n return pipe(packages, Arr.flatMap(wantedBy(siblings, catalog)));\n});\n\n/** @internal */\nexport const missingVersions = Effect.fn(\"missingVersions\")(function* missingVersions(\n root: string,\n) {\n const tip = yield* baseName;\n const wanted = yield* wantedIn(root);\n const keep = notBumpedHere(root, tip);\n const kept = yield* Effect.forEach(\n wanted,\n (found) => Effect.map(keep(found), (unbumped) => ({ found, unbumped })),\n { concurrency: READ_CONCURRENCY },\n );\n const unchanged = pipe(\n kept,\n Arr.filter(({ unbumped }) => unbumped),\n Arr.map(({ found }) => found),\n );\n const known = yield* lookupsOf(unchanged);\n return pipe(unchanged, Arr.flatMap(missingIn(known)));\n});\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { missingVersions } from \"#/features/check-published-versions/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n dependency: Schema.String,\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.dependency} ${row.reason}`;\n\nrunCli(lookupReport({ row: Row, rows: missingVersions, describe: describeRow }));\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,WAAW;AACjB,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,qBAAqB;AAC3B,MAAM,mBAAmB;AACzB,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,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AAC"}
1
+ {"version":3,"file":"published.mjs","names":["Arr","Rec","Str"],"sources":["../src/features/check-published-versions/model/overdue.ts","../src/features/check-published-versions/model/published-dependencies.ts","../bin/msch-published.ts"],"sourcesContent":["import { Clock, Effect, Option, pipe } from \"effect\";\n\nimport { decodeManifest } from \"#/entities/package/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst PUBLISH_WINDOW_MS = 7_200_000;\n\n/** @internal */\nexport interface Landed {\n readonly file: string;\n readonly version: string;\n}\n\nconst versionAt = (\n root: string,\n tip: string,\n { file }: Landed,\n): Effect.Effect<Option.Option<unknown>, never, RepositoryFiles> =>\n RepositoryFiles.pipe(\n Effect.flatMap((files) => files.readAtRevision(root, tip, file)),\n Effect.map((before) =>\n pipe(\n before,\n Option.flatMap(decodeManifest),\n Option.map((fields) => fields[\"version\"]),\n ),\n ),\n );\n\nconst publishWindowPassed = (\n root: string,\n { file }: Landed,\n): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* passed() {\n const files = yield* RepositoryFiles;\n const committed = yield* files.committedAt(root, file);\n const now = yield* Clock.currentTimeMillis;\n return Option.exists(committed, (at) => now - at >= PUBLISH_WINDOW_MS);\n });\n\n/** @internal */\nexport interface Due {\n readonly root: string;\n readonly tip: string;\n readonly sibling: Option.Option<Landed>;\n}\n\n/** @internal */\nexport const overdue = ({\n root,\n tip,\n sibling,\n}: Due): Effect.Effect<boolean, never, RepositoryFiles> =>\n Option.match(sibling, {\n onNone: () => Effect.succeed(true),\n onSome: (found) =>\n Effect.gen(function* overdueSibling() {\n const before = yield* versionAt(root, tip, found);\n if (!Option.contains(before, found.version)) {\n return false;\n }\n return yield* publishWindowPassed(root, found);\n }),\n });\n","import {\n Array as Arr,\n Effect,\n HashMap,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport semver from \"semver\";\n\nimport {\n decodeManifest,\n fieldsOf,\n namedCatalogsOf,\n specifiedIn,\n} from \"#/entities/package/index.ts\";\nimport type { Specified } from \"#/entities/package/index.ts\";\nimport { workspaceManifest } from \"#/entities/workspace/index.ts\";\nimport { baseName } from \"#/shared/lib/base-revision.ts\";\nimport { publicLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport { manifestTexts } from \"#/shared/lib/manifest-texts.ts\";\n\nimport { overdue } from \"./overdue.ts\";\n\nconst REGISTRY = \"https://registry.npmjs.org/\";\nconst ABBREVIATED = \"application/vnd.npm.install-v1+json\";\nconst OWN_SCOPE = /^@(?:r_masseater|masseater\\.dev)\\//u;\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst CATALOG_PROTOCOL = \"catalog:\";\nconst UNVERSIONED = \"0.0.0\";\nconst FIRST_LINE = 1;\nconst READ_CONCURRENCY = 16;\nconst LOOKUP_CONCURRENCY = 4;\nconst SECTIONS = [\"dependencies\", \"optionalDependencies\"] as const;\n\n/** @internal */\nexport interface MissingVersion {\n readonly file: string;\n readonly line: number;\n readonly dependency: string;\n readonly reason: string;\n}\n\nconst Packument = Schema.Struct({ versions: Schema.Record(Schema.String, Schema.Unknown) });\n\ninterface Package {\n readonly file: string;\n readonly name: string;\n readonly version: string;\n readonly text: string;\n readonly specified: readonly Specified[];\n}\n\nconst stringOf = (value: unknown): Option.Option<string> =>\n Option.liftPredicate(value, (found): found is string => typeof found === \"string\");\n\nconst packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodeManifest(text),\n Option.filter((fields) => fields[\"private\"] !== true),\n Option.flatMap((fields) =>\n Option.all({ name: stringOf(fields[\"name\"]), version: stringOf(fields[\"version\"]) }).pipe(\n Option.filter(({ version }) => version !== UNVERSIONED),\n Option.map(({ name, version }): Package => ({\n file,\n name,\n version,\n text,\n specified: pipe(\n SECTIONS,\n Arr.flatMap((section) => specifiedIn(fieldsOf(fields)[section])),\n ),\n })),\n ),\n ),\n );\n\nconst OK = 200;\nconst NOT_FOUND = 404;\n\ntype Versions = Effect.Effect<Option.Option<readonly string[]>, unknown>;\n\nconst versionsIn = (response: HttpClientResponse.HttpClientResponse): Versions => {\n if (response.status === OK) {\n return HttpClientResponse.schemaBodyJson(Packument)(response).pipe(\n Effect.map(({ versions }) => Option.some(Rec.keys(versions))),\n );\n }\n if (response.status === NOT_FOUND) {\n return Effect.succeedSome<readonly string[]>([]);\n }\n return Effect.succeedNone;\n};\n\nconst publishedVersions = (\n name: string,\n): Effect.Effect<Option.Option<readonly string[]>, never, HttpClient.HttpClient> =>\n sent({\n ...publicLookup(`${REGISTRY}${Str.replace(\"/\", \"%2f\")(name)}`),\n accept: ABBREVIATED,\n }).pipe(\n Effect.flatMap(versionsIn),\n Effect.orElseSucceed(() => Option.none<readonly string[]>()),\n );\n\nconst catalogRanges = (\n settings: Option.Option<Readonly<Record<string, unknown>>>,\n): HashMap.HashMap<string, string> =>\n pipe(\n settings,\n Option.map((found) => [\n ...pipe(\n specifiedIn(found[\"catalog\"]),\n Arr.map(({ name, specifier }) => [name, specifier] as const),\n ),\n ...pipe(\n namedCatalogsOf(found),\n Arr.flatMap(([, held]) => specifiedIn(held)),\n Arr.map(({ name, specifier }) => [name, specifier] as const),\n ),\n ]),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n HashMap.fromIterable,\n );\n\nconst lineOf = (text: string, dependency: string): number =>\n pipe(\n Str.split(text, \"\\n\"),\n Arr.findFirstIndex((line) => Str.includes(`\"${dependency}\"`)(line)),\n Option.match({ onNone: () => FIRST_LINE, onSome: (index) => index + FIRST_LINE }),\n );\n\ninterface Wanted {\n readonly owner: Package;\n readonly name: string;\n readonly range: string;\n readonly sibling: Option.Option<Package>;\n}\n\nconst rangeOf = (\n catalog: HashMap.HashMap<string, string>,\n { name, specifier }: Specified,\n): Option.Option<string> => {\n if (Str.startsWith(CATALOG_PROTOCOL)(specifier)) {\n return HashMap.get(catalog, name);\n }\n return Option.some(specifier);\n};\n\nconst siblingWanted =\n (siblings: HashMap.HashMap<string, Package>, owner: Package) =>\n ({ name }: Specified): readonly Wanted[] =>\n pipe(\n HashMap.get(siblings, name),\n Option.map((sibling): Wanted => ({\n owner,\n name,\n range: sibling.version,\n sibling: Option.some(sibling),\n })),\n Option.toArray,\n );\n\ninterface Sources {\n readonly siblings: HashMap.HashMap<string, Package>;\n readonly catalog: HashMap.HashMap<string, string>;\n}\n\nconst registryWanted =\n ({ siblings, catalog }: Sources, owner: Package) =>\n (specified: Specified): readonly Wanted[] =>\n pipe(\n Option.liftPredicate(specified, ({ name }) => OWN_SCOPE.test(name)),\n Option.flatMap((own) => rangeOf(catalog, own)),\n Option.map((range): Wanted => ({\n owner,\n name: specified.name,\n range,\n sibling: pipe(\n HashMap.get(siblings, specified.name),\n Option.filter(({ version }) => semver.satisfies(version, range)),\n ),\n })),\n Option.toArray,\n );\n\nconst wantedBy =\n (sources: Sources) =>\n (owner: Package): readonly Wanted[] =>\n pipe(\n owner.specified,\n Arr.flatMap((specified) => {\n if (Str.startsWith(WORKSPACE_PROTOCOL)(specified.specifier)) {\n return siblingWanted(sources.siblings, owner)(specified);\n }\n return registryWanted(sources, owner)(specified);\n }),\n );\n\nconst lookupsOf = (\n wanted: readonly Wanted[],\n): Effect.Effect<\n HashMap.HashMap<string, Option.Option<readonly string[]>>,\n never,\n HttpClient.HttpClient\n> =>\n pipe(\n wanted,\n Arr.map(({ name }) => name),\n Arr.dedupe,\n (names) =>\n Effect.forEach(\n names,\n (name) => Effect.map(publishedVersions(name), (found) => [name, found] as const),\n { concurrency: LOOKUP_CONCURRENCY },\n ),\n Effect.map(HashMap.fromIterable),\n );\n\nconst reasonOf = (sibling: Option.Option<Package>): string =>\n Option.match(sibling, {\n onNone: () => \"is not on npm. Publish it first, or lower the range to a version that is.\",\n onSome: ({ file }) =>\n `is still not on npm two hours after ${file} reached main. Read the failed publish run for it.`,\n });\n\nconst missingIn =\n (known: HashMap.HashMap<string, Option.Option<readonly string[]>>) =>\n ({ owner, name, range, sibling }: Wanted): readonly MissingVersion[] =>\n pipe(\n HashMap.get(known, name),\n Option.flatten,\n Option.filter((published) => semver.maxSatisfying([...published], range) === null),\n Option.map((): MissingVersion => ({\n file: owner.file,\n line: lineOf(owner.text, name),\n dependency: `${name}@${range}`,\n reason: reasonOf(sibling),\n })),\n Option.toArray,\n );\n\nconst wantedIn = Effect.fn(\"wantedIn\")(function* wantedIn(root: string) {\n const manifests = yield* manifestTexts(root);\n const packages = pipe(\n manifests,\n Arr.flatMap(({ file, text }) => Option.toArray(packageAt(file, text))),\n );\n const siblings = HashMap.fromIterable(\n pipe(\n packages,\n Arr.map((found) => [found.name, found] as const),\n ),\n );\n const settings = yield* workspaceManifest(root);\n const catalog = catalogRanges(pipe(settings, Option.map(fieldsOf)));\n return pipe(packages, Arr.flatMap(wantedBy({ siblings, catalog })));\n});\n\n/** @internal */\nexport const missingVersions = Effect.fn(\"missingVersions\")(function* missingVersions(\n root: string,\n) {\n const tip = yield* baseName;\n const wanted = yield* wantedIn(root);\n const due = yield* Effect.filter(wanted, ({ sibling }) => overdue({ root, tip, sibling }), {\n concurrency: READ_CONCURRENCY,\n });\n const known = yield* lookupsOf(due);\n return pipe(due, Arr.flatMap(missingIn(known)));\n});\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { missingVersions } from \"#/features/check-published-versions/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n dependency: Schema.String,\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.dependency} ${row.reason}`;\n\nrunCli(lookupReport({ row: Row, rows: missingVersions, describe: describeRow }));\n"],"mappings":";;;;;;;;;;;AAKA,MAAM,oBAAoB;AAQ1B,MAAM,aACJ,MACA,KACA,EAAE,WAEF,gBAAgB,KACd,OAAO,SAAS,UAA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AE,cAAc,QAAQ;EAAE;EAAM;EAAK;CAAQ,CAAC,GAAG,EACzF,aAAa,iBACf,CAAC;CACD,MAAM,QAAQ,OAAO,UAAU,GAAG;CAClC,OAAO,KAAK,KAAKA,MAAI,QAAQ,UAAU,KAAK,CAAC,CAAC;AAChD,CAAC;;AC3QD,MAAM,MAAM,OAAO,OAAO;CACxB,MAAM,OAAO;CACb,MAAM,OAAO;CACb,YAAY,OAAO;CACnB,QAAQ,OAAO;AACjB,CAAC;AAID,MAAM,eAAe,QACnB,GAAG,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,IAAI,WAAW,GAAG,IAAI;AAE3D,OAAO,aAAa;CAAE,KAAK;CAAK,MAAM;CAAiB,UAAU;AAAY,CAAC,CAAC"}
package/dist/refs.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { t as lookupReport } from "./lookup-report-FU7iFxSa.mjs";
3
- import { t as runCli } from "./runtime-C6khg0XJ.mjs";
4
- import { a as groupOf, n as RepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
2
+ import { t as lookupReport } from "./lookup-report-D1VTEK5k.mjs";
3
+ import { t as runCli } from "./runtime-1exMm81b.mjs";
4
+ import { a as groupOf, n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
5
5
  import { a as sent, i as publicLookup, n as githubToken, r as jsonLookup } from "./lookup-DjQU0W6q.mjs";
6
6
  import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
7
7
  import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
@@ -8,6 +8,7 @@ const groupOf = (name) => (found) => pipe(Option.fromNullishOr(found), Option.fl
8
8
  /** @internal */
9
9
  const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
10
10
  const MISSING_SIZE = 0;
11
+ const MILLISECONDS = 1e3;
11
12
  const GENERATED_PATHSPEC = ":(attr:linguist-generated)";
12
13
  const OWNED_PATHSPECS = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
13
14
  const NODE_MODULES = "node_modules";
@@ -88,6 +89,14 @@ const gitOperations = (gitPaths, gitText) => {
88
89
  revision
89
90
  ], "\0"),
90
91
  readAtRevision: (root, revision, name) => gitText(root, ["show", `${revision}:${name}`]),
92
+ committedAt: (root, name) => gitText(root, [
93
+ "log",
94
+ "-1",
95
+ "--format=%ct",
96
+ "HEAD",
97
+ "--",
98
+ name
99
+ ]).pipe(Effect.map(Option.map(String.trim)), Effect.map(Option.filter(String.isNonEmpty)), Effect.map(Option.map((seconds) => Number(seconds) * MILLISECONDS))),
91
100
  matchingFiles: (root, pathspecs) => files(root, [
92
101
  ...LISTED_ARGS,
93
102
  "--",
@@ -136,4 +145,4 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
136
145
  })).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
137
146
  export { groupOf as a, nodeServicesLayer as i, RepositoryFiles as n, nodeRepositoryFiles as r, NODE_MODULES as t };
138
147
 
139
- //# sourceMappingURL=repository-files-BxmKrOgg.mjs.map
148
+ //# sourceMappingURL=repository-files-C2gVviac.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-files-C2gVviac.mjs","names":["Str","Str","Arr"],"sources":["../../lint-host/src/shared/lib/collections.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import { Array as Arr, Option, Order, Record as Rec, String as Str, pipe } from \"effect\";\n\nconst byKey = Order.mapInput(Str.Order, ([key]: readonly [string, unknown]) => key);\n\nexport const sortedRecord = <Value>(\n entries: readonly (readonly [string, Value])[],\n): Readonly<Record<string, Value>> => Rec.fromEntries(Arr.sort(entries, byKey));\n\nconst NEXT = 1;\n\nexport interface Grouped<Head, Item> {\n readonly head: Head;\n readonly items: readonly Item[];\n}\n\nexport const groupedUnder =\n <Item, Head>(asHead: (item: Item) => Option.Option<Head>) =>\n (closes: (head: Head, item: Item) => boolean) =>\n (items: readonly Item[]): readonly Grouped<Head, Item>[] =>\n pipe(\n items,\n Arr.flatMap((item, index) =>\n pipe(\n asHead(item),\n Option.map((head): Grouped<Head, Item> => ({\n head,\n items: pipe(\n items,\n Arr.drop(index + NEXT),\n Arr.takeWhile((next) => !closes(head, next)),\n ),\n })),\n Option.toArray,\n ),\n ),\n );\n\nexport const ancestorsBy =\n <Node>(parentOf: (node: Node) => Option.Option<Node>) =>\n (node: Node): readonly Node[] =>\n Arr.unfold(parentOf(node), (current) =>\n pipe(\n current,\n Option.map((found) => [found, parentOf(found)] as const),\n ),\n );\n\nexport const groupOf =\n (name: string) =>\n (found: RegExpMatchArray | null): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(found),\n Option.flatMap((match) => Option.fromNullishOr(match.groups)),\n Option.flatMap((groups) => Option.fromNullishOr(groups[name])),\n );\n","import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Digest } from \"effect/crypto\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\nconst MISSING_SIZE = 0;\nconst MILLISECONDS = 1000;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst OWNED_PATHSPECS = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\nexport const NODE_MODULES = \"node_modules\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\", `--exclude=${NODE_MODULES}/`];\nconst IGNORED_ARGS = [\"--others\", \"--ignored\", \"--exclude-standard\"];\nconst TRACKED_ARGS = [\"--cached\"];\nconst STAGED_ARGS = [\"--stage\"];\nconst LINK_ENTRY = /^120000 \\S+ \\d+\\t(?<name>.+)$/u;\n\nexport class RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly walkDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly writeFile: (file: string, text: string) => Effect.Effect<void>;\n readonly removeFile: (file: string) => Effect.Effect<void>;\n readonly hash: (text: string) => Effect.Effect<string>;\n readonly hashFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly ownedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly linkedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly readLink: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly mergeBase: (root: string, revision: string) => Effect.Effect<Option.Option<string>>;\n readonly changedFiles: (root: string, revision: string) => Effect.Effect<readonly string[]>;\n readonly readAtRevision: (\n root: string,\n revision: string,\n name: string,\n ) => Effect.Effect<Option.Option<string>>;\n readonly committedAt: (root: string, name: string) => Effect.Effect<Option.Option<number>>;\n readonly matchingFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly trackedFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredPaths: (\n root: string,\n paths: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/shared/lib/repository-files/RepositoryFiles\") {}\n\nconst SUCCESS = 0;\n\ntype GitText = (root: string, args: readonly string[]) => Effect.Effect<Option.Option<string>>;\n\nconst gitTextService = Effect.gen(function* gitTextService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitText: GitText = (root, args) =>\n Effect.gen(function* readText() {\n const handle = yield* ChildProcess.make(\"git\", args, { cwd: root, stdin: \"ignore\" });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return Option.liftPredicate(text, () => code === SUCCESS);\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return gitText;\n});\n\ntype GitPaths = (\n root: string,\n args: readonly string[],\n separator: string,\n) => Effect.Effect<readonly string[]>;\n\nconst gitPathsService = Effect.gen(function* gitPathsService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitPaths: GitPaths = (root, args, separator) =>\n Effect.gen(function* listPaths() {\n const handle = yield* ChildProcess.make(\"git\", args, {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, separator), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return gitPaths;\n});\n\nconst linkName = (entry: string): readonly string[] =>\n Option.toArray(groupOf(\"name\")(LINK_ENTRY.exec(entry)));\n\ntype CacheOperations = Pick<\n typeof RepositoryFiles.Service,\n \"walkDirectory\" | \"writeFile\" | \"removeFile\" | \"hash\" | \"hashFile\"\n>;\n\nconst encoder = new TextEncoder();\n\nconst cacheOperations = (\n fs: FileSystem.FileSystem,\n path: Path.Path,\n digest: Digest.Digest[\"Service\"],\n): CacheOperations => ({\n walkDirectory: (directory) =>\n fs\n .readDirectory(directory, { recursive: true })\n .pipe(Effect.orElseSucceed((): readonly string[] => [])),\n writeFile: (file, text) =>\n fs\n .makeDirectory(path.dirname(file), { recursive: true })\n .pipe(Effect.andThen(fs.writeFileString(file, text)), Effect.ignore),\n removeFile: (file) => fs.remove(file, { force: true }).pipe(Effect.ignore),\n hash: (text) => digest.digestHex(Digest.sha256, encoder.encode(text)),\n hashFile: (file) =>\n fs.readFile(file).pipe(\n Effect.flatMap((bytes) => digest.digestHex(Digest.sha256, bytes)),\n Effect.option,\n ),\n});\n\nconst gitFiles =\n (gitPaths: GitPaths) =>\n (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n gitPaths(root, [\"ls-files\", \"-z\", ...args], \"\\0\");\n\nconst gitOperations = (\n gitPaths: GitPaths,\n gitText: GitText,\n): Pick<\n RepositoryFiles[\"Service\"],\n | \"changedFiles\"\n | \"committedAt\"\n | \"ignoredFiles\"\n | \"ignoredPaths\"\n | \"linkedFiles\"\n | \"listedFiles\"\n | \"matchingFiles\"\n | \"mergeBase\"\n | \"ownedFiles\"\n | \"readAtRevision\"\n | \"trackedFiles\"\n> => {\n const files = gitFiles(gitPaths);\n return {\n listedFiles: (root) => files(root, LISTED_ARGS),\n ownedFiles: (root) => files(root, [...LISTED_ARGS, \"--\", ...OWNED_PATHSPECS]),\n linkedFiles: (root) => files(root, STAGED_ARGS).pipe(Effect.map(Arr.flatMap(linkName))),\n mergeBase: (root, revision) =>\n gitText(root, [\"merge-base\", \"HEAD\", revision]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n changedFiles: (root, revision) =>\n gitPaths(root, [\"diff\", \"--name-only\", \"--no-renames\", \"-z\", revision], \"\\0\"),\n readAtRevision: (root, revision, name) => gitText(root, [\"show\", `${revision}:${name}`]),\n committedAt: (root, name) =>\n gitText(root, [\"log\", \"-1\", \"--format=%ct\", \"HEAD\", \"--\", name]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n Effect.map(Option.map((seconds) => Number(seconds) * MILLISECONDS)),\n ),\n matchingFiles: (root, pathspecs) => files(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n trackedFiles: (root, pathspecs) => files(root, [...TRACKED_ARGS, \"--\", ...pathspecs]),\n ignoredFiles: (root, pathspecs) => files(root, [...IGNORED_ARGS, \"--\", ...pathspecs]),\n ignoredPaths: (root, paths) => gitPaths(root, [\"check-ignore\", \"--\", ...paths], \"\\n\"),\n };\n};\n\nexport const nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const digest = yield* Digest.Digest;\n const gitPaths = yield* gitPathsService;\n const gitText = yield* gitTextService;\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(gitPaths)(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n ...gitOperations(gitPaths, gitText),\n readLink: (file) => fs.readLink(file).pipe(Effect.option),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n ...cacheOperations(fs, path, digest),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));\n"],"mappings":";;;;AAEc,MAAM,SAASA,OAAI,QAAQ,CAAC,SAAqC,GAAG;AA6ClF,MAAa,WACV,UACA,UACC,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,SAAS,UAAU,OAAO,cAAc,MAAM,MAAM,CAAC,GAC5D,OAAO,SAAS,WAAW,OAAO,cAAc,OAAO,KAAK,CAAC,CAC/D;;;AC/BJ,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;AAEA,MAAM,eAAe;AACrB,MAAM,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,QAiD3C,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAEtE,MAAM,UAAU;AAIhB,MAAM,iBAAiB,OAAO,IAAI,UAAU,iBAAiB;CAC3D,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,WAAoB,MAAM,SAC9B,OAAO,IAAI,UAAU,WAAW;EAC9B,MAAM,SAAS,OAAO,aAAa,KAAK,OAAO,MAAM;GAAE,KAAK;GAAM,OAAO;EAAS,CAAC;EACnF,MAAM,OAAO,OAAO,OAAO,OAAO,KAAK,OAAO,WAAW,GAAG,O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AAC,KACZ,OAAO,KAAK,SAAS,KAAK,SAAS,WAAW,GAC9C,OAAO,MACT;EACF,WAAW,SACT,GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,OAAO,KAAK,IAAI,CAAC,GACtC,OAAO,oBAAoB,YAAY,CACzC;EACF,OAAO,GAAG,aAAa,KAAK,KAAK,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
@@ -1,4 +1,4 @@
1
- import { r as nodeRepositoryFiles } from "./repository-files-BxmKrOgg.mjs";
1
+ import { r as nodeRepositoryFiles } from "./repository-files-C2gVviac.mjs";
2
2
  import { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from "effect";
3
3
  import { FetchHttpClient } from "effect/http";
4
4
  import { runMain } from "@effect/platform-node/NodeRuntime";
@@ -42,4 +42,4 @@ const runCli = (program) => {
42
42
  };
43
43
  export { ProblemsFound as n, writeStdout as r, runCli as t };
44
44
 
45
- //# sourceMappingURL=runtime-C6khg0XJ.mjs.map
45
+ //# sourceMappingURL=runtime-1exMm81b.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-C6khg0XJ.mjs","names":["nodeServices"],"sources":["../src/app/output.ts","../../node-main/src/features/run-main/model/run-main.ts","../src/app/runtime.ts"],"sourcesContent":["import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n","import { runMain as nodeRuntimeRunMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport type { NodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, Layer, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\n\n/** @internal */\nexport type Platform = NodeServices | HttpClient.HttpClient;\n\n/** @internal */\nexport type Run<Provided> = <Success, Failure>(\n program: Effect.Effect<Success, Failure, Platform | Provided>,\n) => void;\n\n/** @internal */\nexport type Report<Provided> = <Failure>(\n cause: Cause.Cause<Failure>,\n) => Effect.Effect<void, never, Platform | Provided>;\n\nconst platform = Layer.mergeAll(nodeServices, FetchHttpClient.layer);\n\nconst runWithTracingAnd =\n <Provided, LayerFailure>({\n serviceName,\n services,\n onFailure,\n }: Readonly<{\n serviceName: string;\n services: Layer.Layer<Provided, LayerFailure, Platform>;\n onFailure?: Report<Provided>;\n }>): Run<Provided> =>\n (program) => {\n const tracing = Otlp.layerFromConfig({ resource: { serviceName } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n );\n const provided = Layer.provideMerge(services, platform);\n const report = Option.fromNullishOr(onFailure);\n const reported = Option.match(report, {\n onNone: () => program,\n onSome: (handler) => Effect.tapCause(program, handler),\n });\n nodeRuntimeRunMain(\n Layer.mergeAll(tracing, provided).pipe(\n Layer.build,\n Effect.flatMap((context) => Effect.provideContext(reported, context)),\n Effect.scoped,\n ),\n { disableErrorReporting: Option.isSome(report) },\n );\n };\n\nconst runWithTracing = (serviceName: string): Run<never> =>\n runWithTracingAnd({ serviceName, services: Layer.empty });\n\n/** @internal */\nexport const runMainWith = runWithTracingAnd;\n\n/** @internal */\nexport const runMain = runWithTracing;\n","import { runMainWith } from \"@r_masseater/node-main\";\nimport { Cause, Effect, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport type { HttpClient } from \"effect/http\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\n/** @internal */\nexport const runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n | HttpClient.HttpClient\n >,\n): void => {\n runMainWith({\n serviceName: \"msch\",\n services: nodeRepositoryFiles,\n onFailure: reportFailure,\n })(program);\n};\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC,CAAC;;AAGH,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC;;ACOD,MAAM,WAAW,MAAM,SAASA,OAAc,gBAAgB,KAAK;AAEnE,MAAM,qBACqB,EACvB,aACA,UACA,iBAMD,YAAY;CACX,MAAM,UAAU,KAAK,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,KAClE,MAAM,QAAQ,kBAAkB,SAAS,GACzC,MAAM,QAAQ,gBAAgB,KAAK,CACrC;CACA,MAAM,WAAW,MAAM,aAAa,UAAU,QAAQ;CACtD,MAAM,SAAS,OAAO,cAAc,SAAS;CAC7C,MAAM,WAAW,OAAO,MAAM,QAAQ;EACpC,cAAc;EACd,SAAS,YAAY,OAAO,SAAS,SAAS,OAAO;CACvD,CAAC;CACD,QACE,MAAM,SAAS,SAAS,QAAQ,CAAC,CAAC,KAChC,MAAM,OACN,OAAO,SAAS,YAAY,OAAO,eAAe,UAAU,OAAO,CAAC,GACpE,OAAO,MACT,GACA,EAAE,uBAAuB,OAAO,OAAO,MAAM,EAAE,CACjD;AACF;;AAMF,MAAa,cAAc;;AChD3B,MAAM,iBACJ,UAEA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAE3B,IADe,MAAM,gBAAgB,KAAK,CAAC,CAAC,KAAK,OAAO,OAAO,OAAO,GAAG,aAAa,CAAC,CAC9E,GACP;CAEF,OAAO,OAAO,KAAK,GAAG,MAAM,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AAC9F,CAAC;;AAGH,MAAa,UACX,YAUS;CACT,YAAY;EACV,aAAa;EACb,UAAU;EACV,WAAW;CACb,CAAC,CAAC,CAAC,OAAO;AACZ"}
1
+ {"version":3,"file":"runtime-1exMm81b.mjs","names":["nodeServices"],"sources":["../src/app/output.ts","../../node-main/src/features/run-main/model/run-main.ts","../src/app/runtime.ts"],"sourcesContent":["import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n","import { runMain as nodeRuntimeRunMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport type { NodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, Layer, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\n\n/** @internal */\nexport type Platform = NodeServices | HttpClient.HttpClient;\n\n/** @internal */\nexport type Run<Provided> = <Success, Failure>(\n program: Effect.Effect<Success, Failure, Platform | Provided>,\n) => void;\n\n/** @internal */\nexport type Report<Provided> = <Failure>(\n cause: Cause.Cause<Failure>,\n) => Effect.Effect<void, never, Platform | Provided>;\n\nconst platform = Layer.mergeAll(nodeServices, FetchHttpClient.layer);\n\nconst runWithTracingAnd =\n <Provided, LayerFailure>({\n serviceName,\n services,\n onFailure,\n }: Readonly<{\n serviceName: string;\n services: Layer.Layer<Provided, LayerFailure, Platform>;\n onFailure?: Report<Provided>;\n }>): Run<Provided> =>\n (program) => {\n const tracing = Otlp.layerFromConfig({ resource: { serviceName } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n );\n const provided = Layer.provideMerge(services, platform);\n const report = Option.fromNullishOr(onFailure);\n const reported = Option.match(report, {\n onNone: () => program,\n onSome: (handler) => Effect.tapCause(program, handler),\n });\n nodeRuntimeRunMain(\n Layer.mergeAll(tracing, provided).pipe(\n Layer.build,\n Effect.flatMap((context) => Effect.provideContext(reported, context)),\n Effect.scoped,\n ),\n { disableErrorReporting: Option.isSome(report) },\n );\n };\n\nconst runWithTracing = (serviceName: string): Run<never> =>\n runWithTracingAnd({ serviceName, services: Layer.empty });\n\n/** @internal */\nexport const runMainWith = runWithTracingAnd;\n\n/** @internal */\nexport const runMain = runWithTracing;\n","import { runMainWith } from \"@r_masseater/node-main\";\nimport { Cause, Effect, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport type { HttpClient } from \"effect/http\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\n/** @internal */\nexport const runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n | HttpClient.HttpClient\n >,\n): void => {\n runMainWith({\n serviceName: \"msch\",\n services: nodeRepositoryFiles,\n onFailure: reportFailure,\n })(program);\n};\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC,CAAC;;AAGH,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC;;ACOD,MAAM,WAAW,MAAM,SAASA,OAAc,gBAAgB,KAAK;AAEnE,MAAM,qBACqB,EACvB,aACA,UACA,iBAMD,YAAY;CACX,MAAM,UAAU,KAAK,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,KAClE,MAAM,QAAQ,kBAAkB,SAAS,GACzC,MAAM,QAAQ,gBAAgB,KAAK,CACrC;CACA,MAAM,WAAW,MAAM,aAAa,UAAU,QAAQ;CACtD,MAAM,SAAS,OAAO,cAAc,SAAS;CAC7C,MAAM,WAAW,OAAO,MAAM,QAAQ;EACpC,cAAc;EACd,SAAS,YAAY,OAAO,SAAS,SAAS,OAAO;CACvD,CAAC;CACD,QACE,MAAM,SAAS,SAAS,QAAQ,CAAC,CAAC,KAChC,MAAM,OACN,OAAO,SAAS,YAAY,OAAO,eAAe,UAAU,OAAO,CAAC,GACpE,OAAO,MACT,GACA,EAAE,uBAAuB,OAAO,OAAO,MAAM,EAAE,CACjD;AACF;;AAMF,MAAa,cAAc;;AChD3B,MAAM,iBACJ,UAEA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAE3B,IADe,MAAM,gBAAgB,KAAK,CAAC,CAAC,KAAK,OAAO,OAAO,OAAO,GAAG,aAAa,CAAC,CAC9E,GACP;CAEF,OAAO,OAAO,KAAK,GAAG,MAAM,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AAC9F,CAAC;;AAGH,MAAa,UACX,YAUS;CACT,YAAY;EACV,aAAa;EACb,UAAU;EACV,WAAW;CACb,CAAC,CAAC,CAAC,OAAO;AACZ"}
@@ -1,4 +1,4 @@
1
- import { t as NODE_MODULES } from "./repository-files-BxmKrOgg.mjs";
1
+ import { t as NODE_MODULES } from "./repository-files-C2gVviac.mjs";
2
2
  import { Array, Option, String, pipe } from "effect";
3
3
  import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
4
4
  import { isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBlock, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportAssignment, isExportDeclaration, isExpressionStatement, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isLiteralTypeNode, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, isPropertySignatureDeclaration, isReturnStatement, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
@@ -80,4 +80,4 @@ const moduleSpecifierOf = (statement) => {
80
80
  const importedModulesOf = (sourceFile) => pipe(sourceFile.statements, Array.map((statement) => moduleSpecifierOf(statement)), Array.getSomes);
81
81
  export { isPropertyAccessExpression as $, getNameOfDeclaration as A, isExportDeclaration as B, IndexKind as C, SyntaxKind as D, SymbolFlags$1 as E, isBlock as F, isImportDeclaration as G, isFunctionDeclaration as H, isCallExpression as I, isModuleDeclaration as J, isInterfaceDeclaration as K, isClassDeclaration as L, isArrayLiteralExpression as M, isArrowFunction as N, getJSDocTags as O, isBinaryExpression as P, isParenthesizedExpression as Q, isElementAccessExpression as R, API as S, SignatureKind as T, isFunctionExpression as U, isExpressionStatement as V, isIdentifier as W, isNumericLiteral as X, isNewExpression as Y, isObjectLiteralExpression as Z, referencedSymbols as _, declarationsOf as a, isSpreadElement as at, symbolAtLocation as b, importedModulesOf as c, isTypeLiteralNode as ct, isInsideAny as d, isVariableDeclaration as dt, isPropertyAssignment as et, isOutsideDeclaration as f, isVariableDeclarationList as ft, propertyNamesOf as g, packageOf as h, contains as i, isSourceFile as it, getTextOfJSDocComment as j, getLeadingCommentRanges as k, isExternalDeclaration as l, isTypeReferenceNode as lt, lineOf as m, childrenOf as n, isSatisfiesExpression as nt, declaresAType as o, isStringLiteral as ot, isTypeDeclaration as p, isVariableStatement as pt, isModuleBlock as q, columnOf as r, isSignatureDeclaration as rt, descendantsOf as s, isTypeAliasDeclaration as st, carriesTag as t, isReturnStatement as tt, isGenericDeclaration as u, isUnionTypeNode as ut, resolvedSymbol as v, InternalSymbolName as w, uniqueByReference as x, symbolAt as y, isEnumDeclaration as z };
82
82
 
83
- //# sourceMappingURL=syntax-V4CunkGE.mjs.map
83
+ //# sourceMappingURL=syntax-Dx4HQIK-.mjs.map