@r_masseater/msch 0.50.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cargo-inputs.mjs +1 -1
- package/dist/changed.mjs +2 -2
- package/dist/cli.mjs +453 -331
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +10 -6
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-B1Xy1brk.mjs → define-lint-preset-CecEvjVf.mjs} +96 -1
- package/dist/define-lint-preset-CecEvjVf.mjs.map +1 -0
- package/dist/{dependencies-DbwLA4nT.mjs → dependencies-DCJv7YcW.mjs} +5 -2
- package/dist/dependencies-DCJv7YcW.mjs.map +1 -0
- package/dist/{index-DL7PSp7j.d.mts → index-B2X8WhBt.d.mts} +41 -2
- package/dist/{index-DdJXnW1q.d.mts → index-BZIBqvmt.d.mts} +18 -7
- package/dist/lint-rules.mjs +247 -6
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/oxlint.mjs +3 -7
- package/dist/oxlint.mjs.map +1 -1
- package/dist/{package-BKpgZyaV.mjs → package-LeBO9czg.mjs} +2 -2
- package/dist/{package-BKpgZyaV.mjs.map → package-LeBO9czg.mjs.map} +1 -1
- package/dist/{problem-D8mlJc3T.mjs → problem-CzOlOb5f.mjs} +10 -2
- package/dist/problem-CzOlOb5f.mjs.map +1 -0
- package/dist/{project-CR2jzkij.mjs → project-C4uzq7_4.mjs} +2 -2
- package/dist/{project-CR2jzkij.mjs.map → project-C4uzq7_4.mjs.map} +1 -1
- package/dist/started-once-muJbvD_I.mjs +8 -0
- package/dist/started-once-muJbvD_I.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +2 -2
- package/dist/workspace-settings.mjs +83 -42
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +3 -1
- package/skills/msch-checks/SKILL.md +1 -1
- package/skills/workspace-settings/SKILL.md +1 -0
- package/src/app/vite.d.ts +3 -2
- package/dist/define-lint-preset-B1Xy1brk.mjs.map +0 -1
- package/dist/dependencies-DbwLA4nT.mjs.map +0 -1
- package/dist/problem-D8mlJc3T.mjs.map +0 -1
- package/dist/started-once-CkTooI_o.mjs +0 -13
- package/dist/started-once-CkTooI_o.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies-DCJv7YcW.mjs","names":["Arr","Rec","taggedError","Arr","Rec","Arr","Arr","taggedError","MANIFEST_FILE","Str","Arr","SEPARATOR","Str","MANIFEST_FILE","WILDCARD","Str","Rec","Arr","Arr","Str","Arr","Rec","ROOT_IMPORTER","Rec","Arr","Arr","Rec","Str","Rec","Arr","Str","Str","Arr","Rec","Arr","Str","Rec","Arr","Str"],"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/run-tasks.ts","../src/entities/workspace/model/workspace-unreadable.ts","../src/entities/workspace/model/workspace-manifest.ts","../src/entities/workspace/model/workspace-projects.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/shadcn-ui.ts","../src/entities/workspace/model/workspace-names.ts","../src/entities/workspace/model/deploy-entries.ts","../src/entities/workspace/model/lockfile-unreadable.ts","../src/entities/workspace/model/locked-packages.ts","../src/entities/workspace/model/locked-graph.ts","../src/entities/workspace/model/locked-links.ts","../src/entities/workspace/model/locked-closures.ts","../src/entities/workspace/model/locked-closure-files.ts","../src/entities/workspace/model/cargo-crates.ts","../src/entities/package/model/dependencies.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\ninterface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Manifest } from \"#/entities/package/@x/workspace.ts\";\n\nimport { nestedValues, propertyValue, stringsIn } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const VERIFY_TASK = [\"tasks\", \"verify\"] as const;\n\nexport const TEST_TASK = [\"tasks\", \"test\"] as const;\n\nconst NATIVE_TASK = [\"tasks\", \"native\"] as const;\n\nexport const RUN_TASKS = [\"run\", \"tasks\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n readonly native: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [], native: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nconst TEST_TASK_NAME = \"test\";\nconst DEPENDS_ON = \"dependsOn\";\n\nexport const testsItself = (program: unknown): boolean =>\n definesTask(TEST_TASK)(program) ||\n pipe(\n nestedValues(VERIFY_TASK)(program),\n Arr.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))),\n Arr.flatMap(stringsIn),\n Arr.some(({ text }) => text === TEST_TASK_NAME),\n );\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n return Option.exists(config, isVerified);\n});\n\nexport const tasksOf =\n (manifest: Option.Option<Manifest>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (name) => ({\n verify: Arr.getSomes([\n Option.liftPredicate(`${name}#verify`, () => definesTask(VERIFY_TASK)(program)),\n Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)),\n ]),\n native: Arr.filter([`${name}#native`], () => definesTask(NATIVE_TASK)(program)),\n }),\n }),\n );\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { KeySchema, nestedValues } from \"./config-literal.ts\";\nimport { workspaceConfigOf } from \"./workspace-config-source.ts\";\nimport { RUN_TASKS } from \"./workspace-tasks.ts\";\n\nconst TaskProperty = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n start: Schema.Finite,\n});\nconst TaskObject = Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n});\n\nconst decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);\nconst decodeTaskObject = Schema.decodeUnknownOption(TaskObject);\n\nexport type RunTask = typeof TaskProperty.Type;\n\nexport interface RunTasks {\n readonly file: string;\n readonly source: string;\n readonly tasks: readonly RunTask[];\n}\n\nconst tasksIn = (program: unknown): readonly RunTask[] =>\n pipe(\n nestedValues(RUN_TASKS)(program),\n Arr.flatMap((tasks) =>\n pipe(\n decodeTaskObject(tasks),\n Option.map(({ properties }) => properties),\n Option.getOrElse((): readonly unknown[] => []),\n ),\n ),\n Arr.flatMap((property) => Option.toArray(decodeTaskProperty(property))),\n );\n\nexport const runTasksOf = Effect.fn(\"runTasksOf\")(function* runTasksOf(\n root: string,\n directory: string,\n) {\n const config = yield* workspaceConfigOf(root, directory);\n return pipe(\n config,\n Option.map(({ file, source, program }): RunTasks => ({\n file,\n source,\n tasks: tasksIn(program),\n })),\n );\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class WorkspaceUnreadable extends taggedError<\n WorkspaceUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceUnreadable\", { root: Schema.String, reason: Schema.String }) {}\n","import { readWorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-reader\";\nimport type { WorkspaceManifest } from \"@pnpm/workspace.workspace-manifest-reader\";\nimport { Effect, Option } from \"effect\";\n\nimport { WorkspaceUnreadable } from \"./workspace-unreadable.ts\";\n\n/** @internal */\nexport const workspaceManifest = (root: string): Effect.Effect<Option.Option<WorkspaceManifest>> =>\n Effect.tryPromise({\n try: () => readWorkspaceManifest(root),\n catch: (cause) => WorkspaceUnreadable.make({ root, reason: String(cause) }),\n }).pipe(\n Effect.map(Option.fromUndefinedOr),\n Effect.orElseSucceed(() => Option.none()),\n );\n","import { findWorkspaceProjectsNoCheck } from \"@pnpm/workspace.projects-reader\";\nimport type { Project } from \"@pnpm/workspace.projects-reader\";\nimport { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceManifest } from \"./workspace-manifest.ts\";\nimport { WorkspaceUnreadable } from \"./workspace-unreadable.ts\";\n\nconst MANIFEST_FILE = \"package.json\";\nconst ROOT_DIRECTORY = \"\";\n\nexport interface WorkspaceProject {\n readonly directory: string;\n readonly packageName: Option.Option<string>;\n readonly description: Option.Option<string>;\n readonly published: boolean;\n readonly keywords: readonly string[];\n readonly files: Option.Option<readonly string[]>;\n}\n\nconst byDirectory = Order.mapInput(Str.Order, ({ directory }: WorkspaceProject) => directory);\n\nconst projectsMatching = (\n root: string,\n patterns: readonly string[],\n): Effect.Effect<readonly Project[]> =>\n Effect.tryPromise({\n try: () => findWorkspaceProjectsNoCheck(root, { patterns: [...patterns] }),\n catch: (cause) => WorkspaceUnreadable.make({ root, reason: String(cause) }),\n }).pipe(Effect.orElseSucceed((): readonly Project[] => []));\n\n/** @internal */\nexport const workspaceProjects = Effect.fn(\"workspaceProjects\")(function* workspaceProjects(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* workspaceManifest(root);\n const patterns = pipe(\n manifest,\n Option.flatMap(({ packages }) => Option.fromNullishOr(packages)),\n Option.getOrElse((): readonly string[] => []),\n );\n if (!Arr.isReadonlyArrayNonEmpty(patterns)) {\n return [];\n }\n const projects = yield* projectsMatching(root, patterns);\n const found = pipe(\n projects,\n Arr.map(({ rootDir, manifest: own }): WorkspaceProject => ({\n directory: files.relative(root, rootDir),\n packageName: Option.fromUndefinedOr(own.name),\n description: Option.filter(Option.fromUndefinedOr(own.description), Str.isNonEmpty),\n published: own.private !== true,\n keywords: Option.getOrElse(Option.fromUndefinedOr(own.keywords), () => []),\n files: Option.fromUndefinedOr(own.files),\n })),\n Arr.filter(({ directory }) => Str.isNonEmpty(directory)),\n );\n return Arr.sort(found, byDirectory);\n});\n\n/** @internal */\nexport const workspaceDirectories = Effect.fn(\"workspaceDirectories\")(\n function* workspaceDirectories(root: string) {\n const projects = yield* workspaceProjects(root);\n return pipe(\n projects,\n Arr.map(({ directory }) => directory),\n );\n },\n);\n\nconst Strings = Schema.Array(Schema.String);\nconst RootManifest = Schema.fromJsonString(\n Schema.Struct({\n name: Schema.String,\n description: Schema.optional(Schema.String),\n private: Schema.optional(Schema.Boolean),\n keywords: Schema.optional(Strings),\n files: Schema.optional(Strings),\n }),\n);\n\nconst rootProject = Effect.fn(\"rootProject\")(function* rootProject(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, MANIFEST_FILE));\n return pipe(\n text,\n Option.flatMap(Schema.decodeOption(RootManifest)),\n Option.map((own): WorkspaceProject => ({\n directory: ROOT_DIRECTORY,\n packageName: Option.some(own.name),\n description: Option.filter(Option.fromUndefinedOr(own.description), Str.isNonEmpty),\n published: own.private !== true,\n keywords: own.keywords ?? [],\n files: Option.fromUndefinedOr(own.files),\n })),\n );\n});\n\n/** @internal */\nexport const publishedProjects = Effect.fn(\"publishedProjects\")(function* publishedProjects(\n root: string,\n) {\n const [own, members] = yield* Effect.all([rootProject(root), workspaceProjects(root)], {\n concurrency: \"unbounded\",\n });\n return pipe(\n Option.toArray(own),\n Arr.appendAll(members),\n Arr.filter(({ published }) => published),\n );\n});\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { prefixed, withoutRelative } from \"./workspace-patterns.ts\";\n\nconst SHADCN_FILE = \"components.json\";\nconst MANIFEST_FILE = \"package.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst ManifestImports = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\nconst decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));\n\nconst withoutWildcard = Str.replace(WILDCARD, \"\");\n\nconst importTarget =\n (alias: string) =>\n ([key, target]: readonly [string, string]): Option.Option<string> => {\n if (!Str.endsWith(WILDCARD)(key)) {\n return Option.some(target).pipe(Option.filter(() => key === alias));\n }\n const prefix = withoutWildcard(key);\n if (!Str.startsWith(prefix)(alias)) {\n return Option.none();\n }\n return Option.some(`${withoutWildcard(target)}${Str.slice(prefix.length)(alias)}`);\n };\n\nconst resolvedAlias = (\n imports: Readonly<Record<string, string>>,\n alias: string,\n): Option.Option<string> =>\n pipe(Rec.toEntries(imports), Arr.findFirst(importTarget(alias)), Option.map(withoutRelative));\n\nexport type ShadcnUi = Readonly<{\n file: string;\n alias: string;\n target: Option.Option<string>;\n}>;\n\nexport const shadcnUiOf = Effect.fn(\"shadcnUiOf\")(function* shadcnUiOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SHADCN_FILE);\n const configText = yield* files.readFile(file);\n const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodeManifestImports),\n Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }): ShadcnUi => ({\n file,\n alias: aliases.ui,\n target: pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n ),\n })),\n );\n});\n\nexport const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(\n root: string,\n directory: string,\n) {\n const found = yield* shadcnUiOf(root, directory);\n return pipe(\n found,\n Option.map(\n ({ alias, target }) =>\n `${prefixed(directory)(Option.getOrElse(target, () => alias))}${EVERYTHING}`,\n ),\n );\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceProjects } from \"./workspace-projects.ts\";\nimport type { WorkspaceProject } from \"./workspace-projects.ts\";\n\nconst ALTERNATIVE = \"|\";\nconst SCOPE = /^@[^/]+\\//u;\nconst SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\n\nexport interface NamedWorkspace {\n readonly directory: string;\n readonly names: readonly string[];\n readonly packageName: Option.Option<string>;\n}\n\n/** @internal */\nexport const patternOf = (names: readonly string[]): RegExp => {\n const alternatives = pipe(names, Arr.map(Str.replaceAll(SPECIAL, String.raw`\\$&`)));\n return new RegExp(\n `(?<![\\\\p{L}\\\\p{N}_-])(?:${Arr.join(alternatives, ALTERNATIVE)})(?![\\\\p{L}\\\\p{N}_-])`,\n \"gu\",\n );\n};\n\nconst namedIn =\n (basename: (directory: string) => string) =>\n ({ directory, packageName }: WorkspaceProject): NamedWorkspace => {\n const unscoped = pipe(packageName, Option.map(Str.replace(SCOPE, \"\")));\n const names = pipe(\n [Option.some(directory), Option.some(basename(directory)), packageName, unscoped],\n Arr.getSomes,\n Arr.dedupe,\n );\n return { directory, names, packageName };\n };\n\n/** @internal */\nexport const namedWorkspaces = Effect.fn(\"namedWorkspaces\")(function* namedWorkspaces(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const projects = yield* workspaceProjects(root);\n return pipe(projects, Arr.map(namedIn((directory) => files.basename(directory))));\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 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);\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\nconst mainTargetsIn = (node: unknown): readonly string[] => {\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(mainTargetsIn));\n};\n\nconst declaredIn = Effect.fn(\"declaredIn\")(function* declaredIn(root: string, file: string) {\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(parsed.program),\n Arr.map((target) => files.join(files.dirname(file), target)),\n );\n});\n\nexport const deployEntries = Effect.fn(\"deployEntries\")(function* deployEntries(root: string) {\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), {\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","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class LockfileUnreadable extends taggedError<\n LockfileUnreadable,\n { readonly brand: unique symbol }\n>()(\"LockfileUnreadable\", { root: Schema.String, reason: Schema.String }) {}\n","import { readWantedLockfile } from \"@pnpm/lockfile.fs\";\nimport { Effect, Option, Record as Rec } from \"effect\";\n\nimport { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport type WantedLockfile = NonNullable<Awaited<ReturnType<typeof readWantedLockfile>>>;\n\n/** @internal */\nexport const wantedLockfile = (\n root: string,\n): Effect.Effect<Option.Option<WantedLockfile>, LockfileUnreadable> =>\n Effect.tryPromise({\n try: () => readWantedLockfile(root, { ignoreIncompatible: false }),\n catch: (cause) => LockfileUnreadable.make({ root, reason: String(cause) }),\n }).pipe(Effect.map(Option.fromNullishOr));\n\n/** @internal */\nexport const lockedPackages = (\n root: string,\n): Effect.Effect<Option.Option<readonly string[]>, LockfileUnreadable> =>\n wantedLockfile(root).pipe(\n Effect.map(Option.flatMap(({ packages }) => Option.fromUndefinedOr(packages))),\n Effect.map(Option.map(Rec.keys)),\n );\n","import { refToRelative } from \"@pnpm/deps.path\";\nimport { Array as Arr, Effect, Option, Record as Rec, pipe } from \"effect\";\n\nimport { wantedLockfile } from \"./locked-packages.ts\";\nimport type { WantedLockfile } from \"./locked-packages.ts\";\nimport type { LockfileUnreadable } from \"./lockfile-unreadable.ts\";\n\nexport interface LockedNode {\n readonly id: string;\n readonly dependencies: readonly string[];\n}\n\nconst MANIFEST = \"package.json\";\nconst ROOT_IMPORTER = \".\";\n\ntype ProjectSnapshot = WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]];\n\ntype ResolvedSections = Readonly<\n Partial<Pick<ProjectSnapshot, \"dependencies\" | \"devDependencies\" | \"optionalDependencies\">>\n>;\n\nexport type ResolvedDependencies = Readonly<\n NonNullable<WantedLockfile[\"importers\"][keyof WantedLockfile[\"importers\"]][\"dependencies\"]>\n>;\n\ninterface LockedSnapshots<Importer extends string, Package extends string> {\n readonly importers: Readonly<Record<Importer, ResolvedSections>>;\n readonly packages?: Readonly<Record<Package, ResolvedSections>> | undefined;\n}\n\nconst importerManifest = (id: string): string =>\n Option.match(\n Option.liftPredicate(id, (found) => found === ROOT_IMPORTER),\n {\n onNone: () => `${id}/${MANIFEST}`,\n onSome: () => MANIFEST,\n },\n );\n\nexport const depPathsOf = (resolved: ResolvedDependencies | undefined): readonly string[] =>\n pipe(\n Rec.toEntries(resolved ?? {}),\n Arr.flatMap(([name, reference]) =>\n Option.toArray(Option.fromNullishOr(refToRelative(reference, name))),\n ),\n );\n\nconst nodesOf = <Importer extends string, Package extends string>(\n lockfile: LockedSnapshots<Importer, Package>,\n): readonly LockedNode[] => [\n ...pipe(\n Rec.toEntries(lockfile.importers),\n Arr.map(([id, project]) => ({\n id: importerManifest(id),\n dependencies: [\n ...depPathsOf(project.dependencies),\n ...depPathsOf(project.devDependencies),\n ...depPathsOf(project.optionalDependencies),\n ],\n })),\n ),\n ...pipe(\n Option.match(Option.fromUndefinedOr(lockfile.packages), {\n onNone: (): readonly (readonly [Package, ResolvedSections])[] => [],\n onSome: Rec.toEntries,\n }),\n Arr.map(([id, snapshot]) => ({\n id,\n dependencies: [\n ...depPathsOf(snapshot.dependencies),\n ...depPathsOf(snapshot.optionalDependencies),\n ],\n })),\n ),\n];\n\n/** @internal */\nexport const lockedGraph = (\n root: string,\n): Effect.Effect<Option.Option<readonly LockedNode[]>, LockfileUnreadable> =>\n wantedLockfile(root).pipe(Effect.map(Option.map(nodesOf)));\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\nconst LINK = \"link:\";\n\nexport interface WorkspaceLink {\n readonly from: string;\n readonly to: string;\n}\n\nexport const linkedPaths = (\n sections: readonly (ResolvedDependencies | undefined)[],\n): readonly string[] =>\n pipe(\n sections,\n Arr.flatMap((resolved) => Rec.values(resolved ?? {})),\n Arr.filter(Str.startsWith(LINK)),\n Arr.map((reference) => Str.slice(LINK.length)(reference)),\n );\n\n/** @internal */\nexport const workspaceLinks = Effect.fn(\"workspaceLinks\")(function* workspaceLinks(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const linksOf = (id: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const from = files.relative(root, files.join(root, id));\n return pipe(\n paths,\n Arr.map((path): WorkspaceLink => ({\n from,\n to: files.relative(root, files.join(root, id, path)),\n })),\n );\n };\n return pipe(\n lockfile,\n Option.map(({ importers }) =>\n pipe(\n Rec.toEntries(importers),\n Arr.flatMap(([id, project]) =>\n linksOf(\n id,\n linkedPaths([\n project.dependencies,\n project.devDependencies,\n project.optionalDependencies,\n ]),\n ),\n ),\n ),\n ),\n Option.getOrElse((): readonly WorkspaceLink[] => []),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { reachable } from \"#/shared/lib/reachable.ts\";\nimport type { Edges } from \"#/shared/lib/reachable.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { depPathsOf } from \"./locked-graph.ts\";\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { linkedPaths } from \"./locked-links.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\ntype LockedClosures = Readonly<Record<string, readonly string[]>>;\n\nconst IMPORTER = \"importer:\";\nconst ROOT_IMPORTER = \".\";\n\ntype Sections = readonly (ResolvedDependencies | undefined)[];\ntype Edge = readonly [string, readonly string[]];\n\ninterface Used {\n readonly dependencies?: ResolvedDependencies | undefined;\n readonly optionalDependencies?: ResolvedDependencies | undefined;\n}\n\ninterface Importer {\n readonly id: string;\n readonly own: readonly string[];\n readonly used: readonly string[];\n}\n\nconst usedSections = ({ dependencies, optionalDependencies }: Used): Sections => [\n dependencies,\n optionalDependencies,\n];\n\nconst packageEdges = <Package extends string>(\n packages: Readonly<Record<Package, Used>>,\n): readonly Edge[] =>\n pipe(\n Rec.toEntries(packages),\n Arr.map(([id, snapshot]): Edge => [id, pipe(usedSections(snapshot), Arr.flatMap(depPathsOf))]),\n );\n\nconst closureOf =\n (edges: Edges) =>\n ({ own }: Importer): readonly string[] => {\n const packages = pipe(\n reachable(edges, own),\n Arr.filter((id) => !Str.startsWith(IMPORTER)(id)),\n );\n return Arr.sort(packages, Str.Order);\n };\n\n/** @internal */\nexport const lockedClosures = Effect.fn(\"lockedClosures\")(function* lockedClosures(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const nodesOf = (id: string, sections: Sections): readonly string[] => [\n ...pipe(sections, Arr.flatMap(depPathsOf)),\n ...pipe(\n linkedPaths(sections),\n Arr.map((path) => files.relative(root, files.join(root, id, path))),\n Arr.map(\n (linked) =>\n `${IMPORTER}${Option.getOrElse(Option.liftPredicate(linked, Str.isNonEmpty), () => ROOT_IMPORTER)}`,\n ),\n ),\n ];\n return pipe(\n lockfile,\n Option.map(({ importers, packages }): LockedClosures => {\n const found = pipe(\n Rec.toEntries(importers),\n Arr.map(([id, project]): Importer => {\n const used = usedSections(project);\n return {\n id,\n own: nodesOf(id, [...used, project.devDependencies]),\n used: nodesOf(id, used),\n };\n }),\n );\n const edges = Rec.fromEntries([\n ...pipe(\n found,\n Arr.map(({ id, used }): Edge => [`${IMPORTER}${id}`, used]),\n ),\n ...packageEdges(packages ?? {}),\n ]);\n return Rec.fromEntries(\n pipe(\n found,\n Arr.map((importer) => [importer.id, closureOf(edges)(importer)] as const),\n ),\n );\n }),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { CLOSURE_FILE, FINGERPRINT_FILE, LOCK_FILE } from \"#/shared/lib/locked-closure-paths.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { lockedClosures } from \"./locked-closures.ts\";\n\nconst LINE = \"\\n\";\nconst FILE_CONCURRENCY = 16;\n\nconst writeChanged = Effect.fn(\"writeChanged\")(function* writeChanged(file: string, text: string) {\n const files = yield* RepositoryFiles;\n const written = yield* files.readFile(file);\n if (!Option.exists(written, (found) => found === text)) {\n yield* files.writeFile(file, text);\n }\n});\n\nconst isWritten = Effect.fn(\"isWritten\")(function* isWritten(root: string, fingerprint: string) {\n const files = yield* RepositoryFiles;\n const recorded = yield* files.readFile(files.join(root, FINGERPRINT_FILE));\n const [hash, ...importers] = Str.split(\n Option.getOrElse(recorded, () => \"\"),\n LINE,\n );\n if (hash !== fingerprint) {\n return false;\n }\n const present = yield* Effect.forEach(\n importers,\n (importer) => files.exists(files.join(root, importer, CLOSURE_FILE)),\n { concurrency: FILE_CONCURRENCY },\n );\n return pipe(present, Arr.every(Boolean));\n});\n\nconst writeAll = Effect.fn(\"writeAll\")(function* writeAll(root: string, fingerprint: string) {\n const files = yield* RepositoryFiles;\n const closures = yield* lockedClosures(root);\n const entries = Rec.toEntries(Option.getOrElse(closures, () => ({})));\n yield* Effect.forEach(\n entries,\n ([importer, closure]) =>\n writeChanged(files.join(root, importer, CLOSURE_FILE), Arr.join(closure, LINE)),\n { concurrency: FILE_CONCURRENCY, discard: true },\n );\n const importers = pipe(\n entries,\n Arr.map(([importer]) => importer),\n );\n yield* files.writeFile(\n files.join(root, FINGERPRINT_FILE),\n Arr.join([fingerprint, ...importers], LINE),\n );\n});\n\n/** @internal */\nexport const writeLockedClosures = Effect.fn(\"writeLockedClosures\")(function* writeLockedClosures(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const fingerprint = yield* files.hashFile(files.join(root, LOCK_FILE));\n if (Option.isNone(fingerprint)) {\n return;\n }\n const written = yield* isWritten(root, fingerprint.value);\n if (!written) {\n yield* writeAll(root, fingerprint.value);\n }\n});\n","import { Array as Arr, Effect, Option, Schema, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nconst SEPARATOR = \"/\";\n\nconst CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });\nconst CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });\nconst CrateEntry = Schema.Struct({\n name: Schema.String,\n version: Schema.String,\n manifest_path: Schema.String,\n targets: Schema.Array(CrateTarget),\n dependencies: Schema.Array(CrateDependency),\n});\nconst CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));\nconst decodeCrateList = Schema.decodeUnknownEffect(CrateList);\n\nexport interface Crate {\n readonly name: string;\n readonly version: string;\n readonly manifest: string;\n readonly kinds: readonly string[];\n readonly pathDependencies: readonly string[];\n}\n\nconst crateOf = (crate: typeof CrateEntry.Type): Crate => ({\n name: crate.name,\n version: crate.version,\n manifest: crate.manifest_path,\n kinds: pipe(\n crate.targets,\n Arr.flatMap(({ kind }) => kind),\n Arr.dedupe,\n ),\n pathDependencies: pipe(\n crate.dependencies,\n Arr.flatMap(({ path }) => Option.toArray(Option.fromUndefinedOr(path))),\n ),\n});\n\n/** @internal */\nexport const cratesIn = Effect.fn(\"cratesIn\")(function* cratesIn(root: string) {\n const handle = yield* ChildProcess.make(\n \"cargo\",\n [\"metadata\", \"--no-deps\", \"--format-version\", \"1\", \"--offline\"],\n { cwd: root, extendEnv: true, stdin: \"ignore\" },\n );\n const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const list = yield* decodeCrateList(output);\n return pipe(list.packages, Arr.map(crateOf));\n}, Effect.scoped);\n\n/** @internal */\nexport const owningWorkspace =\n (directories: readonly string[]) =>\n (directory: string): Option.Option<string> => {\n const owners = pipe(\n directories,\n Arr.filter(\n (workspace) =>\n directory === workspace || Str.startsWith(`${workspace}${SEPARATOR}`)(directory),\n ),\n );\n return Arr.last(Arr.sort(owners, Str.Order));\n };\n","import {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Schema,\n String as Str,\n Record as Rec,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles, NODE_MODULES } from \"#/shared/lib/repository-files.ts\";\n\nexport interface DependencyEntry {\n readonly packageName: string;\n readonly specifier: string;\n readonly declarationsPath: string;\n}\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\n\nconst PackageManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: DependencyMap,\n devDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n exports: Schema.optional(Schema.Unknown),\n types: Schema.optional(Schema.String),\n typings: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n});\n\nexport type Manifest = typeof PackageManifest.Type;\n\nexport const MANIFEST_FILE = \"package.json\";\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst ROOT_SUBPATH = \".\";\nconst SUBPATH_PREFIX = \"./\";\nconst WILDCARD = \"*\";\nconst TYPES_CONDITION = \"types\";\nconst TYPES_SCOPE = \"@types/\";\nconst TYPES_SCOPE_SEPARATOR = \"__\";\nconst CONDITION_DEPTH_LIMIT = 8;\nconst ROOT_DEPTH = 0;\nconst DEPTH_STEP = 1;\nconst DECLARATIONS_SUFFIX = /\\.d\\.[cm]?ts$|\\.[cm]?tsx?$/u;\nconst SCRIPT_SUFFIX = /\\.(?<module>[cm]?)js$/u;\n\nexport const readManifest = Effect.fn(\"readManifest\")(function* readManifest(directory: string) {\n const files = yield* RepositoryFiles;\n const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const text = yield* Effect.fromOption(manifestText);\n return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);\n}, Effect.option);\n\nconst conditionsOf = (held: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(held)) {\n return [];\n }\n return Rec.toEntries(held);\n};\n\nconst typesConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n const entries = conditionsOf(held);\n const declared = Arr.findFirst(entries, ([condition, target]) =>\n Option.liftPredicate(\n target,\n (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate),\n ),\n ).pipe(Option.filter(Predicate.isString));\n return Option.orElse(declared, () =>\n Arr.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)),\n );\n};\n\nconst anyConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (Predicate.isString(held)) {\n return Option.some(held);\n }\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n return Arr.findFirst(conditionsOf(held), ([, nested]) =>\n anyConditionIn(nested, depth + DEPTH_STEP),\n );\n};\n\nconst targetPathsOf = (target: unknown): readonly string[] =>\n Arr.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);\n\ninterface SubpathTarget {\n readonly subpath: string;\n readonly target: unknown;\n}\n\nconst subpathTargetsOf = (exportsField: unknown): readonly SubpathTarget[] => {\n if (Predicate.isString(exportsField)) {\n return [{ subpath: ROOT_SUBPATH, target: exportsField }];\n }\n const entries = conditionsOf(exportsField);\n if (\n !pipe(\n entries,\n Arr.some(([subpath]) => Str.startsWith(ROOT_SUBPATH)(subpath)),\n )\n ) {\n return Arr.match(entries, {\n onEmpty: () => [],\n onNonEmpty: () => [{ subpath: ROOT_SUBPATH, target: exportsField }],\n });\n }\n return pipe(\n entries,\n Arr.filter(([subpath]) => subpath === ROOT_SUBPATH || Str.startsWith(SUBPATH_PREFIX)(subpath)),\n Arr.filter(([subpath]) => !Str.includes(WILDCARD)(subpath)),\n Arr.map(([subpath, target]) => ({ subpath, target })),\n );\n};\n\nconst declarationsCandidateFor = (entryPath: string): Option.Option<string> => {\n if (DECLARATIONS_SUFFIX.test(entryPath)) {\n return Option.some(entryPath);\n }\n if (!SCRIPT_SUFFIX.test(entryPath)) {\n return Option.none();\n }\n return Option.some(Str.replace(SCRIPT_SUFFIX, \".d.$<module>ts\")(entryPath));\n};\n\nconst firstDeclarationsAmong = Effect.fn(\"firstDeclarationsAmong\")(function* firstDeclarations(\n directory: string,\n entryPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const candidates = Arr.getSomes(\n pipe(\n entryPaths,\n Arr.map((entryPath) => declarationsCandidateFor(entryPath)),\n ),\n );\n const existing = yield* Effect.filter(\n pipe(\n candidates,\n Arr.map((candidate) => files.join(directory, candidate)),\n ),\n (candidate) => files.exists(candidate),\n );\n return yield* Option.match(Arr.head(existing), {\n onNone: (): Effect.Effect<Option.Option<string>> => Effect.succeedNone,\n onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome),\n });\n});\n\nconst importNameOf = (packageName: string): string => {\n if (!Str.startsWith(TYPES_SCOPE)(packageName)) {\n return packageName;\n }\n const unscoped = Str.slice(TYPES_SCOPE.length)(packageName);\n if (!Str.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) {\n return unscoped;\n }\n return `@${Str.replace(TYPES_SCOPE_SEPARATOR, \"/\")(unscoped)}`;\n};\n\nconst specifierFor = (packageName: string, subpath: string): string => {\n const importName = importNameOf(packageName);\n if (subpath === ROOT_SUBPATH) {\n return importName;\n }\n return `${importName}/${Str.slice(SUBPATH_PREFIX.length)(subpath)}`;\n};\n\nconst rootEntryPaths = (manifest: Manifest): readonly string[] =>\n Arr.getSomes([\n Option.fromUndefinedOr(manifest.types),\n Option.fromUndefinedOr(manifest.typings),\n Option.fromUndefinedOr(manifest.main),\n ]);\n\nconst subpathEntriesOf = Effect.fn(\"subpathEntriesOf\")(function* subpathEntriesOf(\n packageName: string,\n directory: string,\n manifest: Manifest,\n) {\n const found = yield* Effect.forEach(\n subpathTargetsOf(manifest.exports),\n ({ subpath, target }) =>\n firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(\n Effect.map(\n Option.map((declarationsPath) => ({\n packageName,\n specifier: specifierFor(packageName, subpath),\n declarationsPath,\n })),\n ),\n ),\n { concurrency: 1 },\n );\n return Arr.getSomes(found);\n});\n\nconst entriesOfDependency = Effect.fn(\"entriesOfDependency\")(function* entriesOfDependency(\n packageName: string,\n directory: string,\n) {\n const manifest = yield* readManifest(directory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);\n const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);\n if (\n pipe(\n subpathEntries,\n Arr.some((entry) => entry.specifier === rootSpecifier),\n )\n ) {\n return subpathEntries;\n }\n const rootDeclarations = yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value));\n const rootEntries = rootDeclarations.pipe(\n Option.map((declarationsPath) => ({ packageName, specifier: rootSpecifier, declarationsPath })),\n Option.toArray,\n );\n return [...rootEntries, ...subpathEntries];\n});\n\nconst declaredDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n }),\n Arr.filter(([, range]) => !Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nexport const workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({ ...manifest.dependencies, ...manifest.devDependencies }),\n Arr.filter(([, range]) => Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst entryOrder = Order.mapInput(Order.String, (entry: DependencyEntry) => entry.specifier);\n\nexport const dependencyEntries = Effect.fn(\"dependencyEntries\")(function* dependencyEntries(\n packageDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(packageDirectory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const entries = yield* Effect.forEach(\n declaredDependencies(manifest.value),\n (packageName) =>\n entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)),\n { concurrency: 1 },\n );\n return Arr.sort(\n Arr.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier),\n entryOrder,\n );\n});\n"],"mappings":";;;;;;;;;;;AASA,MAAM,WAAW;CAAC;CAAkB;CAAyB;AAAyB;AAEtF,MAAa,YAAY,OAAO,MAAM,CACpC,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,YAAY;CAAG,MAAM,OAAO;AAAO,CAAC,GACzE,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,SAAS;CAAG,OAAO,OAAO;AAAO,CAAC,CACzE,CAAC;AACD,MAAM,QAAQ,OAAO,OAAO,EAAE,OAAO,OAAO,OAAO,EAAE,QAAQ,OAAO,OAAO,CAAC,EAAE,CAAC;AAC/E,MAAM,eAAe,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU,OAAO,QAAQ,KAAK;CAC9B,KAAK;CACL,OAAO,OAA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AA2B,MAAM,SAAS;AAE3F,MAAa,oBAAoB,OAAO,GAAG,mBAAmB,CAAC,CAAC,UAAU,kBACxE,kBACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,WAAW,OAAO,aAAa,gBAAgB;CACrD,IAAI,OAAO,OAAO,QAAQ,GACxB,OAAO,CAAC;CAEV,MAAM,UAAU,OAAO,OAAO,QAC5B,qBAAqB,SAAS,KAAK,IAClC,gBACC,oBAAoB,aAAa,MAAM,KAAK,kBAAkB,cAAc,WAAW,CAAC,GAC1F,EAAE,aAAa,EAAE,CACnB;CACA,OAAOA,MAAI,KACTA,MAAI,WAAW,QAAQ,KAAK,IAAI,MAAM,UAAU,KAAK,cAAc,MAAM,SAAS,GAClF,UACF;AACF,CAAC"}
|
|
@@ -12,7 +12,7 @@ declare const decisionRules: Readonly<Record<string, "error">>;
|
|
|
12
12
|
declare const decisionTestRules: Record<string, "off">;
|
|
13
13
|
declare const lint$2: {
|
|
14
14
|
ignorePatterns: string[];
|
|
15
|
-
plugins: ("effecttsgo" | "eslint" | "import" | "jsdoc" | "jsx-a11y" | "node" | "oxc" | "promise" | "react" | "react-perf" | "typescript" | "unicorn")[];
|
|
15
|
+
plugins: ("effecttsgo" | "eslint" | "import" | "jsdoc" | "jsx-a11y" | "node" | "oxc" | "promise" | "react" | "react-perf" | "typescript" | "unicorn" | "vitest")[];
|
|
16
16
|
categories: {
|
|
17
17
|
correctness: "error";
|
|
18
18
|
suspicious: "error";
|
|
@@ -27,6 +27,41 @@ declare const lint$2: {
|
|
|
27
27
|
specifier: string;
|
|
28
28
|
}[];
|
|
29
29
|
rules: {
|
|
30
|
+
"jsx-a11y/no-redundant-roles": ["error", {
|
|
31
|
+
ul: string[];
|
|
32
|
+
ol: string[];
|
|
33
|
+
}];
|
|
34
|
+
"jsx-a11y/no-noninteractive-tabindex": ["error", {
|
|
35
|
+
tags: string[];
|
|
36
|
+
roles: string[];
|
|
37
|
+
}];
|
|
38
|
+
"vitest/expect-expect": ["error", {
|
|
39
|
+
assertFunctionNames: string[];
|
|
40
|
+
}];
|
|
41
|
+
"vitest/valid-expect": ["error", {
|
|
42
|
+
maxArgs: number;
|
|
43
|
+
}];
|
|
44
|
+
"vitest/valid-title": ["error", {
|
|
45
|
+
allowArguments: boolean;
|
|
46
|
+
}];
|
|
47
|
+
"vitest/prefer-called-times": "off";
|
|
48
|
+
"vitest/prefer-import-in-mock": "off";
|
|
49
|
+
"vitest/no-standalone-expect": "off";
|
|
50
|
+
"vitest/no-conditional-in-test": "off";
|
|
51
|
+
"vitest/require-test-timeout": "off";
|
|
52
|
+
"vitest/prefer-expect-assertions": "off";
|
|
53
|
+
"vitest/require-top-level-describe": "off";
|
|
54
|
+
"vitest/no-importing-vitest-globals": "off";
|
|
55
|
+
"vitest/require-hook": "off";
|
|
56
|
+
"vitest/no-hooks": "off";
|
|
57
|
+
"vitest/consistent-test-it": "off";
|
|
58
|
+
"vitest/prefer-describe-function-title": "off";
|
|
59
|
+
"vitest/prefer-lowercase-title": "off";
|
|
60
|
+
"vitest/prefer-to-be-truthy": "off";
|
|
61
|
+
"vitest/prefer-to-be-falsy": "off";
|
|
62
|
+
"vitest/padding-around-after-all-blocks": "off";
|
|
63
|
+
"vitest/padding-around-test-blocks": "off";
|
|
64
|
+
"vitest/max-expects": "off";
|
|
30
65
|
"vite-plus/prefer-vite-plus-imports": "error";
|
|
31
66
|
"tanstack-start/no-async-client-component": "error";
|
|
32
67
|
"tanstack-start/no-client-code-in-server-component": "error";
|
|
@@ -62,9 +97,13 @@ declare const lint$2: {
|
|
|
62
97
|
"import/group-exports": "off";
|
|
63
98
|
"import/exports-last": "off";
|
|
64
99
|
"msch-lint/ecosystem-readers": "error";
|
|
100
|
+
"msch-lint/get-or-insert": "error";
|
|
101
|
+
"msch-lint/mcp-tool-layer": "error";
|
|
65
102
|
"msch-lint/inline-exports": "error";
|
|
66
103
|
"msch-lint/ui-state-in-atoms": "error";
|
|
67
104
|
"msch-lint/no-hand-written-sql": "error";
|
|
105
|
+
"msch-lint/platform-node-by-module": "error";
|
|
106
|
+
"msch-lint/typed-calls-not-reflect": "error";
|
|
68
107
|
"react/react-in-jsx-scope": "off";
|
|
69
108
|
"eslint/no-undef": "off";
|
|
70
109
|
"typescript/promise-function-async": "off";
|
|
@@ -225,4 +264,4 @@ interface MarkdownOptions {
|
|
|
225
264
|
}
|
|
226
265
|
declare const markdownOf: ({ ignores, rules, docs }: MarkdownOptions) => Y8Config;
|
|
227
266
|
export { allRulesOf as _, textlintPresets as a, generated as b, tracedRules as c, alchemyOverride as d, cloudflareResourceSyntax as f, lint$2 as g, removalPolicySyntax as h, readonlyParameterAllow as i, INSTRUMENTATION as l, removalPolicyOverride as m, markdownOf as n, structureOf as o, commandsOverride as p, _default as r, remotionRules as s, MarkdownOptions as t, requiredStack as u, decisionRules as v, decisionTestRules as y };
|
|
228
|
-
//# sourceMappingURL=index-
|
|
267
|
+
//# sourceMappingURL=index-B2X8WhBt.d.mts.map
|
|
@@ -12,13 +12,23 @@ interface IgnoredDirectory {
|
|
|
12
12
|
readonly base: "workspace";
|
|
13
13
|
}
|
|
14
14
|
declare const ignoredDirectories: (root: string) => Promise<readonly IgnoredDirectory[]>;
|
|
15
|
-
type RuleSet = Readonly<Record<string, unknown>>;
|
|
16
|
-
type RuleSets = Readonly<Record<string, RuleSet>>;
|
|
17
15
|
type DependencySets = Readonly<Record<string, readonly string[]>>;
|
|
18
|
-
interface
|
|
16
|
+
interface DependencyAllowance {
|
|
19
17
|
readonly workspaces: readonly string[];
|
|
20
18
|
readonly dependencies: readonly string[];
|
|
21
19
|
}
|
|
20
|
+
type DependencyAllowances = Readonly<Record<string, DependencyAllowance>>;
|
|
21
|
+
interface SharedTestProject {
|
|
22
|
+
readonly extends: string | false;
|
|
23
|
+
readonly root: string;
|
|
24
|
+
readonly test: {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly isolate: false;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
type TestProject = string | SharedTestProject;
|
|
30
|
+
type RuleSet = Readonly<Record<string, unknown>>;
|
|
31
|
+
type RuleSets = Readonly<Record<string, RuleSet>>;
|
|
22
32
|
interface WorkspaceLint {
|
|
23
33
|
readonly ignorePatterns: readonly string[];
|
|
24
34
|
readonly overrides: readonly OxlintOverride[];
|
|
@@ -30,9 +40,10 @@ interface WorkspaceSettings {
|
|
|
30
40
|
readonly lint: WorkspaceLint;
|
|
31
41
|
readonly members: readonly string[];
|
|
32
42
|
readonly ignoredDirectories: readonly IgnoredDirectory[];
|
|
33
|
-
readonly testProjects: readonly
|
|
43
|
+
readonly testProjects: readonly TestProject[];
|
|
34
44
|
readonly tasks: WorkspaceTasks;
|
|
35
|
-
readonly devDependencies:
|
|
45
|
+
readonly devDependencies: DependencyAllowances;
|
|
46
|
+
readonly dependencies: DependencyAllowances;
|
|
36
47
|
}
|
|
37
48
|
interface SettingsOptions {
|
|
38
49
|
readonly root: string;
|
|
@@ -40,5 +51,5 @@ interface SettingsOptions {
|
|
|
40
51
|
readonly dependencySets: DependencySets;
|
|
41
52
|
}
|
|
42
53
|
declare const workspaceSettings: (options: SettingsOptions) => Promise<WorkspaceSettings>;
|
|
43
|
-
export {
|
|
44
|
-
//# sourceMappingURL=index-
|
|
54
|
+
export { WorkspaceSettings as a, DependencySets as c, WorkspaceTasks as d, WorkspaceLint as i, IgnoredDirectory as l, RuleSets as n, workspaceSettings as o, SettingsOptions as r, DependencyAllowance as s, RuleSet as t, ignoredDirectories as u };
|
|
55
|
+
//# sourceMappingURL=index-BZIBqvmt.d.mts.map
|
package/dist/lint-rules.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Boolean, Option, Record, Schema, String, pipe } from "effect";
|
|
1
|
+
import { Array, Boolean, Option, Predicate, Record, Schema, String, pipe } from "effect";
|
|
2
2
|
// src/features/define-lint-rules/model/ecosystem-readers.ts
|
|
3
3
|
const ECOSYSTEM_FILES = [
|
|
4
4
|
{
|
|
@@ -54,8 +54,8 @@ const PARSER_CALLS = {
|
|
|
54
54
|
typescript: Option.none(),
|
|
55
55
|
yaml: Option.none()
|
|
56
56
|
};
|
|
57
|
-
const SEPARATOR = "/";
|
|
58
|
-
const baseNameOf = (text) => pipe(String.split(text, SEPARATOR), Array.last, Option.getOrElse(() => text));
|
|
57
|
+
const SEPARATOR$1 = "/";
|
|
58
|
+
const baseNameOf = (text) => pipe(String.split(text, SEPARATOR$1), Array.last, Option.getOrElse(() => text));
|
|
59
59
|
const importedModules = (statements) => pipe(statements, Array.filter((statement) => statement.type === "ImportDeclaration"), Array.map((declaration) => declaration.source.value));
|
|
60
60
|
const parserIn = (context) => (format) => {
|
|
61
61
|
const imported = importedModules(context.sourceCode.ast.body);
|
|
@@ -86,6 +86,205 @@ const ecosystemReaders = {
|
|
|
86
86
|
}
|
|
87
87
|
})
|
|
88
88
|
};
|
|
89
|
+
// src/features/define-lint-rules/model/get-or-insert-ast.ts
|
|
90
|
+
const START$3 = 0;
|
|
91
|
+
const END$3 = 1;
|
|
92
|
+
const KEY = 0;
|
|
93
|
+
const VALUE = 1;
|
|
94
|
+
const ONE$1 = 1;
|
|
95
|
+
const RangeSchema$1 = Schema.Tuple([Schema.Finite, Schema.Finite]);
|
|
96
|
+
const RangedSchema$1 = Schema.Struct({ range: RangeSchema$1 });
|
|
97
|
+
const decodeRanged = Schema.decodeUnknownOption(RangedSchema$1);
|
|
98
|
+
const IdentifierSchema$1 = Schema.Struct({
|
|
99
|
+
type: Schema.Literal("Identifier"),
|
|
100
|
+
name: Schema.String
|
|
101
|
+
});
|
|
102
|
+
const MemberSchema = Schema.Struct({
|
|
103
|
+
type: Schema.Literal("MemberExpression"),
|
|
104
|
+
computed: Schema.Literal(false),
|
|
105
|
+
object: RangedSchema$1,
|
|
106
|
+
property: IdentifierSchema$1
|
|
107
|
+
});
|
|
108
|
+
const MemberCallSchema = Schema.Struct({
|
|
109
|
+
type: Schema.Literal("CallExpression"),
|
|
110
|
+
callee: MemberSchema,
|
|
111
|
+
arguments: Schema.Array(RangedSchema$1)
|
|
112
|
+
});
|
|
113
|
+
const decodeMemberCall = Schema.decodeUnknownOption(MemberCallSchema);
|
|
114
|
+
const decodeCall = Schema.decodeUnknownOption(Schema.Struct({
|
|
115
|
+
type: Schema.Literal("CallExpression"),
|
|
116
|
+
callee: RangedSchema$1,
|
|
117
|
+
arguments: Schema.Array(Schema.Unknown)
|
|
118
|
+
}));
|
|
119
|
+
const decodeBlock = Schema.decodeUnknownOption(Schema.Struct({
|
|
120
|
+
type: Schema.Literal("BlockStatement"),
|
|
121
|
+
body: Schema.Array(Schema.Unknown)
|
|
122
|
+
}));
|
|
123
|
+
const decodeExpressionStatement = Schema.decodeUnknownOption(Schema.Struct({
|
|
124
|
+
type: Schema.Literal("ExpressionStatement"),
|
|
125
|
+
expression: Schema.Unknown
|
|
126
|
+
}));
|
|
127
|
+
const decodeReturn = Schema.decodeUnknownOption(Schema.Struct({
|
|
128
|
+
type: Schema.Literal("ReturnStatement"),
|
|
129
|
+
argument: RangedSchema$1
|
|
130
|
+
}));
|
|
131
|
+
const decodeTyped = Schema.decodeUnknownOption(Schema.Struct({ type: Schema.String }));
|
|
132
|
+
const textOf$1 = (scope) => (node) => String.slice(node.range[START$3], node.range[END$3])(scope.text);
|
|
133
|
+
const textOfNode = (scope) => (node) => pipe(decodeRanged(node), Option.map(textOf$1(scope)));
|
|
134
|
+
const accessOf = (scope) => (method) => (node) => pipe(decodeMemberCall(node), Option.filter((call) => call.callee.property.name === method), Option.flatMap((call) => pipe(Array.get(call.arguments, KEY), Option.map((key) => ({
|
|
135
|
+
map: textOf$1(scope)(call.callee.object),
|
|
136
|
+
key: textOf$1(scope)(key),
|
|
137
|
+
value: pipe(Array.get(call.arguments, VALUE), Option.map(textOf$1(scope)))
|
|
138
|
+
})))));
|
|
139
|
+
const sameEntry = (left) => (right) => left.map === right.map && left.key === right.key;
|
|
140
|
+
const calleeMatches = (scope) => (pattern) => (node) => pipe(decodeCall(node), Option.filter((call) => pattern.test(textOf$1(scope)(call.callee))), Option.map((call) => call.arguments));
|
|
141
|
+
const expressionOf = (statement) => pipe(decodeExpressionStatement(statement), Option.map((found) => found.expression));
|
|
142
|
+
const returnedText = (scope) => (statement) => pipe(decodeReturn(statement), Option.map((found) => textOf$1(scope)(found.argument)));
|
|
143
|
+
const bodyOf = (node) => pipe(decodeBlock(node), Option.map((block) => block.body));
|
|
144
|
+
const onlyStatement = (statement) => Option.match(bodyOf(statement), {
|
|
145
|
+
onNone: () => Option.some(statement),
|
|
146
|
+
onSome: (body) => Option.flatMap(Option.liftPredicate(body, (all) => all.length === ONE$1), Array.head)
|
|
147
|
+
});
|
|
148
|
+
const typeOf = (node) => pipe(decodeTyped(node), Option.match({
|
|
149
|
+
onNone: () => "",
|
|
150
|
+
onSome: (found) => found.type
|
|
151
|
+
}));
|
|
152
|
+
const parentOf = (node) => pipe(Option.liftPredicate(node, Predicate.hasProperty("parent")), Option.flatMap((found) => Option.fromNullishOr(found.parent)));
|
|
153
|
+
const childrenOf$1 = (keys, node) => pipe(Option.liftPredicate(node, Predicate.isObject), Option.match({
|
|
154
|
+
onNone: () => [],
|
|
155
|
+
onSome: (found) => pipe(keys[typeOf(found)] ?? [], Array.flatMap((key) => pipe(Option.liftPredicate(found, Predicate.hasProperty(key)), Option.match({
|
|
156
|
+
onNone: () => [],
|
|
157
|
+
onSome: (owner) => Array.ensure(owner[key])
|
|
158
|
+
}))), Array.filter(Predicate.isObject))
|
|
159
|
+
}));
|
|
160
|
+
const descendants = (keys) => (node) => [node, ...pipe(childrenOf$1(keys, node), Array.flatMap(descendants(keys)))];
|
|
161
|
+
const accessesIn = (scope) => (method) => (node) => pipe(descendants(scope.keys)(node), Array.map(accessOf(scope)(method)), Array.getSomes);
|
|
162
|
+
// src/features/define-lint-rules/model/get-or-insert.ts
|
|
163
|
+
const MESSAGE$2 = "Use getOrInsert or getOrInsertComputed on the Map or WeakMap, so that reading a key and storing its first value is one call. Do not read the key and then set it by hand.";
|
|
164
|
+
const ONE = 1;
|
|
165
|
+
const TWO = 2;
|
|
166
|
+
const OPTION_FROM = /^(?:Option\.)?from(?:NullishOr|UndefinedOr|Nullable)$/u;
|
|
167
|
+
const GET_OR_ELSE = /^(?:Option\.)?getOrElse$/u;
|
|
168
|
+
const FUNCTIONS = ["ArrowFunctionExpression", "FunctionExpression"];
|
|
169
|
+
const decodeGuard = Schema.decodeUnknownOption(Schema.Struct({
|
|
170
|
+
type: Schema.Literal("IfStatement"),
|
|
171
|
+
test: Schema.Unknown,
|
|
172
|
+
consequent: Schema.Unknown,
|
|
173
|
+
alternate: Schema.Null
|
|
174
|
+
}));
|
|
175
|
+
const decodeNot = Schema.decodeUnknownOption(Schema.Struct({
|
|
176
|
+
type: Schema.Literal("UnaryExpression"),
|
|
177
|
+
operator: Schema.Literal("!"),
|
|
178
|
+
argument: Schema.Unknown
|
|
179
|
+
}));
|
|
180
|
+
const DeclaratorSchema$1 = Schema.Struct({
|
|
181
|
+
id: Schema.Struct({
|
|
182
|
+
type: Schema.Literal("Identifier"),
|
|
183
|
+
name: Schema.String
|
|
184
|
+
}),
|
|
185
|
+
init: Schema.Unknown
|
|
186
|
+
});
|
|
187
|
+
const decodeDeclaration = Schema.decodeUnknownOption(Schema.Struct({
|
|
188
|
+
type: Schema.Literal("VariableDeclaration"),
|
|
189
|
+
declarations: Schema.Array(DeclaratorSchema$1)
|
|
190
|
+
}));
|
|
191
|
+
const decodeNullish = Schema.decodeUnknownOption(Schema.Struct({
|
|
192
|
+
type: Schema.Literal("LogicalExpression"),
|
|
193
|
+
operator: Schema.Literal("??"),
|
|
194
|
+
left: Schema.Unknown
|
|
195
|
+
}));
|
|
196
|
+
const storeOf = (scope) => (statement) => pipe(expressionOf(statement), Option.flatMap(accessOf(scope)("set")));
|
|
197
|
+
const isHasGuard = (scope, node) => pipe(decodeGuard(node), Option.exists((guard) => {
|
|
198
|
+
const guarded = pipe(decodeNot(guard.test), Option.flatMap((not) => accessOf(scope)("has")(not.argument)));
|
|
199
|
+
const stored = pipe(onlyStatement(guard.consequent), Option.flatMap(storeOf(scope)));
|
|
200
|
+
return Option.isSome(guarded) && Option.exists(stored, sameEntry(guarded.value));
|
|
201
|
+
}));
|
|
202
|
+
const deletes = (scope, read) => (statement) => pipe(expressionOf(statement), Option.flatMap(accessOf(scope)("delete")), Option.exists(sameEntry(read)));
|
|
203
|
+
const storesBack = (scope, read, name) => (statement) => Option.exists(storeOf(scope)(statement), (stored) => sameEntry(read)(stored) && Option.exists(stored.value, (value) => value === name));
|
|
204
|
+
const fallsBack = (scope, later) => (declarator) => pipe(decodeNullish(declarator.init), Option.flatMap((nullish) => accessOf(scope)("get")(nullish.left)), Option.exists((read) => pipe(later, Array.some(storesBack(scope, read, declarator.id.name))) && !pipe(later, Array.some(deletes(scope, read)))));
|
|
205
|
+
const fallbackIndices = (scope, body) => pipe(body, Array.map((statement, index) => {
|
|
206
|
+
const fallsBackLater = fallsBack(scope, Array.drop(body, index + ONE));
|
|
207
|
+
return pipe(decodeDeclaration(statement), Option.map((declaration) => declaration.declarations), Option.filter(Array.some(fallsBackLater)), Option.as(index));
|
|
208
|
+
}), Array.getSomes);
|
|
209
|
+
const itself = (name) => name;
|
|
210
|
+
const CACHED_CHECKS = [
|
|
211
|
+
{
|
|
212
|
+
test: (name) => `${name} !== undefined`,
|
|
213
|
+
value: itself
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
test: (name) => `${name} != null`,
|
|
217
|
+
value: itself
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
test: (name) => `${name} !== null`,
|
|
221
|
+
value: itself
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
test: (name) => `Predicate.isNotUndefined(${name})`,
|
|
225
|
+
value: itself
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
test: (name) => `Predicate.isNotNullish(${name})`,
|
|
229
|
+
value: itself
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
test: itself,
|
|
233
|
+
value: itself
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
test: (name) => `Option.isSome(${name})`,
|
|
237
|
+
value: (name) => `${name}.value`
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
const returnsCached = (scope, name) => (statement) => pipe(decodeGuard(statement), Option.exists((guard) => {
|
|
241
|
+
const tested = textOfNode(scope)(guard.test);
|
|
242
|
+
const returned = pipe(onlyStatement(guard.consequent), Option.flatMap(returnedText(scope)));
|
|
243
|
+
return pipe(CACHED_CHECKS, Array.some((check) => Option.exists(tested, (found) => found === check.test(name)) && Option.exists(returned, (found) => found === check.value(name))));
|
|
244
|
+
}));
|
|
245
|
+
const unwrapOption = (scope) => (node) => pipe(calleeMatches(scope)(OPTION_FROM)(node), Option.flatMap(Array.head), Option.getOrElse(() => node));
|
|
246
|
+
const readsCached = (scope, stored) => (declarator) => pipe(unwrapOption(scope)(declarator.init), accessOf(scope)("get"), Option.exists(sameEntry(stored)));
|
|
247
|
+
const earlyReturn = (scope, body, stored) => pipe(body, Array.some((statement, index) => pipe(decodeDeclaration(statement), Option.flatMap((declaration) => Array.head(declaration.declarations)), Option.filter(readsCached(scope, stored)), Option.exists((declarator) => Option.exists(Array.get(body, index + ONE), returnsCached(scope, declarator.id.name))))));
|
|
248
|
+
const storedAndReturned = (scope, body) => {
|
|
249
|
+
const returned = pipe(Array.last(body), Option.flatMap(returnedText(scope)));
|
|
250
|
+
return pipe(Array.get(body, body.length - TWO), Option.flatMap(storeOf(scope)), Option.filter((stored) => Option.isSome(returned) && Option.contains(stored.value, returned.value)));
|
|
251
|
+
};
|
|
252
|
+
const optionRegion = (scope, block) => pipe(parentOf(block), Option.filter((fn) => Array.contains(FUNCTIONS, typeOf(fn))), Option.flatMap(parentOf), Option.filter((call) => Option.isSome(calleeMatches(scope)(GET_OR_ELSE)(call))), Option.flatMap(parentOf));
|
|
253
|
+
const readsThroughOption = (scope, stored) => (node) => pipe(calleeMatches(scope)(OPTION_FROM)(node), Option.flatMap(Array.head), Option.flatMap(accessOf(scope)("get")), Option.exists(sameEntry(stored)));
|
|
254
|
+
const storesOnce = (scope, stored) => (region) => pipe(accessesIn(scope)("set")(region), Array.filter(sameEntry(stored))).length === ONE;
|
|
255
|
+
const returnsOnce = (scope, block) => pipe(descendants(scope.keys)(block), Array.filter((node) => typeOf(node) === "ReturnStatement")).length === ONE;
|
|
256
|
+
const fallsBackInOption = (scope, block, stored) => returnsOnce(scope, block) && Option.exists(optionRegion(scope, block), (region) => pipe(descendants(scope.keys)(region), Array.some(readsThroughOption(scope, stored))) && storesOnce(scope, stored)(region));
|
|
257
|
+
const isMemoized = (scope, block) => pipe(bodyOf(block), Option.exists((body) => Option.exists(storedAndReturned(scope, body), (stored) => {
|
|
258
|
+
if (earlyReturn(scope, body, stored)) return storesOnce(scope, stored)(block);
|
|
259
|
+
return fallsBackInOption(scope, block, stored);
|
|
260
|
+
})));
|
|
261
|
+
const getOrInsert = {
|
|
262
|
+
meta: { type: "suggestion" },
|
|
263
|
+
create: (context) => {
|
|
264
|
+
const scope = {
|
|
265
|
+
text: context.sourceCode.text,
|
|
266
|
+
keys: context.sourceCode.visitorKeys
|
|
267
|
+
};
|
|
268
|
+
return {
|
|
269
|
+
IfStatement: (node) => {
|
|
270
|
+
if (isHasGuard(scope, node)) context.report({
|
|
271
|
+
node,
|
|
272
|
+
message: MESSAGE$2
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
BlockStatement: (node) => {
|
|
276
|
+
for (const index of fallbackIndices(scope, node.body)) for (const statement of Option.toArray(Array.get(node.body, index))) context.report({
|
|
277
|
+
node: statement,
|
|
278
|
+
message: MESSAGE$2
|
|
279
|
+
});
|
|
280
|
+
if (isMemoized(scope, node)) context.report({
|
|
281
|
+
node,
|
|
282
|
+
message: MESSAGE$2
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
};
|
|
89
288
|
// src/features/define-lint-rules/model/inline-exports-resolve.ts
|
|
90
289
|
const DEFAULT_NAME$1 = "default";
|
|
91
290
|
const CLASS_DECLARATION = "ClassDeclaration";
|
|
@@ -412,7 +611,7 @@ const exportListOf = (node) => pipe(decodeList(node), Option.filter((list) => Ar
|
|
|
412
611
|
body: pipe(list.parent.body, Array.map(statementOf), Array.getSomes)
|
|
413
612
|
})));
|
|
414
613
|
// src/features/define-lint-rules/model/inline-exports.ts
|
|
415
|
-
const MESSAGE = "export は宣言に付ける(export const・export function など)。ファイルの末尾で export { … } にまとめない。";
|
|
614
|
+
const MESSAGE$1 = "export は宣言に付ける(export const・export function など)。ファイルの末尾で export { … } にまとめない。";
|
|
416
615
|
const START = 0;
|
|
417
616
|
const END = 1;
|
|
418
617
|
const outside = (list) => (range) => range[START] < list[START] || range[END] > list[END];
|
|
@@ -427,13 +626,13 @@ const reportList = (context, node, list) => {
|
|
|
427
626
|
onNone: () => {
|
|
428
627
|
context.report({
|
|
429
628
|
node,
|
|
430
|
-
message: MESSAGE
|
|
629
|
+
message: MESSAGE$1
|
|
431
630
|
});
|
|
432
631
|
},
|
|
433
632
|
onSome: (edits) => {
|
|
434
633
|
context.report({
|
|
435
634
|
node,
|
|
436
|
-
message: MESSAGE,
|
|
635
|
+
message: MESSAGE$1,
|
|
437
636
|
fix: (fixer) => pipe(edits, Array.map((edit) => fixer.replaceTextRange([edit.range[START], edit.range[END]], edit.text)))
|
|
438
637
|
});
|
|
439
638
|
}
|
|
@@ -570,6 +769,23 @@ const INTENTS = {
|
|
|
570
769
|
properties: ["make"]
|
|
571
770
|
}]
|
|
572
771
|
},
|
|
772
|
+
"platform-node-by-module": {
|
|
773
|
+
message: "Import names from a module path, such as import { layer } from \"@effect/platform-node/NodeServices\". The package root loads every module, the Redis client included, and adds about 250 ms to each start.",
|
|
774
|
+
imports: [{
|
|
775
|
+
module: "@effect/platform-node",
|
|
776
|
+
names: Option.none(),
|
|
777
|
+
typesAllowed: true
|
|
778
|
+
}],
|
|
779
|
+
members: []
|
|
780
|
+
},
|
|
781
|
+
"typed-calls-not-reflect": {
|
|
782
|
+
message: "Read properties and call functions through typed access, or decode untyped values with Schema at the boundary. Do not go around the types with Reflect.",
|
|
783
|
+
imports: [],
|
|
784
|
+
members: [{
|
|
785
|
+
object: "Reflect",
|
|
786
|
+
properties: ["get", "apply"]
|
|
787
|
+
}]
|
|
788
|
+
},
|
|
573
789
|
"db-writes-in-writers": {
|
|
574
790
|
message: "Write tables only from a *-writer.server.ts module, so that a table update and its revision go into the same batch. Call the writer here instead of writing through db.",
|
|
575
791
|
imports: [],
|
|
@@ -585,12 +801,37 @@ const INTENTS = {
|
|
|
585
801
|
}]
|
|
586
802
|
}
|
|
587
803
|
};
|
|
804
|
+
// src/features/define-lint-rules/model/mcp-tool-layer.ts
|
|
805
|
+
const SOURCE = "/src/";
|
|
806
|
+
const SEPARATOR = "/";
|
|
807
|
+
const WINDOWS_SEPARATOR = "\\";
|
|
808
|
+
const TOOL_LAYERS = ["features", "shared"];
|
|
809
|
+
const TEST_FILE = /\.test(?:\.support)?\.[cm]?[jt]sx?$/u;
|
|
810
|
+
const METHOD = "registerTool";
|
|
811
|
+
const MESSAGE = "Register an MCP tool in the features slice of the operation it performs. A tool is one operation, so app/ only composes the slices' register functions and entities/ only holds the data they share.";
|
|
812
|
+
const layerIn = (path) => pipe(String.lastIndexOf(SOURCE)(path), Option.flatMap((index) => pipe(String.slice(index + 5)(path), String.split(SEPARATOR), Array.head)));
|
|
813
|
+
const layerOf = (filename) => layerIn(String.replaceAll(WINDOWS_SEPARATOR, SEPARATOR)(filename));
|
|
814
|
+
const outsideToolLayers = (filename) => !TEST_FILE.test(filename) && Option.exists(layerOf(filename), (layer) => !Array.contains(TOOL_LAYERS, layer));
|
|
588
815
|
// src/features/define-lint-rules/model/plugin.ts
|
|
589
816
|
const mschLintPlugin = {
|
|
590
817
|
meta: { name: "msch-lint" },
|
|
591
818
|
rules: {
|
|
592
819
|
"ecosystem-readers": ecosystemReaders,
|
|
820
|
+
"get-or-insert": getOrInsert,
|
|
593
821
|
"inline-exports": inlineExports,
|
|
822
|
+
"mcp-tool-layer": {
|
|
823
|
+
meta: { type: "problem" },
|
|
824
|
+
create: (context) => {
|
|
825
|
+
if (!outsideToolLayers(context.filename)) return {};
|
|
826
|
+
return { CallExpression: (node) => {
|
|
827
|
+
const { callee } = node;
|
|
828
|
+
if (callee.type === "MemberExpression" && callee.property.type === "Identifier" && callee.property.name === METHOD) context.report({
|
|
829
|
+
node: callee.property,
|
|
830
|
+
message: MESSAGE
|
|
831
|
+
});
|
|
832
|
+
} };
|
|
833
|
+
}
|
|
834
|
+
},
|
|
594
835
|
...pipe(INTENTS, Record.map(ruleOf))
|
|
595
836
|
}
|
|
596
837
|
};
|