@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.
Files changed (41) hide show
  1. package/dist/cargo-inputs.mjs +1 -1
  2. package/dist/changed.mjs +2 -2
  3. package/dist/cli.mjs +453 -331
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +10 -6
  7. package/dist/config.mjs.map +1 -1
  8. package/dist/decision-rules.d.mts +1 -1
  9. package/dist/decision-rules.mjs +1 -1
  10. package/dist/{define-lint-preset-B1Xy1brk.mjs → define-lint-preset-CecEvjVf.mjs} +96 -1
  11. package/dist/define-lint-preset-CecEvjVf.mjs.map +1 -0
  12. package/dist/{dependencies-DbwLA4nT.mjs → dependencies-DCJv7YcW.mjs} +5 -2
  13. package/dist/dependencies-DCJv7YcW.mjs.map +1 -0
  14. package/dist/{index-DL7PSp7j.d.mts → index-B2X8WhBt.d.mts} +41 -2
  15. package/dist/{index-DdJXnW1q.d.mts → index-BZIBqvmt.d.mts} +18 -7
  16. package/dist/lint-rules.mjs +247 -6
  17. package/dist/lint-rules.mjs.map +1 -1
  18. package/dist/lint.d.mts +1 -1
  19. package/dist/lint.mjs +1 -1
  20. package/dist/oxlint.mjs +3 -7
  21. package/dist/oxlint.mjs.map +1 -1
  22. package/dist/{package-BKpgZyaV.mjs → package-LeBO9czg.mjs} +2 -2
  23. package/dist/{package-BKpgZyaV.mjs.map → package-LeBO9czg.mjs.map} +1 -1
  24. package/dist/{problem-D8mlJc3T.mjs → problem-CzOlOb5f.mjs} +10 -2
  25. package/dist/problem-CzOlOb5f.mjs.map +1 -0
  26. package/dist/{project-CR2jzkij.mjs → project-C4uzq7_4.mjs} +2 -2
  27. package/dist/{project-CR2jzkij.mjs.map → project-C4uzq7_4.mjs.map} +1 -1
  28. package/dist/started-once-muJbvD_I.mjs +8 -0
  29. package/dist/started-once-muJbvD_I.mjs.map +1 -0
  30. package/dist/workspace-settings.d.mts +2 -2
  31. package/dist/workspace-settings.mjs +83 -42
  32. package/dist/workspace-settings.mjs.map +1 -1
  33. package/package.json +3 -1
  34. package/skills/msch-checks/SKILL.md +1 -1
  35. package/skills/workspace-settings/SKILL.md +1 -0
  36. package/src/app/vite.d.ts +3 -2
  37. package/dist/define-lint-preset-B1Xy1brk.mjs.map +0 -1
  38. package/dist/dependencies-DbwLA4nT.mjs.map +0 -1
  39. package/dist/problem-D8mlJc3T.mjs.map +0 -1
  40. package/dist/started-once-CkTooI_o.mjs +0 -13
  41. package/dist/started-once-CkTooI_o.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"project-CR2jzkij.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","Arr","Str","Arr","Arr","Str","Bool"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/pass-records.ts","../src/entities/project/model/implementation.ts"],"sourcesContent":["import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\nexport type Value = string | number;\n\nexport interface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nexport const literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nexport const literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nexport const schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nexport const finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nexport const vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nexport const isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nexport const sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nexport const isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nexport const libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nexport const annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nexport const withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nexport const mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), {\n concurrency: 1,\n });\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (parent !== directory && !(yield* files.exists(files.join(directory, MANIFEST_FILE)))) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* Effect.forEach(\n names,\n (name) => files.realPath(files.join(directory, NODE_MODULES, name)),\n {\n concurrency: 1,\n },\n );\n});\n\nexport const workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(\n start: string,\n) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }),\n );\n return Arr.flatten(nested);\n});\n\nexport const installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* Effect.forEach(\n names,\n (name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n { concurrency: 1 },\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* Effect.forEach(\n Arr.dedupe([root, ...directories]),\n (directory) => installedPackages(root, directory),\n { concurrency: 1 },\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst PASSED = \"\";\nconst UNREADABLE = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nexport interface Records {\n readonly directory: string;\n readonly passed: readonly string[];\n}\n\nexport type NamedFile = readonly [name: string, file: string];\n\nexport const contentKey = Effect.fn(\"contentKey\")(function* contentKey(\n salt: readonly string[],\n named: readonly NamedFile[],\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* Effect.forEach(\n named,\n ([name, file]) =>\n files\n .hashFile(file)\n .pipe(\n Effect.map(\n (found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`,\n ),\n ),\n { concurrency: 1 },\n );\n return yield* files.hash(Arr.join([...salt, ...entries], LINE_SEPARATOR));\n});\n\nexport const recordsIn = Effect.fn(\"recordsIn\")(function* recordsIn(directory: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.readDirectory(directory);\n return { directory, passed: present } satisfies Records;\n});\n\nexport const keepOnly = Effect.fn(\"keepOnly\")(function* keepOnly(\n records: Records,\n keys: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const stale = pipe(\n records.passed,\n Arr.filter((key) => !Arr.contains(keys, key)),\n );\n yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {\n concurrency: 1,\n discard: true,\n });\n yield* Effect.forEach(\n keys,\n (key) => files.writeFile(files.join(records.directory, key), PASSED),\n { concurrency: 1, discard: true },\n );\n});\n","import { Array as Arr, Boolean as Bool, Effect, String as Str, pipe } from \"effect\";\n\nimport { contentKey } from \"#/shared/lib/pass-records.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { installedPackages, nearestManifestDirectory } from \"./inputs.ts\";\n\nconst MANIFEST_ENTRY = \"package.json\";\nconst SOURCE_ENTRY = \"src\";\nconst LOWER_LAYERS = [\"entities\", \"shared\"] as const;\nconst PATH_SEPARATOR = \"/\";\nconst NOT_INSTALLED: readonly string[] = [];\n\nconst walked = (directory: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* walkFrom() {\n const files = yield* RepositoryFiles;\n const found = yield* files.walkDirectory(directory);\n return pipe(\n found,\n Arr.map((file) => files.join(directory, file)),\n );\n });\n\nconst sourceFiles = Effect.fn(\"sourceFiles\")(function* sourceFiles(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const source = files.join(root, SOURCE_ENTRY);\n const layers = pipe(\n LOWER_LAYERS,\n Arr.map((layer) => files.join(source, layer)),\n );\n const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, {\n concurrency: 1,\n });\n return Arr.flatten(nested);\n});\n\nconst bundleParts = Effect.fn(\"bundleParts\")(function* bundleParts(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const bundled = yield* walked(moduleDirectory);\n return { listed: [files.join(root, MANIFEST_ENTRY), ...bundled], installed: NOT_INSTALLED };\n});\n\nconst sourceParts = Effect.fn(\"sourceParts\")(function* sourceParts(\n root: string,\n moduleDirectory: string,\n) {\n const listed = yield* sourceFiles(root, moduleDirectory);\n const installed = yield* installedPackages(root, root);\n return { listed, installed };\n});\n\n/** @internal */\nexport const implementationOf = Effect.fn(\"implementationOf\")(function* implementationOf(\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const root = yield* nearestManifestDirectory(moduleDirectory);\n const fromSource = Str.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(\n moduleDirectory,\n );\n const parts = yield* Bool.match(fromSource, {\n onFalse: () => bundleParts(root, moduleDirectory),\n onTrue: () => sourceParts(root, moduleDirectory),\n });\n return {\n files: pipe(\n Arr.sort(parts.listed, Str.Order),\n Arr.map((file) => [files.relative(root, file), file] as const),\n ),\n installed: parts.installed,\n };\n});\n\nexport const implementationFingerprint = Effect.fn(\"implementationFingerprint\")(\n function* implementationFingerprint(moduleDirectory: string) {\n const implementation = yield* implementationOf(moduleDirectory);\n return yield* contentKey(implementation.installed, implementation.files);\n },\n);\n"],"mappings":";;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CACpE;CACA,IAAI,OAAO,WAAW,MAAM,UAAU,OAAO,SAAS,kBACpD,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,KAAK,MAAM;AAC3B;AAEA,MAAa,kBAAkB,SAAgD;CAC7E,IAAI,CAAC,KAAK,YAAY,GACpB,OAAO,OAAO,KAAK;CAErB,OAAO,gBAAgB,KAAK,SAAS,CAAC;AACxC;AAEA,MAAM,iBAAiB,SAAkB,SAAoC;CAC3E,IAAI,CAAC,QAAQ,gBAAgB,IAAI,GAC/B,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,gBAAgB,QAAQ,mBAAmB,MAAM,UAAU,MAAM,CAAC;AAClF;AAEA,MAAa,gBACV,aACA,SACCA,MAAI,UAAU,yBAAyB,SACrC,OAAO,gBAAgB,QAAQ,kBAAkB,MAAM,IAAI,CAAC,CAC9D,CAAC,CAAC,KAAK,OAAO,KAAK,aAAa,QAA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AI,WAAW,GAAG,MAAM,KAAK,MAAM,YAAY,IAAI,gBAAgB,CAAC,CACrF,eACF;CACA,MAAM,QAAQ,OAAOC,QAAK,MAAM,YAAY;EAC1C,eAAe,YAAY,MAAM,eAAe;EAChD,cAAc,YAAY,MAAM,eAAe;CACjD,CAAC;CACD,OAAO;EACL,OAAO,KACLF,MAAI,KAAK,MAAM,QAAQC,SAAI,KAAK,GAChCD,MAAI,KAAK,SAAS,CAAC,MAAM,SAAS,MAAM,IAAI,GAAG,IAAI,CAAU,CAC/D;EACA,WAAW,MAAM;CACnB;AACF,CAAC;AAED,MAAa,4BAA4B,OAAO,GAAG,2BAA2B,CAAC,CAC7E,UAAU,0BAA0B,iBAAyB;CAC3D,MAAM,iBAAiB,OAAO,iBAAiB,eAAe;CAC9D,OAAO,OAAO,WAAW,eAAe,WAAW,eAAe,KAAK;AACzE,CACF"}
1
+ {"version":3,"file":"project-C4uzq7_4.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","Arr","Str","Arr","Arr","Str","Bool"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/pass-records.ts","../src/entities/project/model/implementation.ts"],"sourcesContent":["import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\nexport type Value = string | number;\n\nexport interface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nexport const literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nexport const literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nexport const schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nexport const finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nexport const vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nexport const isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nexport const sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nexport const isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nexport const libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nexport const annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nexport const withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nexport const mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), {\n concurrency: 1,\n });\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (parent !== directory && !(yield* files.exists(files.join(directory, MANIFEST_FILE)))) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* Effect.forEach(\n names,\n (name) => files.realPath(files.join(directory, NODE_MODULES, name)),\n {\n concurrency: 1,\n },\n );\n});\n\nexport const workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(\n start: string,\n) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }),\n );\n return Arr.flatten(nested);\n});\n\nexport const installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* Effect.forEach(\n names,\n (name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n { concurrency: 1 },\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* Effect.forEach(\n Arr.dedupe([root, ...directories]),\n (directory) => installedPackages(root, directory),\n { concurrency: 1 },\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst PASSED = \"\";\nconst UNREADABLE = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nexport interface Records {\n readonly directory: string;\n readonly passed: readonly string[];\n}\n\nexport type NamedFile = readonly [name: string, file: string];\n\nexport const contentKey = Effect.fn(\"contentKey\")(function* contentKey(\n salt: readonly string[],\n named: readonly NamedFile[],\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* Effect.forEach(\n named,\n ([name, file]) =>\n files\n .hashFile(file)\n .pipe(\n Effect.map(\n (found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`,\n ),\n ),\n { concurrency: 1 },\n );\n return yield* files.hash(Arr.join([...salt, ...entries], LINE_SEPARATOR));\n});\n\nexport const recordsIn = Effect.fn(\"recordsIn\")(function* recordsIn(directory: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.readDirectory(directory);\n return { directory, passed: present } satisfies Records;\n});\n\nexport const keepOnly = Effect.fn(\"keepOnly\")(function* keepOnly(\n records: Records,\n keys: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const stale = pipe(\n records.passed,\n Arr.filter((key) => !Arr.contains(keys, key)),\n );\n yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {\n concurrency: 1,\n discard: true,\n });\n yield* Effect.forEach(\n keys,\n (key) => files.writeFile(files.join(records.directory, key), PASSED),\n { concurrency: 1, discard: true },\n );\n});\n","import { Array as Arr, Boolean as Bool, Effect, String as Str, pipe } from \"effect\";\n\nimport { contentKey } from \"#/shared/lib/pass-records.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { installedPackages, nearestManifestDirectory } from \"./inputs.ts\";\n\nconst MANIFEST_ENTRY = \"package.json\";\nconst SOURCE_ENTRY = \"src\";\nconst LOWER_LAYERS = [\"entities\", \"shared\"] as const;\nconst PATH_SEPARATOR = \"/\";\nconst NOT_INSTALLED: readonly string[] = [];\n\nconst walked = (directory: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* walkFrom() {\n const files = yield* RepositoryFiles;\n const found = yield* files.walkDirectory(directory);\n return pipe(\n found,\n Arr.map((file) => files.join(directory, file)),\n );\n });\n\nconst sourceFiles = Effect.fn(\"sourceFiles\")(function* sourceFiles(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const source = files.join(root, SOURCE_ENTRY);\n const layers = pipe(\n LOWER_LAYERS,\n Arr.map((layer) => files.join(source, layer)),\n );\n const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, {\n concurrency: 1,\n });\n return Arr.flatten(nested);\n});\n\nconst bundleParts = Effect.fn(\"bundleParts\")(function* bundleParts(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const bundled = yield* walked(moduleDirectory);\n return { listed: [files.join(root, MANIFEST_ENTRY), ...bundled], installed: NOT_INSTALLED };\n});\n\nconst sourceParts = Effect.fn(\"sourceParts\")(function* sourceParts(\n root: string,\n moduleDirectory: string,\n) {\n const listed = yield* sourceFiles(root, moduleDirectory);\n const installed = yield* installedPackages(root, root);\n return { listed, installed };\n});\n\n/** @internal */\nexport const implementationOf = Effect.fn(\"implementationOf\")(function* implementationOf(\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const root = yield* nearestManifestDirectory(moduleDirectory);\n const fromSource = Str.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(\n moduleDirectory,\n );\n const parts = yield* Bool.match(fromSource, {\n onFalse: () => bundleParts(root, moduleDirectory),\n onTrue: () => sourceParts(root, moduleDirectory),\n });\n return {\n files: pipe(\n Arr.sort(parts.listed, Str.Order),\n Arr.map((file) => [files.relative(root, file), file] as const),\n ),\n installed: parts.installed,\n };\n});\n\nexport const implementationFingerprint = Effect.fn(\"implementationFingerprint\")(\n function* implementationFingerprint(moduleDirectory: string) {\n const implementation = yield* implementationOf(moduleDirectory);\n return yield* contentKey(implementation.installed, implementation.files);\n },\n);\n"],"mappings":";;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CACpE;CACA,IAAI,OAAO,WAAW,MAAM,UAAU,OAAO,SAAS,kBACpD,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,KAAK,MAAM;AAC3B;AAEA,MAAa,kBAAkB,SAAgD;CAC7E,IAAI,CAAC,KAAK,YAAY,GACpB,OAAO,OAAO,KAAK;CAErB,OAAO,gBAAgB,KAAK,SAAS,CAAC;AACxC;AAEA,MAAM,iBAAiB,SAAkB,SAAoC;CAC3E,IAAI,CAAC,QAAQ,gBAAgB,IAAI,GAC/B,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,gBAAgB,QAAQ,mBAAmB,MAAM,UAAU,MAAM,CAAC;AAClF;AAEA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mBAAmB,OAAO,GAAG,kBAAkB,CAAC,CAAC,UAAU,iBACtE,iBACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,yBAAyB,eAAe;CAC5D,MAAM,aAAaC,SAAI,WAAW,GAAG,MAAM,KAAK,MAAM,YAAY,IAAI,gBAAgB,CAAC,CACrF,eACF;CACA,MAAM,QAAQ,OAAOC,QAAK,MAAM,YAAY;EAC1C,eAAe,YAAY,MAAM,eAAe;EAChD,cAAc,YAAY,MAAM,eAAe;CACjD,CAAC;CACD,OAAO;EACL,OAAO,KACLF,MAAI,KAAK,MAAM,QAAQC,SAAI,KAAK,GAChCD,MAAI,KAAK,SAAS,CAAC,MAAM,SAAS,MAAM,IAAI,GAAG,IAAI,CAAU,CAC/D;EACA,WAAW,MAAM;CACnB;AACF,CAAC;AAED,MAAa,4BAA4B,OAAO,GAAG,2BAA2B,CAAC,CAC7E,UAAU,0BAA0B,iBAAyB;CAC3D,MAAM,iBAAiB,OAAO,iBAAiB,eAAe;CAC9D,OAAO,OAAO,WAAW,eAAe,WAAW,eAAe,KAAK;AACzE,CACF"}
@@ -0,0 +1,8 @@
1
+ // src/shared/lib/started-once.ts
2
+ const startedOnce = () => {
3
+ const started = /* @__PURE__ */ new Map();
4
+ return (key, start) => started.getOrInsertComputed(key, () => start());
5
+ };
6
+ export { startedOnce as t };
7
+
8
+ //# sourceMappingURL=started-once-muJbvD_I.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"started-once-muJbvD_I.mjs","names":[],"sources":["../src/shared/lib/started-once.ts"],"sourcesContent":["export const startedOnce = <Value>(): ((\n key: string,\n start: () => Promise<Value>,\n) => Promise<Value>) => {\n const started = new Map<string, Promise<Value>>();\n return (key, start) => started.getOrInsertComputed(key, () => start());\n};\n"],"mappings":";AAAA,MAAa,oBAGW;CACtB,MAAM,0BAAU,IAAI,IAA4B;CAChD,QAAQ,KAAK,UAAU,QAAQ,oBAAoB,WAAW,MAAM,CAAC;AACvE"}
@@ -1,2 +1,2 @@
1
- import { a as SettingsOptions, c as workspaceSettings, d as WorkspaceTasks, i as RuleSets, l as IgnoredDirectory, n as DevDependencyAllowance, o as WorkspaceLint, r as RuleSet, s as WorkspaceSettings, t as DependencySets, u as ignoredDirectories } from "./index-DdJXnW1q.mjs";
2
- export { type DependencySets, type DevDependencyAllowance, type IgnoredDirectory, type RuleSet, type RuleSets, type SettingsOptions, type WorkspaceLint, type WorkspaceSettings, type WorkspaceTasks, ignoredDirectories, workspaceSettings };
1
+ import { a as WorkspaceSettings, c as DependencySets, d as WorkspaceTasks, i as WorkspaceLint, l as IgnoredDirectory, n as RuleSets, o as workspaceSettings, r as SettingsOptions, s as DependencyAllowance, t as RuleSet, u as ignoredDirectories } from "./index-BZIBqvmt.mjs";
2
+ export { type DependencyAllowance, type DependencySets, type IgnoredDirectory, type RuleSet, type RuleSets, type SettingsOptions, type WorkspaceLint, type WorkspaceSettings, type WorkspaceTasks, ignoredDirectories, workspaceSettings };
@@ -1,8 +1,57 @@
1
- import { a as publicEntriesOf, i as EntryManifestJson, n as entriesOf, t as PackEntry } from "./package-BKpgZyaV.mjs";
2
- import { A as merged, E as definesTask, M as settingsInvalid, N as usedFrom, O as tasksOf, R as literalOf, S as NO_TASKS, d as deployEntries, g as prefixed, j as programOf, k as literalSettings, m as shadcnUiIn, r as readManifest, s as writeLockedClosures, t as MANIFEST_FILE, v as workspaceDirectories, w as TEST_TASK, z as nestedValues } from "./dependencies-DbwLA4nT.mjs";
1
+ import { a as publicEntriesOf, i as EntryManifestJson, n as entriesOf, t as PackEntry } from "./package-LeBO9czg.mjs";
2
+ import { A as merged, D as tasksOf, M as settingsInvalid, N as usedFrom, O as testsItself, R as literalOf, S as NO_TASKS, d as deployEntries, g as prefixed, j as programOf, k as literalSettings, m as shadcnUiIn, r as readManifest, s as writeLockedClosures, t as MANIFEST_FILE, v as workspaceDirectories, z as nestedValues } from "./dependencies-DCJv7YcW.mjs";
3
3
  import { r as ignoredDirectories, t as collectIgnoredDirectories } from "./ignored-directories-BTMTNuAx.mjs";
4
4
  import { n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-B5sRbxlz.mjs";
5
5
  import { Array, Effect, Option, Record, Schema, pipe } from "effect";
6
+ // src/features/build-workspace-settings/model/dependency-allowances.ts
7
+ const MSCH_DEV_DEPENDENCIES = ["msch", "devDependencies"];
8
+ const MSCH_DEPENDENCIES = ["msch", "dependencies"];
9
+ const Names$1 = Schema.optional(Schema.Array(Schema.String));
10
+ const DependencySettings = Schema.Struct({
11
+ use: Names$1,
12
+ dependencies: Names$1
13
+ });
14
+ const WorkspaceDependencyAllowances = Schema.Record(Schema.String, DependencySettings);
15
+ const allowanceOf = Effect.fn("allowanceOf")(function* allowanceOf(source, dependencySets, [reason, allowance]) {
16
+ const sets = yield* usedFrom(source.file, dependencySets, allowance.use ?? []);
17
+ const dependencies = [...Array.flatten(sets), ...allowance.dependencies ?? []];
18
+ return [`${source.directory}: ${reason}`, {
19
+ workspaces: [source.directory],
20
+ dependencies
21
+ }];
22
+ });
23
+ const allowancesOf = Effect.fn("allowancesOf")(function* allowancesOf(source, dependencySets, path) {
24
+ const settings = yield* literalSettings({
25
+ source,
26
+ path,
27
+ decode: Schema.decodeUnknownEffect(WorkspaceDependencyAllowances)
28
+ });
29
+ const allowed = Record.toEntries(Option.getOrElse(settings, () => ({})));
30
+ const entries = yield* Effect.forEach(allowed, (entry) => allowanceOf(source, dependencySets, entry), { concurrency: 1 });
31
+ return Record.fromEntries(entries);
32
+ });
33
+ // src/features/build-workspace-settings/model/test-project.ts
34
+ const TEST_ISOLATION = ["test", "isolate"];
35
+ const sharedTestProject = (manifest) => ({ directory, config }) => ({
36
+ extends: config,
37
+ root: directory,
38
+ test: {
39
+ name: pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.getOrElse(() => directory)),
40
+ isolate: false
41
+ }
42
+ });
43
+ const testProjectOf = Effect.fn("testProjectOf")(function* testProjectOf(source, config, manifest) {
44
+ const isolated = yield* literalSettings({
45
+ source,
46
+ path: TEST_ISOLATION,
47
+ decode: Schema.decodeUnknownEffect(Schema.Boolean)
48
+ });
49
+ if (Option.getOrElse(isolated, () => false)) return source.directory;
50
+ return sharedTestProject(manifest)({
51
+ directory: source.directory,
52
+ config
53
+ });
54
+ });
6
55
  // src/features/build-workspace-settings/model/workspace-public-entries.ts
7
56
  const PACK_ENTRY = ["pack", "entry"];
8
57
  const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
@@ -34,7 +83,6 @@ const CONFIG_FILE = "vite.config.ts";
34
83
  const READ_CONCURRENCY = 16;
35
84
  const ROOT_WORKSPACE = ".";
36
85
  const MSCH_LINT = ["msch", "lint"];
37
- const MSCH_DEV_DEPENDENCIES = ["msch", "devDependencies"];
38
86
  const Severity = Schema.Literals(Record.keys({
39
87
  off: true,
40
88
  allow: true,
@@ -57,11 +105,6 @@ const WorkspaceLintSettings = Schema.Struct({
57
105
  ignorePatterns: Names,
58
106
  overrides: Schema.optional(Schema.Array(WorkspaceOverride))
59
107
  });
60
- const DevDependencySettings = Schema.Struct({
61
- use: Names,
62
- dependencies: Names
63
- });
64
- const WorkspaceDevDependencies = Schema.Record(Schema.String, DevDependencySettings);
65
108
  const overrideOf = Effect.fn("overrideOf")(function* overrideOf(source, ruleSets, override) {
66
109
  const { file, directory } = source;
67
110
  const fromSets = yield* usedFrom(file, ruleSets, override.use ?? []);
@@ -92,55 +135,49 @@ const lintOf = Effect.fn("lintOf")(function* lintOf(source, ruleSets) {
92
135
  overrides
93
136
  };
94
137
  });
95
- const allowanceOf = Effect.fn("allowanceOf")(function* allowanceOf(source, dependencySets, [reason, allowance]) {
96
- const sets = yield* usedFrom(source.file, dependencySets, allowance.use ?? []);
97
- const dependencies = [...Array.flatten(sets), ...allowance.dependencies ?? []];
98
- return [`${source.directory}: ${reason}`, {
99
- workspaces: [source.directory],
100
- dependencies
101
- }];
102
- });
103
- const devDependenciesOf = Effect.fn("devDependenciesOf")(function* devDependenciesOf(source, dependencySets) {
104
- const settings = yield* literalSettings({
105
- source,
106
- path: MSCH_DEV_DEPENDENCIES,
107
- decode: Schema.decodeUnknownEffect(WorkspaceDevDependencies)
108
- });
109
- const allowed = Record.toEntries(Option.getOrElse(settings, () => ({})));
110
- const entries = yield* Effect.forEach(allowed, (entry) => allowanceOf(source, dependencySets, entry), { concurrency: 1 });
111
- return Record.fromEntries(entries);
112
- });
113
138
  const settingsOf = Effect.fn("settingsOf")(function* settingsOf(source, options) {
114
139
  const lint = yield* lintOf(source, options.ruleSets);
115
- const devDependencies = yield* devDependenciesOf(source, options.dependencySets);
116
- const ownTests = definesTask(TEST_TASK)(source.program);
140
+ const devDependencies = yield* allowancesOf(source, options.dependencySets, MSCH_DEV_DEPENDENCIES);
141
+ const dependencies = yield* allowancesOf(source, options.dependencySets, MSCH_DEPENDENCIES);
142
+ const ownTests = testsItself(source.program);
117
143
  const files = yield* RepositoryFiles;
118
144
  const manifest = yield* readManifest(files.dirname(source.file));
119
145
  const tasks = tasksOf(manifest)(source.program);
146
+ const testProject = yield* testProjectOf(source, `${source.directory}/${CONFIG_FILE}`, manifest);
120
147
  return {
121
148
  directory: source.directory,
122
149
  ...lint,
123
150
  devDependencies,
151
+ dependencies,
124
152
  ownTests,
153
+ testProject,
125
154
  tasks
126
155
  };
127
156
  });
157
+ const unconfiguredWorkspace = Effect.fn("unconfiguredWorkspace")(function* unconfiguredWorkspace(root, directory) {
158
+ const files = yield* RepositoryFiles;
159
+ const publicEntries = yield* publicEntryFiles(root, directory, Option.none());
160
+ const manifest = yield* readManifest(files.join(root, directory));
161
+ return {
162
+ directory,
163
+ ignorePatterns: [],
164
+ overrides: [],
165
+ devDependencies: {},
166
+ dependencies: {},
167
+ ownTests: false,
168
+ testProject: sharedTestProject(manifest)({
169
+ directory,
170
+ config: false
171
+ }),
172
+ tasks: NO_TASKS,
173
+ publicEntries
174
+ };
175
+ });
128
176
  const workspaceIn = Effect.fn("workspaceIn")(function* workspaceIn(options, directory) {
129
177
  const files = yield* RepositoryFiles;
130
178
  const file = files.join(options.root, directory, CONFIG_FILE);
131
179
  const text = yield* files.readFile(file);
132
- if (Option.isNone(text)) {
133
- const publicEntries = yield* publicEntryFiles(options.root, directory, Option.none());
134
- return {
135
- directory,
136
- ignorePatterns: [],
137
- overrides: [],
138
- devDependencies: {},
139
- ownTests: false,
140
- tasks: NO_TASKS,
141
- publicEntries
142
- };
143
- }
180
+ if (Option.isNone(text)) return yield* unconfiguredWorkspace(options.root, directory);
144
181
  const program = yield* programOf(file, text.value);
145
182
  const settings = yield* settingsOf({
146
183
  file,
@@ -157,6 +194,10 @@ const mergedTasks = (found) => ({
157
194
  verify: pipe(found, Array.flatMap(({ tasks }) => tasks.verify)),
158
195
  native: pipe(found, Array.flatMap(({ tasks }) => tasks.native))
159
196
  });
197
+ const mergedAllowances = (found) => ({
198
+ devDependencies: merged(pipe(found, Array.map(({ devDependencies }) => devDependencies))),
199
+ dependencies: merged(pipe(found, Array.map(({ dependencies }) => dependencies)))
200
+ });
160
201
  const collectWorkspaceSettings = Effect.fn("collectWorkspaceSettings")(function* collectWorkspaceSettings(options) {
161
202
  yield* Effect.ignore(writeLockedClosures(options.root));
162
203
  const directories = yield* workspaceDirectories(options.root);
@@ -172,9 +213,9 @@ const collectWorkspaceSettings = Effect.fn("collectWorkspaceSettings")(function*
172
213
  publicEntries: pipe(found, Array.flatMap(({ publicEntries }) => publicEntries)),
173
214
  deployEntries: yield* deployEntries(options.root)
174
215
  },
175
- testProjects: pipe(found, Array.filter(({ ownTests }) => !ownTests), Array.map(({ directory }) => directory)),
216
+ testProjects: pipe(found, Array.filter(({ ownTests }) => !ownTests), Array.map(({ testProject }) => testProject)),
176
217
  tasks: mergedTasks(found),
177
- devDependencies: merged(pipe(found, Array.map(({ devDependencies }) => devDependencies)))
218
+ ...mergedAllowances(found)
178
219
  };
179
220
  });
180
221
  const workspaceSettings = (options) => Effect.runPromise(collectWorkspaceSettings(options).pipe(Effect.provide(nodeRepositoryFiles)));
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-settings.mjs","names":["Arr","Rec","Arr"],"sources":["../src/features/build-workspace-settings/model/workspace-public-entries.ts","../src/features/build-workspace-settings/model/workspace-settings.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n EntryManifestJson,\n entriesOf,\n PackEntry,\n publicEntriesOf,\n} from \"#/entities/package/index.ts\";\nimport type { EntryManifest, PackEntrySource } from \"#/entities/package/index.ts\";\nimport { literalOf, nestedValues } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst PACK_ENTRY = [\"pack\", \"entry\"] as const;\n\nconst decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);\nconst decodePackEntry = Schema.decodeUnknownOption(PackEntry);\n\nconst packEntriesIn = (program: unknown): readonly PackEntrySource[] =>\n pipe(\n nestedValues(PACK_ENTRY)(program),\n Arr.flatMap((node) =>\n pipe(\n literalOf(node),\n Option.flatMap(decodePackEntry),\n Option.toArray,\n Arr.flatMap(entriesOf),\n ),\n ),\n );\n\ninterface EntryFilesRequest {\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst entryFilesOf =\n ({ join, packEntries }: EntryFilesRequest) =>\n (manifest: EntryManifest): readonly string[] => {\n const joined = pipe(\n packEntries,\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n );\n return pipe(\n publicEntriesOf({ manifest, join, packEntries: joined }),\n Arr.map(({ source }) => source),\n Arr.dedupe,\n );\n };\n\nexport const publicEntryFiles = Effect.fn(\"publicEntryFiles\")(function* publicEntryFiles(\n root: string,\n directory: string,\n config: Option.Option<unknown>,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const packEntries = pipe(\n config,\n Option.map(packEntriesIn),\n Option.getOrElse(() => []),\n );\n const join = (target: string): string => files.join(directory, target);\n return pipe(\n text,\n Option.flatMap(decodeEntryManifest),\n Option.map(entryFilesOf({ join, packEntries })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport type { AllowWarnDeny, OxlintOverride } from \"vite-plus/lint\";\n\nimport { readManifest } from \"#/entities/package/index.ts\";\nimport {\n deployEntries,\n literalSettings,\n merged,\n programOf,\n settingsInvalid,\n usedFrom,\n workspaceDirectories,\n writeLockedClosures,\n prefixed,\n shadcnUiIn,\n NO_TASKS,\n TEST_TASK,\n definesTask,\n tasksOf,\n} from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSource, WorkspaceTasks } from \"#/entities/workspace/index.ts\";\nimport { collectIgnoredDirectories } from \"#/shared/lib/ignored-directories.ts\";\nimport type { IgnoredDirectory } from \"#/shared/lib/ignored-directories.ts\";\nimport { RepositoryFiles, nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { publicEntryFiles } from \"./workspace-public-entries.ts\";\n\nexport type RuleSet = Readonly<Record<string, unknown>>;\nexport type RuleSets = Readonly<Record<string, RuleSet>>;\nexport type DependencySets = Readonly<Record<string, readonly string[]>>;\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst READ_CONCURRENCY = 16;\nconst ROOT_WORKSPACE = \".\";\nconst MSCH_LINT = [\"msch\", \"lint\"] as const;\nconst MSCH_DEV_DEPENDENCIES = [\"msch\", \"devDependencies\"] as const;\n\ntype SeverityName = Extract<AllowWarnDeny, string>;\n\nconst SEVERITY_NAMES: Readonly<Record<SeverityName, true>> = {\n off: true,\n allow: true,\n warn: true,\n error: true,\n deny: true,\n};\nconst Severity = Schema.Literals<readonly SeverityName[]>(Rec.keys(SEVERITY_NAMES));\nconst SeverityWithOptions = Schema.mutable(\n Schema.TupleWithRest(Schema.Tuple([Severity]), [Schema.Unknown]),\n);\nconst RuleSetting = Schema.Union([Severity, SeverityWithOptions]);\nconst Rules = Schema.Record(Schema.String, RuleSetting);\nconst decodeRules = Schema.decodeUnknownEffect(Rules);\nconst Names = Schema.optional(Schema.Array(Schema.String));\nconst WorkspaceOverride = Schema.Struct({\n files: Schema.Array(Schema.String),\n excludeFiles: Names,\n rules: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n use: Names,\n});\nconst WorkspaceLintSettings = Schema.Struct({\n ignorePatterns: Names,\n overrides: Schema.optional(Schema.Array(WorkspaceOverride)),\n});\nconst DevDependencySettings = Schema.Struct({ use: Names, dependencies: Names });\nconst WorkspaceDevDependencies = Schema.Record(Schema.String, DevDependencySettings);\n\nexport interface DevDependencyAllowance {\n readonly workspaces: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nexport interface WorkspaceLint {\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly shadcnUi: readonly string[];\n readonly publicEntries: readonly string[];\n readonly deployEntries: readonly string[];\n}\n\nexport interface WorkspaceSettings {\n readonly lint: WorkspaceLint;\n readonly members: readonly string[];\n readonly ignoredDirectories: readonly IgnoredDirectory[];\n readonly testProjects: readonly string[];\n readonly tasks: WorkspaceTasks;\n readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;\n}\n\nexport interface SettingsOptions {\n readonly root: string;\n readonly ruleSets: RuleSets;\n readonly dependencySets: DependencySets;\n}\n\ninterface Workspace {\n readonly directory: string;\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;\n readonly ownTests: boolean;\n readonly tasks: WorkspaceTasks;\n readonly publicEntries: readonly string[];\n}\n\nconst overrideOf = Effect.fn(\"overrideOf\")(function* overrideOf(\n source: WorkspaceSource,\n ruleSets: RuleSets,\n override: typeof WorkspaceOverride.Type,\n) {\n const { file, directory } = source;\n const fromSets = yield* usedFrom(file, ruleSets, override.use ?? []);\n const rules = yield* decodeRules(merged([...fromSets, override.rules ?? {}])).pipe(\n Effect.mapError((error) => settingsInvalid(file)(error.message)),\n );\n const files = pipe(override.files, Arr.map(prefixed(directory)));\n return pipe(\n Option.fromUndefinedOr(override.excludeFiles),\n Option.match({\n onNone: (): OxlintOverride => ({ files, rules }),\n onSome: (excluded): OxlintOverride => ({\n files,\n excludeFiles: pipe(excluded, Arr.map(prefixed(directory))),\n rules,\n }),\n }),\n );\n});\n\nconst lintOf = Effect.fn(\"lintOf\")(function* lintOf(source: WorkspaceSource, ruleSets: RuleSets) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_LINT,\n decode: Schema.decodeUnknownEffect(WorkspaceLintSettings),\n });\n const lint = Option.getOrElse(settings, (): typeof WorkspaceLintSettings.Type => ({}));\n const overrides = yield* Effect.forEach(\n lint.overrides ?? [],\n (override) => overrideOf(source, ruleSets, override),\n { concurrency: 1 },\n );\n const ignorePatterns = pipe(lint.ignorePatterns ?? [], Arr.map(prefixed(source.directory)));\n return { ignorePatterns, overrides };\n});\n\nconst allowanceOf = Effect.fn(\"allowanceOf\")(function* allowanceOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n [reason, allowance]: readonly [string, typeof DevDependencySettings.Type],\n) {\n const sets = yield* usedFrom(source.file, dependencySets, allowance.use ?? []);\n const dependencies = [...Arr.flatten(sets), ...(allowance.dependencies ?? [])];\n return [\n `${source.directory}: ${reason}`,\n { workspaces: [source.directory], dependencies },\n ] as const;\n});\n\nconst devDependenciesOf = Effect.fn(\"devDependenciesOf\")(function* devDependenciesOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_DEV_DEPENDENCIES,\n decode: Schema.decodeUnknownEffect(WorkspaceDevDependencies),\n });\n const allowed = Rec.toEntries(Option.getOrElse(settings, () => ({})));\n const entries = yield* Effect.forEach(\n allowed,\n (entry) => allowanceOf(source, dependencySets, entry),\n {\n concurrency: 1,\n },\n );\n return Rec.fromEntries(entries);\n});\n\nconst settingsOf = Effect.fn(\"settingsOf\")(function* settingsOf(\n source: WorkspaceSource,\n options: SettingsOptions,\n) {\n const lint = yield* lintOf(source, options.ruleSets);\n const devDependencies = yield* devDependenciesOf(source, options.dependencySets);\n const ownTests = definesTask(TEST_TASK)(source.program);\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(files.dirname(source.file));\n const tasks = tasksOf(manifest)(source.program);\n return { directory: source.directory, ...lint, devDependencies, ownTests, tasks };\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(\n options: SettingsOptions,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(options.root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.none());\n return {\n directory,\n ignorePatterns: [],\n overrides: [],\n devDependencies: {},\n ownTests: false,\n tasks: NO_TASKS,\n publicEntries,\n };\n }\n const program = yield* programOf(file, text.value);\n const settings = yield* settingsOf({ file, directory, program }, options);\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.some(program));\n return { ...settings, publicEntries };\n});\n\nconst mergedTasks = (found: readonly { readonly tasks: WorkspaceTasks }[]): WorkspaceTasks => ({\n verify: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.verify),\n ),\n native: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.native),\n ),\n});\n\nconst collectWorkspaceSettings = Effect.fn(\"collectWorkspaceSettings\")(\n function* collectWorkspaceSettings(options: SettingsOptions) {\n yield* Effect.ignore(writeLockedClosures(options.root));\n const directories = yield* workspaceDirectories(options.root);\n const found: readonly Workspace[] = yield* Effect.forEach(\n directories,\n (directory) => workspaceIn(options, directory),\n { concurrency: READ_CONCURRENCY },\n );\n const shadcnUi = yield* Effect.forEach(\n directories,\n (directory) => shadcnUiIn(options.root, directory),\n { concurrency: READ_CONCURRENCY },\n );\n return {\n members: pipe(\n directories,\n Arr.filter((directory) => directory !== ROOT_WORKSPACE),\n ),\n ignoredDirectories: yield* collectIgnoredDirectories(options.root),\n lint: {\n ignorePatterns: pipe(\n found,\n Arr.flatMap(({ ignorePatterns }) => ignorePatterns),\n ),\n overrides: pipe(\n found,\n Arr.flatMap(({ overrides }) => overrides),\n ),\n shadcnUi: Arr.getSomes(shadcnUi),\n publicEntries: pipe(\n found,\n Arr.flatMap(({ publicEntries }) => publicEntries),\n ),\n deployEntries: yield* deployEntries(options.root),\n },\n testProjects: pipe(\n found,\n Arr.filter(({ ownTests }) => !ownTests),\n Arr.map(({ directory }) => directory),\n ),\n tasks: mergedTasks(found),\n devDependencies: merged(\n pipe(\n found,\n Arr.map(({ devDependencies }) => devDependencies),\n ),\n ),\n };\n },\n);\n\nexport const workspaceSettings = (options: SettingsOptions): Promise<WorkspaceSettings> =>\n Effect.runPromise(collectWorkspaceSettings(options).pipe(Effect.provide(nodeRepositoryFiles)));\n\nexport type { WorkspaceTasks } from \"#/entities/workspace/index.ts\";\n"],"mappings":";;;;;;AAaA,MAAM,aAAa,CAAC,QAAQ,OAAO;AAEnC,MAAM,sBAAsB,OAAO,oBAAoB,iBAAiB;AACxE,MAAM,kBAAkB,OAAO,oBAAoB,SAAS;AAE5D,MAAM,iBAAiB,YACrB,KACE,aAAa,UAAU,CAAC,CAAC,OAAO,GAChCA,MAAI,SAAS,SACX,KACE,UAAU,IAAI,GACd,OAAO,QAAQ,eAAe,GAC9B,OAAO,SACPA,MAAI,QAAQ,SAAS,CACvB,CACF,CACF;AAOF,MAAM,gBACH,EAAE,MAAM,mBACR,aAA+C;CAC9C,MAAM,SAAS,KACb,aACAA,MAAI,KAAK,WAAW;EAAE,MAAM,MAAM;EAAM,QAAQ,KAAK,MAAM,MAAM;CAAE,EAAE,CACvE;CACA,OAAO,KACL,gBAAgB;EAAE;EAAU;EAAM,aAAa;CAAO,CAAC,GACvDA,MAAI,KAAK,EAAE,aAAa,MAAM,GAC9BA,MAAI,MACN;AACF;AAEF,MAAa,mBAAmB,OAAO,GAAG,kBAAkB,CAAC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KACP,aACAA,MAAI,QAAQ,cAAc,cAAc,cAAc,CACxD;EACA,oBAAoB,OAAO,0BAA0B,QAAQ,IAAI;EACjE,MAAM;GACJ,gBAAgB,KACd,OACAA,MAAI,SAAS,EAAE,qBAAqB,cAAc,CACpD;GACA,WAAW,KACT,OACAA,MAAI,SAAS,EAAE,gBAAgB,SAAS,CAC1C;GACA,UAAUA,MAAI,SAAS,QAAQ;GAC/B,eAAe,KACb,OACAA,MAAI,SAAS,EAAE,oBAAoB,aAAa,CAClD;GACA,eAAe,OAAO,cAAc,QAAQ,IAAI;EAClD;EACA,cAAc,KACZ,OACAA,MAAI,QAAQ,EAAE,eAAe,CAAC,QAAQ,GACtCA,MAAI,KAAK,EAAE,gBAAgB,SAAS,CACtC;EACA,OAAO,YAAY,KAAK;EACxB,iBAAiB,OACf,KACE,OACAA,MAAI,KAAK,EAAE,sBAAsB,eAAe,CAClD,CACF;CACF;AACF,CACF;AAEA,MAAa,qBAAqB,YAChC,OAAO,WAAW,yBAAyB,OAAO,CAAC,CAAC,KAAK,OAAO,QAAQ,mBAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"workspace-settings.mjs","names":["Names","Arr","Rec","Arr","Rec","Arr"],"sources":["../src/features/build-workspace-settings/model/dependency-allowances.ts","../src/features/build-workspace-settings/model/test-project.ts","../src/features/build-workspace-settings/model/workspace-public-entries.ts","../src/features/build-workspace-settings/model/workspace-settings.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Record as Rec, Schema } from \"effect\";\n\nimport { literalSettings, usedFrom } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSource } from \"#/entities/workspace/index.ts\";\n\nexport type DependencySets = Readonly<Record<string, readonly string[]>>;\n\nexport interface DependencyAllowance {\n readonly workspaces: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nexport type DependencyAllowances = Readonly<Record<string, DependencyAllowance>>;\n\nexport const MSCH_DEV_DEPENDENCIES = [\"msch\", \"devDependencies\"] as const;\nexport const MSCH_DEPENDENCIES = [\"msch\", \"dependencies\"] as const;\n\nconst Names = Schema.optional(Schema.Array(Schema.String));\nconst DependencySettings = Schema.Struct({ use: Names, dependencies: Names });\nconst WorkspaceDependencyAllowances = Schema.Record(Schema.String, DependencySettings);\n\nconst allowanceOf = Effect.fn(\"allowanceOf\")(function* allowanceOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n [reason, allowance]: readonly [string, typeof DependencySettings.Type],\n) {\n const sets = yield* usedFrom(source.file, dependencySets, allowance.use ?? []);\n const dependencies = [...Arr.flatten(sets), ...(allowance.dependencies ?? [])];\n return [\n `${source.directory}: ${reason}`,\n { workspaces: [source.directory], dependencies },\n ] as const;\n});\n\nexport const allowancesOf = Effect.fn(\"allowancesOf\")(function* allowancesOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n path: typeof MSCH_DEV_DEPENDENCIES | typeof MSCH_DEPENDENCIES,\n) {\n const settings = yield* literalSettings({\n source,\n path,\n decode: Schema.decodeUnknownEffect(WorkspaceDependencyAllowances),\n });\n const allowed = Rec.toEntries(Option.getOrElse(settings, () => ({})));\n const entries = yield* Effect.forEach(\n allowed,\n (entry) => allowanceOf(source, dependencySets, entry),\n { concurrency: 1 },\n );\n return Rec.fromEntries(entries);\n});\n","import { Effect, Option, Schema, pipe } from \"effect\";\n\nimport type { Manifest } from \"#/entities/package/index.ts\";\nimport { literalSettings } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSource } from \"#/entities/workspace/index.ts\";\n\nconst TEST_ISOLATION = [\"test\", \"isolate\"] as const;\n\nexport interface SharedTestProject {\n readonly extends: string | false;\n readonly root: string;\n readonly test: { readonly name: string; readonly isolate: false };\n}\n\nexport type TestProject = string | SharedTestProject;\n\nexport interface ProjectPlace {\n readonly directory: string;\n readonly config: string | false;\n}\n\nexport const sharedTestProject =\n (manifest: Option.Option<Manifest>) =>\n ({ directory, config }: ProjectPlace): TestProject => ({\n extends: config,\n root: directory,\n test: {\n name: pipe(\n manifest,\n Option.flatMap(({ name }) => Option.fromUndefinedOr(name)),\n Option.getOrElse(() => directory),\n ),\n isolate: false,\n },\n });\n\nexport const testProjectOf = Effect.fn(\"testProjectOf\")(function* testProjectOf(\n source: WorkspaceSource,\n config: string,\n manifest: Option.Option<Manifest>,\n) {\n const isolated = yield* literalSettings({\n source,\n path: TEST_ISOLATION,\n decode: Schema.decodeUnknownEffect(Schema.Boolean),\n });\n if (Option.getOrElse(isolated, () => false)) {\n return source.directory;\n }\n return sharedTestProject(manifest)({ directory: source.directory, config });\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n EntryManifestJson,\n entriesOf,\n PackEntry,\n publicEntriesOf,\n} from \"#/entities/package/index.ts\";\nimport type { EntryManifest, PackEntrySource } from \"#/entities/package/index.ts\";\nimport { literalOf, nestedValues } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst PACK_ENTRY = [\"pack\", \"entry\"] as const;\n\nconst decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);\nconst decodePackEntry = Schema.decodeUnknownOption(PackEntry);\n\nconst packEntriesIn = (program: unknown): readonly PackEntrySource[] =>\n pipe(\n nestedValues(PACK_ENTRY)(program),\n Arr.flatMap((node) =>\n pipe(\n literalOf(node),\n Option.flatMap(decodePackEntry),\n Option.toArray,\n Arr.flatMap(entriesOf),\n ),\n ),\n );\n\ninterface EntryFilesRequest {\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst entryFilesOf =\n ({ join, packEntries }: EntryFilesRequest) =>\n (manifest: EntryManifest): readonly string[] => {\n const joined = pipe(\n packEntries,\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n );\n return pipe(\n publicEntriesOf({ manifest, join, packEntries: joined }),\n Arr.map(({ source }) => source),\n Arr.dedupe,\n );\n };\n\nexport const publicEntryFiles = Effect.fn(\"publicEntryFiles\")(function* publicEntryFiles(\n root: string,\n directory: string,\n config: Option.Option<unknown>,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const packEntries = pipe(\n config,\n Option.map(packEntriesIn),\n Option.getOrElse(() => []),\n );\n const join = (target: string): string => files.join(directory, target);\n return pipe(\n text,\n Option.flatMap(decodeEntryManifest),\n Option.map(entryFilesOf({ join, packEntries })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport type { AllowWarnDeny, OxlintOverride } from \"vite-plus/lint\";\n\nimport { readManifest } from \"#/entities/package/index.ts\";\nimport {\n deployEntries,\n literalSettings,\n merged,\n programOf,\n settingsInvalid,\n usedFrom,\n workspaceDirectories,\n writeLockedClosures,\n prefixed,\n shadcnUiIn,\n NO_TASKS,\n tasksOf,\n testsItself,\n} from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSource, WorkspaceTasks } from \"#/entities/workspace/index.ts\";\nimport { collectIgnoredDirectories } from \"#/shared/lib/ignored-directories.ts\";\nimport type { IgnoredDirectory } from \"#/shared/lib/ignored-directories.ts\";\nimport { RepositoryFiles, nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MSCH_DEPENDENCIES, MSCH_DEV_DEPENDENCIES, allowancesOf } from \"./dependency-allowances.ts\";\nimport type { DependencyAllowances, DependencySets } from \"./dependency-allowances.ts\";\nimport { sharedTestProject, testProjectOf } from \"./test-project.ts\";\nimport type { TestProject } from \"./test-project.ts\";\nimport { publicEntryFiles } from \"./workspace-public-entries.ts\";\n\nexport type RuleSet = Readonly<Record<string, unknown>>;\nexport type RuleSets = Readonly<Record<string, RuleSet>>;\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst READ_CONCURRENCY = 16;\nconst ROOT_WORKSPACE = \".\";\nconst MSCH_LINT = [\"msch\", \"lint\"] as const;\n\ntype SeverityName = Extract<AllowWarnDeny, string>;\n\nconst SEVERITY_NAMES: Readonly<Record<SeverityName, true>> = {\n off: true,\n allow: true,\n warn: true,\n error: true,\n deny: true,\n};\nconst Severity = Schema.Literals<readonly SeverityName[]>(Rec.keys(SEVERITY_NAMES));\nconst SeverityWithOptions = Schema.mutable(\n Schema.TupleWithRest(Schema.Tuple([Severity]), [Schema.Unknown]),\n);\nconst RuleSetting = Schema.Union([Severity, SeverityWithOptions]);\nconst Rules = Schema.Record(Schema.String, RuleSetting);\nconst decodeRules = Schema.decodeUnknownEffect(Rules);\nconst Names = Schema.optional(Schema.Array(Schema.String));\nconst WorkspaceOverride = Schema.Struct({\n files: Schema.Array(Schema.String),\n excludeFiles: Names,\n rules: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n use: Names,\n});\nconst WorkspaceLintSettings = Schema.Struct({\n ignorePatterns: Names,\n overrides: Schema.optional(Schema.Array(WorkspaceOverride)),\n});\n\nexport interface WorkspaceLint {\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly shadcnUi: readonly string[];\n readonly publicEntries: readonly string[];\n readonly deployEntries: readonly string[];\n}\n\nexport interface WorkspaceSettings {\n readonly lint: WorkspaceLint;\n readonly members: readonly string[];\n readonly ignoredDirectories: readonly IgnoredDirectory[];\n readonly testProjects: readonly TestProject[];\n readonly tasks: WorkspaceTasks;\n readonly devDependencies: DependencyAllowances;\n readonly dependencies: DependencyAllowances;\n}\n\nexport interface SettingsOptions {\n readonly root: string;\n readonly ruleSets: RuleSets;\n readonly dependencySets: DependencySets;\n}\n\ninterface Workspace {\n readonly directory: string;\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly devDependencies: DependencyAllowances;\n readonly dependencies: DependencyAllowances;\n readonly ownTests: boolean;\n readonly testProject: TestProject;\n readonly tasks: WorkspaceTasks;\n readonly publicEntries: readonly string[];\n}\n\nconst overrideOf = Effect.fn(\"overrideOf\")(function* overrideOf(\n source: WorkspaceSource,\n ruleSets: RuleSets,\n override: typeof WorkspaceOverride.Type,\n) {\n const { file, directory } = source;\n const fromSets = yield* usedFrom(file, ruleSets, override.use ?? []);\n const rules = yield* decodeRules(merged([...fromSets, override.rules ?? {}])).pipe(\n Effect.mapError((error) => settingsInvalid(file)(error.message)),\n );\n const files = pipe(override.files, Arr.map(prefixed(directory)));\n return pipe(\n Option.fromUndefinedOr(override.excludeFiles),\n Option.match({\n onNone: (): OxlintOverride => ({ files, rules }),\n onSome: (excluded): OxlintOverride => ({\n files,\n excludeFiles: pipe(excluded, Arr.map(prefixed(directory))),\n rules,\n }),\n }),\n );\n});\n\nconst lintOf = Effect.fn(\"lintOf\")(function* lintOf(source: WorkspaceSource, ruleSets: RuleSets) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_LINT,\n decode: Schema.decodeUnknownEffect(WorkspaceLintSettings),\n });\n const lint = Option.getOrElse(settings, (): typeof WorkspaceLintSettings.Type => ({}));\n const overrides = yield* Effect.forEach(\n lint.overrides ?? [],\n (override) => overrideOf(source, ruleSets, override),\n { concurrency: 1 },\n );\n const ignorePatterns = pipe(lint.ignorePatterns ?? [], Arr.map(prefixed(source.directory)));\n return { ignorePatterns, overrides };\n});\n\nconst settingsOf = Effect.fn(\"settingsOf\")(function* settingsOf(\n source: WorkspaceSource,\n options: SettingsOptions,\n) {\n const lint = yield* lintOf(source, options.ruleSets);\n const devDependencies = yield* allowancesOf(\n source,\n options.dependencySets,\n MSCH_DEV_DEPENDENCIES,\n );\n const dependencies = yield* allowancesOf(source, options.dependencySets, MSCH_DEPENDENCIES);\n const ownTests = testsItself(source.program);\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(files.dirname(source.file));\n const tasks = tasksOf(manifest)(source.program);\n const testProject = yield* testProjectOf(source, `${source.directory}/${CONFIG_FILE}`, manifest);\n return {\n directory: source.directory,\n ...lint,\n devDependencies,\n dependencies,\n ownTests,\n testProject,\n tasks,\n };\n});\n\nconst unconfiguredWorkspace = Effect.fn(\"unconfiguredWorkspace\")(function* unconfiguredWorkspace(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const publicEntries = yield* publicEntryFiles(root, directory, Option.none());\n const manifest = yield* readManifest(files.join(root, directory));\n return {\n directory,\n ignorePatterns: [],\n overrides: [],\n devDependencies: {},\n dependencies: {},\n ownTests: false,\n testProject: sharedTestProject(manifest)({ directory, config: false }),\n tasks: NO_TASKS,\n publicEntries,\n };\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(\n options: SettingsOptions,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(options.root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return yield* unconfiguredWorkspace(options.root, directory);\n }\n const program = yield* programOf(file, text.value);\n const settings = yield* settingsOf({ file, directory, program }, options);\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.some(program));\n return { ...settings, publicEntries };\n});\n\nconst mergedTasks = (found: readonly { readonly tasks: WorkspaceTasks }[]): WorkspaceTasks => ({\n verify: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.verify),\n ),\n native: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.native),\n ),\n});\n\nconst mergedAllowances = (\n found: readonly Workspace[],\n): Pick<Workspace, \"devDependencies\" | \"dependencies\"> => ({\n devDependencies: merged(\n pipe(\n found,\n Arr.map(({ devDependencies }) => devDependencies),\n ),\n ),\n dependencies: merged(\n pipe(\n found,\n Arr.map(({ dependencies }) => dependencies),\n ),\n ),\n});\n\nconst collectWorkspaceSettings = Effect.fn(\"collectWorkspaceSettings\")(\n function* collectWorkspaceSettings(options: SettingsOptions) {\n yield* Effect.ignore(writeLockedClosures(options.root));\n const directories = yield* workspaceDirectories(options.root);\n const found: readonly Workspace[] = yield* Effect.forEach(\n directories,\n (directory) => workspaceIn(options, directory),\n { concurrency: READ_CONCURRENCY },\n );\n const shadcnUi = yield* Effect.forEach(\n directories,\n (directory) => shadcnUiIn(options.root, directory),\n { concurrency: READ_CONCURRENCY },\n );\n return {\n members: pipe(\n directories,\n Arr.filter((directory) => directory !== ROOT_WORKSPACE),\n ),\n ignoredDirectories: yield* collectIgnoredDirectories(options.root),\n lint: {\n ignorePatterns: pipe(\n found,\n Arr.flatMap(({ ignorePatterns }) => ignorePatterns),\n ),\n overrides: pipe(\n found,\n Arr.flatMap(({ overrides }) => overrides),\n ),\n shadcnUi: Arr.getSomes(shadcnUi),\n publicEntries: pipe(\n found,\n Arr.flatMap(({ publicEntries }) => publicEntries),\n ),\n deployEntries: yield* deployEntries(options.root),\n },\n testProjects: pipe(\n found,\n Arr.filter(({ ownTests }) => !ownTests),\n Arr.map(({ testProject }) => testProject),\n ),\n tasks: mergedTasks(found),\n ...mergedAllowances(found),\n };\n },\n);\n\nexport const workspaceSettings = (options: SettingsOptions): Promise<WorkspaceSettings> =>\n Effect.runPromise(collectWorkspaceSettings(options).pipe(Effect.provide(nodeRepositoryFiles)));\n\nexport type { WorkspaceTasks } from \"#/entities/workspace/index.ts\";\n"],"mappings":";;;;;;AAcA,MAAa,wBAAwB,CAAC,QAAQ,iBAAiB;AAC/D,MAAa,oBAAoB,CAAC,QAAQ,cAAc;AAExD,MAAMA,UAAQ,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;AACzD,MAAM,qBAAqB,OAAO,OAAO;CAAE,KAAKA;CAAO,cAAcA;AAAM,CAAC;AAC5E,MAAM,gCAAgC,OAAO,OAAO,OAAO,QAAQ,kBAAkB;AAErF,MAAM,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YACrD,QACA,gBACA,CAAC,QAAQ,YACT;CACA,MAAM,OAAO,OAAO,SAAS,OAAO,MAAM,gBAAgB,UAAU,OAAO,CAAC,CAAC;CAC7E,MAAM,eAAe,CAAC,GAAGC,MAAI,QAAQ,IAAI,GAAG,GAAI,UAAU,gBAAgB,CAAC,CAAE;CAC7E,OAAO,CACL,GAAG,OAAO,UAAU,IAAI,UACxB;EAAE,YA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W,QAAQ,MAAM,SAAS,GACjD,EAAE,aAAa,iBAAiB,CAClC;CACA,OAAO;EACL,SAAS,KACP,aACAA,MAAI,QAAQ,cAAc,cAAc,cAAc,CACxD;EACA,oBAAoB,OAAO,0BAA0B,QAAQ,IAAI;EACjE,MAAM;GACJ,gBAAgB,KACd,OACAA,MAAI,SAAS,EAAE,qBAAqB,cAAc,CACpD;GACA,WAAW,KACT,OACAA,MAAI,SAAS,EAAE,gBAAgB,SAAS,CAC1C;GACA,UAAUA,MAAI,SAAS,QAAQ;GAC/B,eAAe,KACb,OACAA,MAAI,SAAS,EAAE,oBAAoB,aAAa,CAClD;GACA,eAAe,OAAO,cAAc,QAAQ,IAAI;EAClD;EACA,cAAc,KACZ,OACAA,MAAI,QAAQ,EAAE,eAAe,CAAC,QAAQ,GACtCA,MAAI,KAAK,EAAE,kBAAkB,WAAW,CAC1C;EACA,OAAO,YAAY,KAAK;EACxB,GAAG,iBAAiB,KAAK;CAC3B;AACF,CACF;AAEA,MAAa,qBAAqB,YAChC,OAAO,WAAW,yBAAyB,OAAO,CAAC,CAAC,KAAK,OAAO,QAAQ,mBAAmB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/msch",
3
- "version": "0.50.0",
3
+ "version": "0.53.0",
4
4
  "description": "masseater's check policy: points every finite value set and object shape at its one owner, and ships the oxlint preset of plugins and rules.",
5
5
  "keywords": [
6
6
  "lint",
@@ -112,6 +112,7 @@
112
112
  "eslint-plugin-no-comments": "^1.2.1",
113
113
  "eslint-plugin-react-hooks": "^7.1.1",
114
114
  "htmlparser2": "^12.0.0",
115
+ "modern-web-guidance": "^1.0.1",
115
116
  "oxlint-plugin-eslint": "^1.94.0",
116
117
  "semver": "^7.8.6",
117
118
  "sql-parser-cst": "^0.44.1",
@@ -128,6 +129,7 @@
128
129
  "@types/node": "26.6.6",
129
130
  "@types/semver": "7.8.0",
130
131
  "effect": "4.1.4",
132
+ "oxlint": "1.94.0",
131
133
  "typescript": "7.1.0-beta",
132
134
  "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
133
135
  "vite-plus": "1.7.0",
@@ -24,7 +24,7 @@ Run `vp exec msch` at the repository root. It takes no subcommand, checks the wh
24
24
 
25
25
  msch also runs every vite-plus-adopt check that the root `vite.config.ts` configures.
26
26
  Those include h56m, commitlint and textlint.
27
- Steiger, the dependency rules and fallow run as well.
27
+ Steiger, the dependency rules, fallow and the `legacy-scan` of modern-web-guidance run as well.
28
28
  They read `VPA_BASE` (default `origin/main`) and other environment variables.
29
29
  A task that runs msch therefore sets `cache: false`.
30
30
 
@@ -50,6 +50,7 @@ export default defineConfig({
50
50
  | `lint.ignorePatterns` | Paths in the workspace that oxlint skips |
51
51
  | `lint.overrides` | Oxlint overrides. `use` names a rule set the root passes to `workspaceSettings` |
52
52
  | `devDependencies` | Each key states why the workspace needs the packages. `dependencies` lists them, `use` names a dependency set from the root |
53
+ | `dependencies` | The same for packages the workspace ships at run time, for a banned package with no other way to do the job |
53
54
  | `publish.installSize` | The largest install size a published package may reach |
54
55
 
55
56
  ## Test and build tasks
package/src/app/vite.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface WorkspaceLintSettings {
24
24
  readonly overrides?: readonly WorkspaceLintOverride[];
25
25
  }
26
26
 
27
- export interface DevDependencyAllowance {
27
+ export interface DependencyAllowance {
28
28
  readonly use?: readonly string[];
29
29
  readonly dependencies?: readonly string[];
30
30
  }
@@ -37,7 +37,8 @@ export interface MschConfig {
37
37
  readonly comments?: CommentSettings;
38
38
  readonly publish?: PublishSettings;
39
39
  readonly lint?: WorkspaceLintSettings;
40
- readonly devDependencies?: Readonly<Record<string, DevDependencyAllowance>>;
40
+ readonly devDependencies?: Readonly<Record<string, DependencyAllowance>>;
41
+ readonly dependencies?: Readonly<Record<string, DependencyAllowance>>;
41
42
  readonly workspaceAgentsMd?: true;
42
43
  }
43
44