@r_masseater/msch 0.87.1 → 0.87.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/cargo-inputs.mjs +2 -2
  2. package/dist/changed.mjs +6 -11
  3. package/dist/changed.mjs.map +1 -1
  4. package/dist/cli.mjs +20 -30
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/config.d.mts +1 -1
  7. package/dist/config.mjs +1 -1
  8. package/dist/{credential-broker-9FMyTp1H.mjs → credential-broker-jnmkwOXO.mjs} +4 -20
  9. package/dist/credential-broker-jnmkwOXO.mjs.map +1 -0
  10. package/dist/decision-rules.mjs +1 -1
  11. package/dist/{define-lint-preset-CwmpxrxZ.mjs → define-lint-preset-GWsBHDRn.mjs} +2 -2
  12. package/dist/define-lint-preset-GWsBHDRn.mjs.map +1 -0
  13. package/dist/{dependencies-BAjtDvY4.mjs → dependencies-0FX_K_FN.mjs} +6 -6
  14. package/dist/dependencies-0FX_K_FN.mjs.map +1 -0
  15. package/dist/exits.mjs +4 -4
  16. package/dist/{ignored-directories-BW8gCBE1.mjs → ignored-directories-Ce-45yzO.mjs} +2 -2
  17. package/dist/{ignored-directories-BW8gCBE1.mjs.map → ignored-directories-Ce-45yzO.mjs.map} +1 -1
  18. package/dist/{index-CHxAqDok.d.mts → index-CMyIrsah.d.mts} +3 -3
  19. package/dist/judge.mjs +4 -4
  20. package/dist/lint-rules.mjs +5 -5
  21. package/dist/lint-rules.mjs.map +1 -1
  22. package/dist/lint.mjs +1 -1
  23. package/dist/{lookup-report-jWcGgE_D.mjs → lookup-report-DVJg0K4Z.mjs} +3 -3
  24. package/dist/{lookup-report-jWcGgE_D.mjs.map → lookup-report-DVJg0K4Z.mjs.map} +1 -1
  25. package/dist/{manifest-texts-C6Qjv0xy.mjs → manifest-texts-l_XRxGlJ.mjs} +2 -2
  26. package/dist/{manifest-texts-C6Qjv0xy.mjs.map → manifest-texts-l_XRxGlJ.mjs.map} +1 -1
  27. package/dist/{output-DMksIc-0.mjs → output-B_YPmKad.mjs} +3 -3
  28. package/dist/{output-DMksIc-0.mjs.map → output-B_YPmKad.mjs.map} +1 -1
  29. package/dist/oxlint.mjs +2 -2
  30. package/dist/{package-versions-G9Unih6I.mjs → package-versions-KlfuUwaI.mjs} +5 -5
  31. package/dist/package-versions-KlfuUwaI.mjs.map +1 -0
  32. package/dist/{pass-records-fctupGWy.mjs → pass-records-DPIg0O9z.mjs} +5 -5
  33. package/dist/pass-records-DPIg0O9z.mjs.map +1 -0
  34. package/dist/{problem-DGGF-vjW.mjs → problem-CUIz4TEI.mjs} +2 -2
  35. package/dist/{problem-DGGF-vjW.mjs.map → problem-CUIz4TEI.mjs.map} +1 -1
  36. package/dist/publish.mjs +16 -55
  37. package/dist/publish.mjs.map +1 -1
  38. package/dist/{published-C34bsbOH.mjs → published-CoG4Fl0J.mjs} +5 -5
  39. package/dist/published-CoG4Fl0J.mjs.map +1 -0
  40. package/dist/published.mjs +7 -7
  41. package/dist/published.mjs.map +1 -1
  42. package/dist/refs.mjs +3 -3
  43. package/dist/{repository-files-C2gVviac.mjs → repository-files-B6PEvKWe.mjs} +11 -2
  44. package/dist/{repository-files-C2gVviac.mjs.map → repository-files-B6PEvKWe.mjs.map} +1 -1
  45. package/dist/runtime-C8OGDSk9.mjs +13 -0
  46. package/dist/runtime-C8OGDSk9.mjs.map +1 -0
  47. package/dist/{specifiers-D9L0OV3r.mjs → specifiers-BrCyPubD.mjs} +2 -2
  48. package/dist/specifiers-BrCyPubD.mjs.map +1 -0
  49. package/dist/unbumped.mjs +5 -5
  50. package/dist/{upstream-exits-BVey4j2q.mjs → upstream-exits-bWCzT6HQ.mjs} +3 -3
  51. package/dist/{upstream-exits-BVey4j2q.mjs.map → upstream-exits-bWCzT6HQ.mjs.map} +1 -1
  52. package/dist/{upstream-record-CSbML0KF.mjs → upstream-record-DlluH3fY.mjs} +3 -3
  53. package/dist/upstream-record-DlluH3fY.mjs.map +1 -0
  54. package/dist/upstream.mjs +4 -4
  55. package/dist/wake.mjs +2 -2
  56. package/dist/{workspace-manifest-CAVYfp66.mjs → workspace-manifest-BAVyPzbA.mjs} +2 -2
  57. package/dist/workspace-manifest-BAVyPzbA.mjs.map +1 -0
  58. package/dist/workspace-settings.d.mts +1 -1
  59. package/dist/workspace-settings.mjs +7 -7
  60. package/dist/workspace-settings.mjs.map +1 -1
  61. package/package.json +8 -11
  62. package/skills/msch-repository-config/SKILL.md +1 -1
  63. package/dist/credential-broker-9FMyTp1H.mjs.map +0 -1
  64. package/dist/define-lint-preset-CwmpxrxZ.mjs.map +0 -1
  65. package/dist/dependencies-BAjtDvY4.mjs.map +0 -1
  66. package/dist/package-versions-G9Unih6I.mjs.map +0 -1
  67. package/dist/pass-records-fctupGWy.mjs.map +0 -1
  68. package/dist/published-C34bsbOH.mjs.map +0 -1
  69. package/dist/runtime-CFZ41rB0.mjs +0 -47
  70. package/dist/runtime-CFZ41rB0.mjs.map +0 -1
  71. package/dist/specifiers-D9L0OV3r.mjs.map +0 -1
  72. package/dist/upstream-record-CSbML0KF.mjs.map +0 -1
  73. package/dist/workspace-manifest-CAVYfp66.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-CoG4Fl0J.mjs","names":["Arr","Rec","CONFIG_FILE","taggedError","Arr","Rec","Arr","SEPARATOR","Str","Str","Rec","Arr","READ_CONCURRENCY","Arr","Arr","Rec","Str","Str","Arr","Arr","Str","Rec"],"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/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 type { PackageJson } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\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<PackageJson>): boolean =>\n Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));\n\nexport const tasksOf =\n (manifest: Option.Option<PackageJson>) =>\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 { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { 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 WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst decodeImports = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.String));\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\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, PACKAGE_JSON_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodePackageJson),\n Option.flatMap((manifest) => decodeImports(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 { readWantedLockfile } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport type { ResolvedDependencies } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.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* readWantedLockfile(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 { binEntriesOf, exportEntriesOf, targetsIn } from \"@r_masseater/masseater-utils/kestrion\";\nimport type { PackageJson } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport type EntryManifest = Pick<PackageJson, \"name\" | \"exports\" | \"bin\">;\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\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] =>\n pipe(\n binEntriesOf(manifest),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\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","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport {\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\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});\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, PACKAGE_JSON_FILE));\n return pipe(\n text,\n Option.flatMap(decodePackageJson),\n Option.exists((manifest) => manifest.private !== true),\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,MAA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C,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,OAAI,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,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { t as lookupReport } from "./lookup-report-jWcGgE_D.mjs";
3
- import { t as runCli } from "./runtime-CFZ41rB0.mjs";
4
- import { i as namedCatalogsOf, s as specifiedIn, t as fieldsOf } from "./specifiers-D9L0OV3r.mjs";
5
- import { t as workspaceManifest } from "./workspace-manifest-CAVYfp66.mjs";
6
- import { n as baseName, t as manifestTexts } from "./manifest-texts-C6Qjv0xy.mjs";
2
+ import { t as lookupReport } from "./lookup-report-DVJg0K4Z.mjs";
3
+ import { t as runCli } from "./runtime-C8OGDSk9.mjs";
4
+ import { i as namedCatalogsOf, s as specifiedIn, t as fieldsOf } from "./specifiers-BrCyPubD.mjs";
5
+ import { t as workspaceManifest } from "./workspace-manifest-BAVyPzbA.mjs";
6
+ import { n as baseName, t as manifestTexts } from "./manifest-texts-l_XRxGlJ.mjs";
7
7
  import { a as sent, i as publicLookup } from "./lookup-DjQU0W6q.mjs";
8
- import { n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
8
+ import { r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
9
9
  import { Array, Clock, Effect, HashMap, Option, Record, Schema, String as String$1, pipe } from "effect";
10
- import { decodePackageJson } from "@r_masseater/kestrion/npm";
10
+ import { decodePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
11
11
  import semver from "semver";
12
12
  import { HttpClientResponse } from "effect/http";
13
13
  // src/features/check-published-versions/model/overdue.ts
@@ -1 +1 @@
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 { decodePackageJson } from \"@r_masseater/kestrion/npm\";\nimport { Clock, Effect, Option, pipe } from \"effect\";\n\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<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(decodePackageJson),\n Option.flatMap(({ version }) => Option.fromUndefinedOr(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 { decodePackageJson } from \"@r_masseater/kestrion/npm\";\nimport {\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 { fieldsOf, namedCatalogsOf, specifiedIn } 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 packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodePackageJson(text),\n Option.filter((manifest) => manifest.private !== true),\n Option.flatMap((manifest) =>\n Option.all({\n name: Option.fromUndefinedOr(manifest.name),\n version: Option.fromUndefinedOr(manifest.version),\n }).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(manifest[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(\"msch-published\")(lookupReport({ row: Row, rows: missingVersions, describe: describeRow }));\n"],"mappings":";;;;;;;;;;;;;AAKA,MAAM,oBAAoB;AAQ1B,MAAM,aACJ,MACA,KACA,EAAE,WAEF,gBAAgB,KACd,OAAO,SAAS,UAAU,MAAM,eAAe,MAAM,KAAK,IAAI,CAAC,GAC/D,OAAO,KAAK,WACV,KACE,QACA,OAAO,QAAQ,iBAAiB,GAChC,OAAO,SAAS,EAAE,cAAc,OAAO,gBAAgB,OAAO,CAAC,CACjE,CACF,CACF;AAEF,MAAM,uBACJ,MACA,EAAE,WAEF,OAAO,IAAI,UAAU,SAAS;CAE5B,MAAM,YAAY,QAAO,OADJ,gBAAA,CACU,YAAY,MAAM,IAAI;CACrD,MAAM,MAAM,OAAO,MAAM;CACzB,OAAO,OAAO,OAAO,YAAY,OAAO,MAAM,MAAM,iBAAiB;AACvE,CAAC;;AAUH,MAAa,WAAW,EACtB,MACA,KACA,cAEA,OAAO,MAAM,SAAS;CACpB,cAAc,OAAO,QAAQ,IAAI;CACjC,SAAS,UACP,OAAO,IAAI,UAAU,iBAAiB;EACpC,MAAM,SAAS,OAAO,UAAU,MAAM,KAAK,KAAK;EAChD,IAAI,CAAC,OAAO,SAAS,QAAQ,MAAM,OAAO,GACxC,OAAO;EAET,OAAO,OAAO,oBAAoB,MAAM,KAAK;CAC/C,CAAC;AACL,CAAC;;ACvCH,M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CACvE;CACA,MAAM,WAAW,QAAQ,aACvB,KACE,UACAA,MAAI,KAAK,UAAU,CAAC,MAAM,MAAM,KAAK,CAAU,CACjD,CACF;CACA,MAAM,WAAW,OAAO,kBAAkB,IAAI;CAC9C,MAAM,UAAU,cAAc,KAAK,UAAU,OAAO,IAAI,QAAQ,CAAC,CAAC;CAClE,OAAO,KAAK,UAAUA,MAAI,QAAQ,SAAS;EAAE;EAAU;CAAQ,CAAC,CAAC,CAAC;AACpE,CAAC;;AAGD,MAAa,kBAAkB,OAAO,GAAG,iBAAiB,CAAC,CAAC,UAAU,gBACpE,MACA;CACA,MAAM,MAAM,OAAO;CACnB,MAAM,SAAS,OAAO,SAAS,IAAI;CACnC,MAAM,MAAM,OAAO,OAAO,OAAO,SAAS,EAAE,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;;ACvQD,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,gBAAgB,CAAC,CAAC,aAAa;CAAE,KAAK;CAAK,MAAM;CAAiB,UAAU;AAAY,CAAC,CAAC"}
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 { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { Clock, Effect, Option, pipe } from \"effect\";\n\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<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(decodePackageJson),\n Option.flatMap(({ version }) => Option.fromUndefinedOr(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 { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport {\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 { fieldsOf, namedCatalogsOf, specifiedIn } 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 packageAt = (file: string, text: string): Option.Option<Package> =>\n pipe(\n decodePackageJson(text),\n Option.filter((manifest) => manifest.private !== true),\n Option.flatMap((manifest) =>\n Option.all({\n name: Option.fromUndefinedOr(manifest.name),\n version: Option.fromUndefinedOr(manifest.version),\n }).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(manifest[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(\"msch-published\")(lookupReport({ row: Row, rows: missingVersions, describe: describeRow }));\n"],"mappings":";;;;;;;;;;;;;AAKA,MAAM,oBAAoB;AAQ1B,MAAM,aACJ,MACA,KACA,EAAE,WAEF,gBAAgB,KACd,OAAO,SAAS,UAAU,MAAM,eAAe,MAAM,KAAK,IAAI,CAAC,GAC/D,OAAO,KAAK,WACV,KACE,QACA,OAAO,QAAQ,iBAAiB,GAChC,OAAO,SAAS,EAAE,cAAc,OAAO,gBAAgB,OAAO,CAAC,CACjE,CACF,CACF;AAEF,MAAM,uBACJ,MACA,EAAE,WAEF,OAAO,IAAI,UAAU,SAAS;CAE5B,MAAM,YAAY,QAAO,OADJ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ID,MAAM,eAAe,QACnB,GAAG,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,IAAI,WAAW,GAAG,IAAI;AAE3D,OAAO,gBAAgB,CAAC,CAAC,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-jWcGgE_D.mjs";
3
- import { t as runCli } from "./runtime-CFZ41rB0.mjs";
4
- import { a as groupOf, n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
2
+ import { t as lookupReport } from "./lookup-report-DVJg0K4Z.mjs";
3
+ import { t as runCli } from "./runtime-C8OGDSk9.mjs";
4
+ import { r as RepositoryFiles, s as groupOf } from "./repository-files-B6PEvKWe.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";
@@ -1,9 +1,12 @@
1
1
  import { Array, Context, Effect, FileSystem, Layer, Option, Order, Path, Stream, String, pipe } from "effect";
2
2
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
3
3
  import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
4
+ import { CACHE_DIRECTORY_NAME } from "@r_masseater/masseater-utils/plugin-kit";
4
5
  import { Digest } from "effect/crypto";
5
6
  Order.mapInput(String.Order, ([key]) => key);
6
7
  const groupOf = (name) => (found) => pipe(Option.fromNullishOr(found), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups[name])));
8
+ // src/shared/lib/tool-name.ts
9
+ const TOOL_NAME = "msch";
7
10
  // src/shared/lib/repository-files.ts
8
11
  /** @internal */
9
12
  const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
@@ -12,6 +15,12 @@ const MILLISECONDS = 1e3;
12
15
  const GENERATED_PATHSPEC = ":(attr:linguist-generated)";
13
16
  const OWNED_PATHSPECS = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14
17
  const NODE_MODULES = "node_modules";
18
+ /** @internal */
19
+ const MSCH_CACHE = [
20
+ NODE_MODULES,
21
+ CACHE_DIRECTORY_NAME,
22
+ TOOL_NAME
23
+ ];
15
24
  const LISTED_ARGS = [
16
25
  "--cached",
17
26
  "--others",
@@ -143,6 +152,6 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
143
152
  basename: (file) => path.basename(file)
144
153
  });
145
154
  })).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
146
- export { groupOf as a, nodeServicesLayer as i, RepositoryFiles as n, nodeRepositoryFiles as r, NODE_MODULES as t };
155
+ export { nodeServicesLayer as a, nodeRepositoryFiles as i, NODE_MODULES as n, TOOL_NAME as o, RepositoryFiles as r, groupOf as s, MSCH_CACHE as t };
147
156
 
148
- //# sourceMappingURL=repository-files-C2gVviac.mjs.map
157
+ //# sourceMappingURL=repository-files-B6PEvKWe.mjs.map
@@ -1 +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,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GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,KAAK,SAAS,WAAW,GAC9C,OAAO,MACT;EACF,WAAW,SACT,GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,OAAO,KAAK,IAAI,CAAC,GACtC,OAAO,oBAAoB,YAAY,CACzC;EACF,OAAO,GAAG,aAAa,KAAK,KAAK,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"repository-files-B6PEvKWe.mjs","names":["Str","Str","Arr"],"sources":["../../lint-host/src/shared/lib/collections.ts","../src/shared/lib/tool-name.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","export const TOOL_NAME = \"msch\";\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 { CACHE_DIRECTORY_NAME } from \"@r_masseater/masseater-utils/plugin-kit\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Digest } from \"effect/crypto\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { TOOL_NAME } from \"#/shared/lib/tool-name.ts\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\nconst MISSING_SIZE = 0;\nconst 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\";\n\n/** @internal */\nexport const MSCH_CACHE = [NODE_MODULES, CACHE_DIRECTORY_NAME, TOOL_NAME] as const;\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;;ACtDJ,MAAa,YAAY;;;AC0BzB,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;;AAG5B,MAAa,aAAa;CAAC;CAAc;CAAsB;AAAS;AACxE,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,WA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AI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,KAAK,SAAS,WAAW,GAC9C,OAAO,MACT;EACF,WAAW,SACT,GAAG,KAAK,IAAI,CAAC,CAAC,KACZ,OAAO,KAAK,SAAS,OAAO,KAAK,IAAI,CAAC,GACtC,OAAO,oBAAoB,YAAY,CACzC;EACF,OAAO,GAAG,aAAa,KAAK,KAAK,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { i as nodeRepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
2
+ import { runMainWith } from "@r_masseater/masseater-utils/node-main";
3
+ // src/app/runtime.ts
4
+ /** @internal */
5
+ const runCli = (name) => (program) => {
6
+ runMainWith({
7
+ serviceName: name,
8
+ services: nodeRepositoryFiles
9
+ })(program);
10
+ };
11
+ export { runCli as t };
12
+
13
+ //# sourceMappingURL=runtime-C8OGDSk9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-C8OGDSk9.mjs","names":[],"sources":["../src/app/runtime.ts"],"sourcesContent":["import { runMainWith } from \"@r_masseater/masseater-utils/node-main\";\nimport type { Effect, FileSystem, Path, Stdio } 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\n/** @internal */\nexport const runCli =\n (name: string) =>\n <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({ serviceName: name, services: nodeRepositoryFiles })(program);\n };\n"],"mappings":";;;;AASA,MAAa,UACV,UAEC,YAUS;CACT,YAAY;EAAE,aAAa;EAAM,UAAU;CAAoB,CAAC,CAAC,CAAC,OAAO;AAC3E"}
@@ -1,5 +1,5 @@
1
1
  import { Array, Option, Record, Schema, String as String$1, pipe } from "effect";
2
- import { decodePackageJson } from "@r_masseater/kestrion/npm";
2
+ import { decodePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
3
3
  // src/entities/package/model/specifiers.ts
4
4
  const START = 0;
5
5
  const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
@@ -29,4 +29,4 @@ const SECTIONS = [
29
29
  const manifestSpecifiers = (source) => pipe(decodePackageJson(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
30
30
  export { offsetIn as a, namedCatalogsOf as i, manifestPattern as n, quoted as o, manifestSpecifiers as r, specifiedIn as s, fieldsOf as t };
31
31
 
32
- //# sourceMappingURL=specifiers-D9L0OV3r.mjs.map
32
+ //# sourceMappingURL=specifiers-BrCyPubD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specifiers-BrCyPubD.mjs","names":["Rec","Arr","Str"],"sources":["../src/entities/package/model/specifiers.ts"],"sourcesContent":["import { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nconst START = 0;\n\n/** @internal */\nexport type Fields = Readonly<Record<string, unknown>>;\n\nconst FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeFields = Schema.decodeUnknownOption(FieldsSchema);\nconst decodeString = Schema.decodeUnknownOption(Schema.String);\n\n/** @internal */\nexport const fieldsOf = (value: unknown): Fields =>\n Option.getOrElse(decodeFields(value), () => ({}));\n\n/** @internal */\nexport const namedCatalogsOf = (settings: Fields): readonly (readonly [string, unknown])[] =>\n Rec.toEntries(fieldsOf(settings[\"catalogs\"]));\n\n/** @internal */\nexport interface Specified {\n readonly name: string;\n readonly specifier: string;\n}\n\n/** @internal */\nexport const specifiedIn = (held: unknown): readonly Specified[] =>\n pipe(\n fieldsOf(held),\n Rec.toEntries,\n Arr.flatMap(([name, value]) =>\n pipe(\n decodeString(value),\n Option.map((specifier) => ({ name, specifier })),\n Option.toArray,\n ),\n ),\n );\n\n/** @internal */\nexport const quoted = (text: string): string =>\n Str.replaceAll(/[$()*+.?[\\\\\\]^{|}]/gu, String.raw`\\$&`)(text);\n\n/** @internal */\nexport const manifestPattern = ({ name, specifier }: Specified): RegExp =>\n new RegExp(`\"${quoted(name)}\"\\\\s*:\\\\s*\"${quoted(specifier)}\"`, \"u\");\n\n/** @internal */\nexport const offsetIn =\n (source: string) =>\n (pattern: RegExp): number =>\n pipe(\n Option.fromNullishOr(pattern.exec(source)),\n Option.map(({ index }) => index),\n Option.getOrElse(() => START),\n );\n\nconst SECTIONS = [\"dependencies\", \"devDependencies\", \"optionalDependencies\"] as const;\n\n/** @internal */\nexport const manifestSpecifiers = (source: string): readonly Specified[] =>\n pipe(\n decodePackageJson(source),\n Option.map((manifest) =>\n pipe(\n SECTIONS,\n Arr.flatMap((section) => specifiedIn(manifest[section])),\n ),\n ),\n Option.getOrElse((): readonly Specified[] => []),\n );\n"],"mappings":";;;AAGA,MAAM,QAAQ;AAKd,MAAM,eAAe,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAChE,MAAM,eAAe,OAAO,oBAAoB,YAAY;AAC5D,MAAM,eAAe,OAAO,oBAAoB,OAAO,MAAM;;AAG7D,MAAa,YAAY,UACvB,OAAO,UAAU,aAAa,KAAK,UAAU,CAAC,EAAE;;AAGlD,MAAa,mBAAmB,aAC9BA,OAAI,UAAU,SAAS,SAAS,WAAW,CAAC;;AAS9C,MAAa,eAAe,SAC1B,KACE,SAAS,IAAI,GACbA,OAAI,WACJC,MAAI,SAAS,CAAC,MAAM,WAClB,KACE,aAAa,KAAK,GAClB,OAAO,KAAK,eAAe;CAAE;CAAM;AAAU,EAAE,GAC/C,OAAO,OACT,CACF,CACF;;AAGF,MAAa,UAAU,SACrBC,SAAI,WAAW,wBAAwB,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI;;AAG9D,MAAa,mBAAmB,EAAE,MAAM,gBACtC,IAAI,OAAO,IAAI,OAAO,IAAI,EAAE,aAAa,OAAO,SAAS,EAAE,IAAI,GAAG;;AAGpE,MAAa,YACV,YACA,YACC,KACE,OAAO,cAAc,QAAQ,KAAK,MAAM,CAAC,GACzC,OAAO,KAAK,EAAE,YAAY,KAAK,GAC/B,OAAO,gBAAgB,KAAK,CAC9B;AAEJ,MAAM,WAAW;CAAC;CAAgB;CAAmB;AAAsB;;AAG3E,MAAa,sBAAsB,WACjC,KACE,kBAAkB,MAAM,GACxB,OAAO,KAAK,aACV,KACE,UACAD,MAAI,SAAS,YAAY,YAAY,SAAS,QAAQ,CAAC,CACzD,CACF,GACA,OAAO,gBAAsC,CAAC,CAAC,CACjD"}
package/dist/unbumped.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { i as writeProblems, n as failWhenAny } from "./output-DMksIc-0.mjs";
3
- import { t as runCli } from "./runtime-CFZ41rB0.mjs";
4
- import { t as checkPackageVersions } from "./package-versions-G9Unih6I.mjs";
5
- import { s as sortProblems } from "./problem-DGGF-vjW.mjs";
6
- import { n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
2
+ import { i as writeProblems, n as failWhenAny } from "./output-B_YPmKad.mjs";
3
+ import { t as runCli } from "./runtime-C8OGDSk9.mjs";
4
+ import { t as checkPackageVersions } from "./package-versions-KlfuUwaI.mjs";
5
+ import { s as sortProblems } from "./problem-CUIz4TEI.mjs";
6
+ import { r as RepositoryFiles } from "./repository-files-B6PEvKWe.mjs";
7
7
  import { Effect } from "effect";
8
8
  // bin/msch-unbumped.ts
9
9
  const unbumped = Effect.gen(function* unbumped() {
@@ -1,5 +1,5 @@
1
- import { a as groupOf, n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
2
- import { a as problemAtPosition } from "./problem-DGGF-vjW.mjs";
1
+ import { r as RepositoryFiles, s as groupOf } from "./repository-files-B6PEvKWe.mjs";
2
+ import { a as problemAtPosition } from "./problem-CUIz4TEI.mjs";
3
3
  import { n as githubToken, r as jsonLookup, t as fetched } from "./lookup-DjQU0W6q.mjs";
4
4
  import { t as registryRelease } from "./registry-releases-E0PE3Wq-.mjs";
5
5
  import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
@@ -354,4 +354,4 @@ const upstreamExitsMet = Effect.fn("upstreamExitsMet")(function* upstreamExitsMe
354
354
  });
355
355
  export { workspaceDeviations as a, tomlSourceComments as c, problemAtIndex as d, cargoDeviations as i, yamlSourceComments as l, upstreamExitsMet as n, collectNodes as o, WORKSPACE_SECTIONS as r, isRecord as s, checkUpstreamExits as t, positionOf as u };
356
356
 
357
- //# sourceMappingURL=upstream-exits-BVey4j2q.mjs.map
357
+ //# sourceMappingURL=upstream-exits-bWCzT6HQ.mjs.map