@r_masseater/msch 0.65.0 → 0.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +4 -4
- package/dist/cli.mjs +363 -388
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/config.mjs.map +1 -1
- package/dist/{dependencies-B6p7x90y.mjs → dependencies-BDQ7XSwU.mjs} +7 -30
- package/dist/dependencies-BDQ7XSwU.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/export-subpaths-D6ZLYZGy.mjs +17 -0
- package/dist/export-subpaths-D6ZLYZGy.mjs.map +1 -0
- package/dist/{ignored-directories-BgUqwuc4.mjs → ignored-directories-DurTKTTN.mjs} +2 -2
- package/dist/{ignored-directories-BgUqwuc4.mjs.map → ignored-directories-DurTKTTN.mjs.map} +1 -1
- package/dist/{index-BZIBqvmt.d.mts → index-MUn1dolO.d.mts} +2 -1
- package/dist/{lookup-DmifnzVb.mjs → lookup-DjQU0W6q.mjs} +3 -16
- package/dist/lookup-DjQU0W6q.mjs.map +1 -0
- package/dist/{lookup-report-ARfHc4ey.mjs → lookup-report-CPR_cj8F.mjs} +3 -3
- package/dist/lookup-report-CPR_cj8F.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{pass-records-CFIrQmB5.mjs → pass-records-DdiDtl_g.mjs} +5 -5
- package/dist/pass-records-DdiDtl_g.mjs.map +1 -0
- package/dist/{problem-D2HKNIVq.mjs → problem-glqVxx3h.mjs} +2 -2
- package/dist/{problem-D2HKNIVq.mjs.map → problem-glqVxx3h.mjs.map} +1 -1
- package/dist/publish.mjs +7 -18
- package/dist/publish.mjs.map +1 -1
- package/dist/{published-BIexKvdJ.mjs → published-DnkuW2Tw.mjs} +10 -15
- package/dist/published-DnkuW2Tw.mjs.map +1 -0
- package/dist/refs.mjs +53 -25
- package/dist/refs.mjs.map +1 -1
- package/dist/{repository-files-B5sRbxlz.mjs → repository-files-mOPItI5o.mjs} +3 -3
- package/dist/repository-files-mOPItI5o.mjs.map +1 -0
- package/dist/{runtime-A2p57njU.mjs → runtime-mDBC8Yey.mjs} +2 -2
- package/dist/{runtime-A2p57njU.mjs.map → runtime-mDBC8Yey.mjs.map} +1 -1
- package/dist/{syntax-C0ddqOHc.mjs → syntax-A3ga4Ksb.mjs} +2 -2
- package/dist/{syntax-C0ddqOHc.mjs.map → syntax-A3ga4Ksb.mjs.map} +1 -1
- package/dist/tree-sitter-BfzHNwTR.mjs +41 -0
- package/dist/tree-sitter-BfzHNwTR.mjs.map +1 -0
- package/dist/{upstream-exits-Dp0EeI5D.mjs → upstream-exits-Bv2E-QO6.mjs} +21 -12
- package/dist/upstream-exits-Bv2E-QO6.mjs.map +1 -0
- package/dist/wake.mjs +1 -1
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +18 -5
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +3 -6
- package/skills/msch-checks/SKILL.md +2 -2
- package/skills/msch-publishing/SKILL.md +2 -0
- package/dist/dependencies-B6p7x90y.mjs.map +0 -1
- package/dist/lookup-DmifnzVb.mjs.map +0 -1
- package/dist/lookup-report-ARfHc4ey.mjs.map +0 -1
- package/dist/pass-records-CFIrQmB5.mjs.map +0 -1
- package/dist/published-BIexKvdJ.mjs.map +0 -1
- package/dist/reference-links-B9NZUUF8.mjs +0 -172
- package/dist/reference-links-B9NZUUF8.mjs.map +0 -1
- package/dist/repository-files-B5sRbxlz.mjs.map +0 -1
- package/dist/upstream-exits-Dp0EeI5D.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-C0ddqOHc.mjs","names":["Arr","Str"],"sources":["../src/shared/lib/syntax.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isPropertyAccessExpression,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nexport const isOutsideDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n program.isSourceFileDefaultLibrary(declaration.getSourceFile()) ||\n isExternalDeclaration(program)(declaration);\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAtLocation =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node));\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n symbolAtLocation(checker)(node).pipe(Option.map(resolvedSymbol(checker)));\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isInsideAny =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst membersOf = (declaration: Node): readonly Node[] => {\n if (isInterfaceDeclaration(declaration) || isClassDeclaration(declaration)) {\n return declaration.members;\n }\n if (isTypeAliasDeclaration(declaration) && isTypeLiteralNode(declaration.type)) {\n return declaration.type.members;\n }\n return [];\n};\n\nconst isTagNamed =\n (name: string) =>\n (member: Node): boolean =>\n (isPropertySignatureDeclaration(member) || isPropertyDeclaration(member)) &&\n pipe(\n Option.fromUndefinedOr(member.type),\n Option.exists(\n (type) =>\n isLiteralTypeNode(type) && isStringLiteral(type.literal) && type.literal.text === name,\n ),\n );\n\nexport const declaresAType = (declarations: readonly Node[]): boolean =>\n pipe(\n declarations,\n Arr.some((declaration) => isTypeDeclaration(declaration) || isClassDeclaration(declaration)),\n );\n\nexport const carriesTag =\n (name: string) =>\n (declarations: readonly Node[]): boolean =>\n pipe(declarations, Arr.flatMap(membersOf), Arr.some(isTagNamed(name)));\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n"],"mappings":";;;;;;AAkCA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAa,qBAA2B,UACtCA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAa,cAAc,SAAgC;CACzD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAa,aAAa,aAA6B;CACrD,MAAM,eAAe,KACnB,UACAC,OAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,OAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,OAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C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vE,OAAO,YAAY;CAErB,IAAI,uBAAuB,WAAW,KAAK,kBAAkB,YAAY,IAAI,GAC3E,OAAO,YAAY,KAAK;CAE1B,OAAO,CAAC;AACV;AAEA,MAAM,cACH,UACA,YACE,+BAA+B,MAAM,KAAK,sBAAsB,MAAM,MACvE,KACE,OAAO,gBAAgB,OAAO,IAAI,GAClC,OAAO,QACJ,SACC,kBAAkB,IAAI,KAAK,gBAAgB,KAAK,OAAO,KAAK,KAAK,QAAQ,SAAS,IACtF,CACF;AAEJ,MAAa,iBAAiB,iBAC5B,KACE,cACAA,MAAI,MAAM,gBAAgB,kBAAkB,WAAW,KAAK,mBAAmB,WAAW,CAAC,CAC7F;AAEF,MAAa,cACV,UACA,iBACC,KAAK,cAAcA,MAAI,QAAQ,SAAS,GAAGA,MAAI,KAAK,WAAW,IAAI,CAAC,CAAC;AAEzE,MAAa,wBAAwB,iBAClC,uBAAuB,WAAW,KAAK,uBAAuB,WAAW,MAC1EA,MAAI,wBAAwB,YAAY,kBAAkB,CAAC,CAAC;AAE9D,MAAa,mBACV,aACA,SACC,KACE,QAAQ,oBAAoB,IAAI,GAChCA,MAAI,KAAK,aAAa,SAAS,IAAI,CACrC;AAEJ,MAAM,qBAAqB,cAA2C;CACpE,IAAI,CAAC,oBAAoB,SAAS,KAAK,CAAC,oBAAoB,SAAS,GACnE,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,gBAAgB,UAAU,eAAe,CAAC,CAAC,KACvD,OAAO,QAAQ,cAAc,gBAAgB,SAAS,CAAC,GACvD,OAAO,KAAK,cAAc,UAAU,IAAI,CAC1C;AACF;AAEA,MAAa,qBAAqB,eAChC,KACE,WAAW,YACXA,MAAI,KAAK,cAAc,kBAAkB,SAAS,CAAC,GACnDA,MAAI,QACN"}
|
|
1
|
+
{"version":3,"file":"syntax-A3ga4Ksb.mjs","names":["Arr","Str"],"sources":["../src/shared/lib/syntax.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isPropertyAccessExpression,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nexport const isOutsideDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n program.isSourceFileDefaultLibrary(declaration.getSourceFile()) ||\n isExternalDeclaration(program)(declaration);\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAtLocation =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node));\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n symbolAtLocation(checker)(node).pipe(Option.map(resolvedSymbol(checker)));\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isInsideAny =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst membersOf = (declaration: Node): readonly Node[] => {\n if (isInterfaceDeclaration(declaration) || isClassDeclaration(declaration)) {\n return declaration.members;\n }\n if (isTypeAliasDeclaration(declaration) && isTypeLiteralNode(declaration.type)) {\n return declaration.type.members;\n }\n return [];\n};\n\nconst isTagNamed =\n (name: string) =>\n (member: Node): boolean =>\n (isPropertySignatureDeclaration(member) || isPropertyDeclaration(member)) &&\n pipe(\n Option.fromUndefinedOr(member.type),\n Option.exists(\n (type) =>\n isLiteralTypeNode(type) && isStringLiteral(type.literal) && type.literal.text === name,\n ),\n );\n\nexport const declaresAType = (declarations: readonly Node[]): boolean =>\n pipe(\n declarations,\n Arr.some((declaration) => isTypeDeclaration(declaration) || isClassDeclaration(declaration)),\n );\n\nexport const carriesTag =\n (name: string) =>\n (declarations: readonly Node[]): boolean =>\n pipe(declarations, Arr.flatMap(membersOf), Arr.some(isTagNamed(name)));\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n"],"mappings":";;;;;;AAkCA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAa,qBAA2B,UACtCA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAa,cAAc,SAAgC;CACzD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAa,aAAa,aAA6B;CACrD,MAAM,eAAe,KACnB,UACAC,OAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,OAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,OAA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Option, Schema } from "effect";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
5
|
+
// src/shared/lib/tree-sitter.ts
|
|
6
|
+
const taggedError = Schema.TaggedError;
|
|
7
|
+
var GrammarUnreadable = class extends taggedError()("GrammarUnreadable", {
|
|
8
|
+
grammar: Schema.String,
|
|
9
|
+
message: Schema.String
|
|
10
|
+
}) {};
|
|
11
|
+
const PARSER_KEY = "parser";
|
|
12
|
+
const initParser = startedOnce();
|
|
13
|
+
const loadOnce = startedOnce();
|
|
14
|
+
const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
|
|
15
|
+
const loadLanguage = (grammar) => {
|
|
16
|
+
const unreadable = (cause) => GrammarUnreadable.make({
|
|
17
|
+
grammar,
|
|
18
|
+
message: String(cause)
|
|
19
|
+
});
|
|
20
|
+
return Effect.tryPromise({
|
|
21
|
+
try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),
|
|
22
|
+
catch: unreadable
|
|
23
|
+
}).pipe(Effect.andThen(Effect.tryPromise({
|
|
24
|
+
try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),
|
|
25
|
+
catch: unreadable
|
|
26
|
+
})));
|
|
27
|
+
};
|
|
28
|
+
const readTree = ({ language, source, read }) => {
|
|
29
|
+
const parser = new treeSitter.Parser();
|
|
30
|
+
parser.setLanguage(language);
|
|
31
|
+
const tree = parser.parse(source);
|
|
32
|
+
parser.delete();
|
|
33
|
+
return Option.map(Option.fromNullishOr(tree), (parsed) => {
|
|
34
|
+
const result = read(parsed.rootNode);
|
|
35
|
+
parsed.delete();
|
|
36
|
+
return result;
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export { readTree as n, loadLanguage as t };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=tree-sitter-BfzHNwTR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-sitter-BfzHNwTR.mjs","names":[],"sources":["../src/shared/lib/tree-sitter.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\n\nimport treeSitter from \"@vscode/tree-sitter-wasm\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { startedOnce } from \"./started-once.ts\";\n\nexport type Language = treeSitter.Language;\n\nexport type SyntaxNode = treeSitter.Node;\n\nexport interface TreeReading<Result> {\n readonly language: Language;\n readonly source: string;\n readonly read: (root: SyntaxNode) => Result;\n}\n\nconst taggedError = Schema.TaggedError;\n\nexport class GrammarUnreadable extends taggedError<\n GrammarUnreadable,\n { readonly brand: unique symbol }\n>()(\"GrammarUnreadable\", { grammar: Schema.String, message: Schema.String }) {}\n\nconst PARSER_KEY = \"parser\";\n\nconst initParser = startedOnce<unknown>();\n\nconst loadOnce = startedOnce<Language>();\n\nconst grammarFile = (grammar: string): string =>\n fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));\n\nexport const loadLanguage = (grammar: string): Effect.Effect<Language, GrammarUnreadable> => {\n const unreadable = (cause: unknown): GrammarUnreadable =>\n GrammarUnreadable.make({ grammar, message: String(cause) });\n return Effect.tryPromise({\n try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),\n catch: unreadable,\n }).pipe(\n Effect.andThen(\n Effect.tryPromise({\n try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),\n catch: unreadable,\n }),\n ),\n );\n};\n\nexport const readTree = <Result>({\n language,\n source,\n read,\n}: TreeReading<Result>): Option.Option<Result> => {\n const parser = new treeSitter.Parser();\n parser.setLanguage(language);\n const tree = parser.parse(source);\n parser.delete();\n return Option.map(Option.fromNullishOr(tree), (parsed) => {\n const result = read(parsed.rootNode);\n parsed.delete();\n return result;\n });\n};\n"],"mappings":";;;;;AAiBA,MAAM,cAAc,OAAO;AAE3B,IAAa,oBAAb,cAAuC,YAGrC,CAAC,CAAC,qBAAqB;CAAE,SAAS,OAAO;CAAQ,SAAS,OAAO;AAAO,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,aAAa;AAEnB,MAAM,aAAa,YAAqB;AAExC,MAAM,WAAW,YAAsB;AAEvC,MAAM,eAAe,YACnB,cAAc,YAAY,QAAQ,6CAA6C,QAAQ,MAAM,CAAC;AAEhG,MAAa,gBAAgB,YAAgE;CAC3F,MAAM,cAAc,UAClB,kBAAkB,KAAK;EAAE;EAAS,SAAS,OAAO,KAAK;CAAE,CAAC;CAC5D,OAAO,OAAO,WAAW;EACvB,WAAW,WAAW,kBAAkB,WAAW,OAAO,KAAK,CAAC;EAChE,OAAO;CACT,CAAC,CAAC,CAAC,KACD,OAAO,QACL,OAAO,WAAW;EAChB,WAAW,SAAS,eAAe,WAAW,SAAS,KAAK,YAAY,OAAO,CAAC,CAAC;EACjF,OAAO;CACT,CAAC,CACH,CACF;AACF;AAEA,MAAa,YAAoB,EAC/B,UACA,QACA,WACgD;CAChD,MAAM,SAAS,IAAI,WAAW,OAAO;CACrC,OAAO,YAAY,QAAQ;CAC3B,MAAM,OAAO,OAAO,MAAM,MAAM;CAChC,OAAO,OAAO;CACd,OAAO,OAAO,IAAI,OAAO,cAAc,IAAI,IAAI,WAAW;EACxD,MAAM,SAAS,KAAK,OAAO,QAAQ;EACnC,OAAO,OAAO;EACd,OAAO;CACT,CAAC;AACH"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
import { a as groupOf, n as RepositoryFiles } from "./repository-files-
|
|
2
|
-
import {
|
|
1
|
+
import { a as groupOf, n as RepositoryFiles } from "./repository-files-mOPItI5o.mjs";
|
|
2
|
+
import { a as problemAtPosition } from "./problem-glqVxx3h.mjs";
|
|
3
|
+
import { i as publicLookup, n as githubToken, r as jsonLookup, t as fetched } from "./lookup-DjQU0W6q.mjs";
|
|
3
4
|
import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
4
5
|
import { Parser, parseDocument } from "yaml";
|
|
5
6
|
import semver from "semver";
|
|
6
7
|
import { parseTOML } from "toml-eslint-parser";
|
|
7
8
|
import { HttpClientResponse } from "effect/http";
|
|
9
|
+
// src/shared/lib/text-position.ts
|
|
10
|
+
const START = 0;
|
|
11
|
+
const FIRST_COLUMN = 1;
|
|
12
|
+
const positionOf = (source) => (index) => {
|
|
13
|
+
const before = pipe(source, String$1.slice(START, index), String$1.split("\n"));
|
|
14
|
+
return {
|
|
15
|
+
line: before.length,
|
|
16
|
+
column: pipe(Array.last(before), Option.match({
|
|
17
|
+
onNone: () => FIRST_COLUMN,
|
|
18
|
+
onSome: (last) => last.length + FIRST_COLUMN
|
|
19
|
+
}))
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const problemAtIndex = (rule) => (file, source) => (index, message) => problemAtPosition(rule)(file, positionOf(source)(index), message);
|
|
8
23
|
// src/shared/lib/config-comments.ts
|
|
9
24
|
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
10
25
|
const childrenOf = (value) => {
|
|
@@ -334,12 +349,6 @@ const ROOT_FILES = [{
|
|
|
334
349
|
}];
|
|
335
350
|
const REASON = "Every deviation from an upstream package is temporary, and the comment says when to go back to the official package so that msch-exits can tell.";
|
|
336
351
|
const STRAY = "An exit condition belongs at the end of the line of an overrides, patchedDependencies, packageExtensions or [patch] entry. Move it there or delete it.";
|
|
337
|
-
const problemAt = ({ file, source }) => (index, message) => ({
|
|
338
|
-
file,
|
|
339
|
-
...positionOf(source)(index),
|
|
340
|
-
rule: RULE,
|
|
341
|
-
message
|
|
342
|
-
});
|
|
343
352
|
const messageFor = (entry, exitText) => {
|
|
344
353
|
if (Option.isNone(exitText)) return Option.some(`${entry.section} entry ${entry.key} has no exit condition. ${REASON} Add \`# exit: <condition>\` at the end of the line, where the condition is ${GRAMMAR}.`);
|
|
345
354
|
const conditions = parseCondition(exitText.value);
|
|
@@ -351,12 +360,12 @@ const entryProblems = (read) => {
|
|
|
351
360
|
const comments = commentsByLine(read.deviations.comments);
|
|
352
361
|
return pipe(read.deviations.entries, Array.flatMap((entry) => {
|
|
353
362
|
const exitText = pipe(HashMap.get(comments, entry.line), Option.flatMap(({ text }) => exitTextOf(text)));
|
|
354
|
-
return pipe(messageFor(entry, exitText), Option.map((message) =>
|
|
363
|
+
return pipe(messageFor(entry, exitText), Option.map((message) => problemAtIndex(RULE)(read.file, read.source)(entry.index, message)), Option.toArray);
|
|
355
364
|
}));
|
|
356
365
|
};
|
|
357
366
|
const strayProblems = (read) => {
|
|
358
367
|
const entryLines = HashSet.fromIterable(pipe(read.deviations.entries, Array.map(({ line }) => line)));
|
|
359
|
-
return pipe(read.deviations.comments, Array.filter((comment) => Option.isSome(exitTextOf(comment.text)) && !HashSet.has(entryLines, comment.line)), Array.map((comment) =>
|
|
368
|
+
return pipe(read.deviations.comments, Array.filter((comment) => Option.isSome(exitTextOf(comment.text)) && !HashSet.has(entryLines, comment.line)), Array.map((comment) => problemAtIndex(RULE)(read.file, read.source)(comment.index, STRAY)));
|
|
360
369
|
};
|
|
361
370
|
const readRootFiles = Effect.fn("readRootFiles")(function* readRootFiles(root) {
|
|
362
371
|
const files = yield* RepositoryFiles;
|
|
@@ -387,6 +396,6 @@ const upstreamExitsMet = Effect.fn("upstreamExitsMet")(function* upstreamExitsMe
|
|
|
387
396
|
}, { concurrency: 1 });
|
|
388
397
|
return Array.flatten(perFile);
|
|
389
398
|
});
|
|
390
|
-
export { workspaceDeviations as a, tomlSourceComments as c, cargoDeviations as i, yamlSourceComments as l, upstreamExitsMet as n, collectNodes as o, WORKSPACE_SECTIONS as r, isRecord as s, checkUpstreamExits as t };
|
|
399
|
+
export { workspaceDeviations as a, tomlSourceComments as c, problemAtIndex as d, cargoDeviations as i, yamlSourceComments as l, upstreamExitsMet as n, collectNodes as o, WORKSPACE_SECTIONS as r, isRecord as s, checkUpstreamExits as t, positionOf as u };
|
|
391
400
|
|
|
392
|
-
//# sourceMappingURL=upstream-exits-
|
|
401
|
+
//# sourceMappingURL=upstream-exits-Bv2E-QO6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upstream-exits-Bv2E-QO6.mjs","names":["Str","Arr","Arr","Rec","YamlParser","Str","Arr","Str","Arr","Arr","Rec","Str","Arr"],"sources":["../src/shared/lib/text-position.ts","../src/shared/lib/config-comments.ts","../src/features/check-upstream-exits/model/deviation-entries.ts","../src/features/check-upstream-exits/model/exit-condition.ts","../src/features/check-upstream-exits/model/met-exits.ts","../src/features/check-upstream-exits/model/upstream-exits.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { problemAtPosition } from \"./problem.ts\";\nimport type { Problem, RuleName } from \"./problem.ts\";\n\nconst START = 0;\nconst FIRST_COLUMN = 1;\n\nexport const positionOf =\n (source: string) =>\n (index: number): Pick<Problem, \"line\" | \"column\"> => {\n const before = pipe(source, Str.slice(START, index), Str.split(\"\\n\"));\n return {\n line: before.length,\n column: pipe(\n Arr.last(before),\n Option.match({ onNone: () => FIRST_COLUMN, onSome: (last) => last.length + FIRST_COLUMN }),\n ),\n };\n };\n\nexport const problemAtIndex =\n (rule: RuleName) =>\n (file: string, source: string) =>\n (index: number, message: string): Problem =>\n problemAtPosition(rule)(file, positionOf(source)(index), message);\n","import { Array as Arr, Record as Rec, String as Str, pipe } from \"effect\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { Parser as YamlParser } from \"yaml\";\n\nexport interface SourceComment {\n readonly index: number;\n readonly text: string;\n}\n\nexport const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null;\n\nconst childrenOf = (value: unknown): readonly unknown[] => {\n if (Arr.isArray(value)) {\n return value;\n }\n if (isRecord(value)) {\n return Rec.values(value);\n }\n return [];\n};\n\nexport const collectNodes =\n <Item>(isItem: (value: unknown) => value is Item) =>\n (value: unknown): readonly Item[] => {\n if (isItem(value)) {\n return [value];\n }\n return pipe(childrenOf(value), Arr.flatMap(collectNodes(isItem)));\n };\n\ninterface YamlSourceToken {\n readonly offset: number;\n readonly source: string;\n}\n\nconst isYamlComment = (value: unknown): value is YamlSourceToken =>\n isRecord(value) &&\n value[\"type\"] === \"comment\" &&\n typeof value[\"offset\"] === \"number\" &&\n typeof value[\"source\"] === \"string\";\n\nexport const yamlSourceComments = (source: string): readonly SourceComment[] =>\n pipe(\n Arr.fromIterable(new YamlParser().parse(source)),\n Arr.flatMap(collectNodes(isYamlComment)),\n Arr.map((token) => ({ index: token.offset, text: token.source })),\n );\n\nexport const tomlSourceComments = (source: string): readonly SourceComment[] =>\n pipe(\n parseTOML(source).comments,\n Arr.map(({ range: [start, end] }) => ({\n index: start,\n text: Str.slice(start, end)(source),\n })),\n );\n","import { Array as Arr, HashMap, Option, Schema, pipe } from \"effect\";\nimport { parseTOML } from \"toml-eslint-parser\";\nimport { parseDocument } from \"yaml\";\n\nimport { tomlSourceComments, yamlSourceComments } from \"#/shared/lib/config-comments.ts\";\nimport type { SourceComment } from \"#/shared/lib/config-comments.ts\";\nimport { positionOf } from \"#/shared/lib/text-position.ts\";\n\nexport const WORKSPACE_SECTIONS = [\n \"overrides\",\n \"patchedDependencies\",\n \"packageExtensions\",\n] as const;\nconst CARGO_PATCH = \"patch\";\nconst KEY_SEPARATOR = \".\";\nconst PATCH_SOURCE_DEPTH = 2;\n\nexport type Section = (typeof WORKSPACE_SECTIONS)[number] | typeof CARGO_PATCH;\n\nexport interface DeviationEntry {\n readonly section: Section;\n readonly key: string;\n readonly index: number;\n readonly line: number;\n}\n\nexport interface LineComment extends SourceComment {\n readonly line: number;\n}\n\nexport interface Deviations {\n readonly entries: readonly DeviationEntry[];\n readonly comments: readonly LineComment[];\n}\n\nconst NONE: Deviations = { entries: [], comments: [] };\n\nconst KeyValue = Schema.Union([Schema.String, Schema.Finite]);\nconst Positions = Schema.Array(Schema.Finite);\nconst YamlKey = Schema.Struct({ value: KeyValue, range: Positions });\nconst YamlMap = Schema.Struct({ items: Schema.Array(Schema.Struct({ key: YamlKey })) });\n\nconst KeyPart = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"TOMLBare\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"TOMLQuoted\"), value: Schema.String }),\n]);\nconst Located = {\n range: Schema.Array(Schema.Finite),\n loc: Schema.Struct({ start: Schema.Struct({ line: Schema.Finite }) }),\n};\nconst TomlKeyValue = Schema.Struct({\n ...Located,\n type: Schema.Literal(\"TOMLKeyValue\"),\n key: Schema.Struct({ keys: Schema.Array(KeyPart) }),\n});\nconst TomlTable = Schema.Struct({\n ...Located,\n type: Schema.Literal(\"TOMLTable\"),\n resolvedKey: Schema.Array(Schema.Union([Schema.String, Schema.Finite])),\n body: Schema.Array(TomlKeyValue),\n});\nconst TomlNode = Schema.Union([TomlTable, TomlKeyValue]);\nconst TomlTop = Schema.Array(Schema.Struct({ body: Schema.Array(TomlNode) }));\n\ntype TomlTableType = typeof TomlTable.Type;\ntype KeyPartType = typeof KeyPart.Type;\n\nconst decodeYamlMap = Schema.decodeUnknownOption(YamlMap);\nconst decodeTomlTop = Schema.decodeUnknownOption(TomlTop);\nconst FIRST = 0;\n\nconst lineComments = (source: string, comments: readonly SourceComment[]): readonly LineComment[] =>\n pipe(\n comments,\n Arr.map((comment) => ({ ...comment, line: positionOf(source)(comment.index).line })),\n );\n\nconst startOf = (range: readonly number[]): number =>\n Option.getOrElse(Arr.get(range, FIRST), () => FIRST);\n\nconst sectionEntries =\n (source: string, sectionNode: (section: string) => unknown) =>\n (section: (typeof WORKSPACE_SECTIONS)[number]): readonly DeviationEntry[] =>\n pipe(\n decodeYamlMap(sectionNode(section)),\n Option.match({\n onNone: () => [],\n onSome: ({ items }) =>\n pipe(\n items,\n Arr.map(({ key }) => {\n const index = startOf(key.range);\n return {\n section,\n key: String(key.value),\n index,\n line: positionOf(source)(index).line,\n };\n }),\n ),\n }),\n );\n\nexport const workspaceDeviations = (source: string): Deviations => {\n const document = parseDocument(source);\n if (Arr.isReadonlyArrayNonEmpty(document.errors)) {\n return NONE;\n }\n const sectionNode = (section: string): unknown => document.get(section, true);\n return {\n entries: pipe(WORKSPACE_SECTIONS, Arr.flatMap(sectionEntries(source, sectionNode))),\n comments: lineComments(source, yamlSourceComments(source)),\n };\n};\n\nconst partName = (part: KeyPartType): string => {\n if (part.type === \"TOMLBare\") {\n return part.name;\n }\n return part.value;\n};\n\nconst patchEntries = (table: TomlTableType): readonly DeviationEntry[] => {\n const tableKey = pipe(table.resolvedKey, Arr.map(String));\n if (!Option.exists(Arr.get(tableKey, FIRST), (part) => part === CARGO_PATCH)) {\n return [];\n }\n if (tableKey.length > PATCH_SOURCE_DEPTH) {\n return [\n {\n section: CARGO_PATCH,\n key: Arr.join(tableKey, KEY_SEPARATOR),\n index: startOf(table.range),\n line: table.loc.start.line,\n },\n ];\n }\n return pipe(\n table.body,\n Arr.map((value) => ({\n section: CARGO_PATCH,\n key: Arr.join([...tableKey, ...pipe(value.key.keys, Arr.map(partName))], KEY_SEPARATOR),\n index: startOf(value.range),\n line: value.loc.start.line,\n })),\n );\n};\n\nconst isTable = (node: TomlTableType | typeof TomlKeyValue.Type): node is TomlTableType =>\n node.type === \"TOMLTable\";\n\nexport const cargoDeviations = (source: string): Deviations =>\n pipe(\n Option.liftThrowable(() => parseTOML(source).body)(),\n Option.flatMap(decodeTomlTop),\n Option.match({\n onNone: () => NONE,\n onSome: (tops) => ({\n entries: pipe(\n tops,\n Arr.flatMap(({ body }) => body),\n Arr.filter(isTable),\n Arr.flatMap(patchEntries),\n ),\n comments: lineComments(source, tomlSourceComments(source)),\n }),\n }),\n );\n\nexport const commentsByLine = (\n comments: readonly LineComment[],\n): HashMap.HashMap<number, LineComment> =>\n HashMap.fromIterable(\n pipe(\n comments,\n Arr.map((comment) => [comment.line, comment] as const),\n ),\n );\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\nimport semver from \"semver\";\n\nexport type Registry = \"npm\" | \"crate\";\nexport type Relation = \"drops\" | \"allows\" | \"requires\";\n\nexport interface Unused {\n readonly kind: \"unused\";\n}\n\nexport interface Published {\n readonly kind: \"published\";\n readonly registry: Registry;\n readonly name: string;\n readonly range: string;\n}\n\nexport interface Declares {\n readonly kind: \"declares\";\n readonly registry: Registry;\n readonly name: string;\n readonly relation: Relation;\n readonly dependency: string;\n readonly range: string;\n}\n\nexport interface Closed {\n readonly kind: \"closed\";\n readonly owner: string;\n readonly repo: string;\n readonly number: number;\n}\n\nexport type ExitCondition = Unused | Published | Declares | Closed;\n\nconst ALTERNATIVE = \" || \";\nconst UNUSED = \"unused\";\nconst ANY_RANGE = \"*\";\nconst EXIT_COMMENT = /^#?\\s*exit:\\s*(?<condition>.*?)\\s*$/u;\nconst PACKAGE = String.raw`(?:@[^\\s/@]+\\/)?[^\\s@]+`;\nconst REGISTRY_CONDITION = new RegExp(\n String.raw`^(?<registry>npm|crate):(?<name>${PACKAGE})(?:@(?<range>.+)| (?<relation>drops|allows|requires) (?<dependency>${PACKAGE})(?:@(?<dependencyRange>.+))?)$`,\n \"u\",\n);\nconst GITHUB_CONDITION = /^github:(?<owner>[\\w.-]+)\\/(?<repo>[\\w.-]+)#(?<number>[1-9]\\d*)$/u;\n\nexport const GRAMMAR =\n \"`unused`, `npm:<package>@<range>`, `npm:<package> drops <dependency>`, `npm:<package> allows <dependency>@<range>`, `npm:<package> requires <dependency>@<range>` (the same forms with `crate:`), or `github:<owner>/<repo>#<number>`, joined with ` || `\";\n\nconst isRegistry = (value: string): value is Registry => value === \"npm\" || value === \"crate\";\n\nconst isRelation = (value: string): value is Relation =>\n value === \"drops\" || value === \"allows\" || value === \"requires\";\n\nconst validRange = (range: string): Option.Option<string> =>\n Option.liftPredicate(range, (candidate) => semver.validRange(candidate) !== null);\n\ninterface Subject {\n readonly registry: Registry;\n readonly name: string;\n}\n\nconst declared = (subject: Subject, found: RegExpExecArray): Option.Option<ExitCondition> => {\n const relation = Option.filter(groupOf(\"relation\")(found), isRelation);\n const dependency = groupOf(\"dependency\")(found);\n const range = groupOf(\"dependencyRange\")(found);\n if (Option.isNone(relation) || Option.isNone(dependency)) {\n return Option.none();\n }\n const base = {\n kind: \"declares\",\n ...subject,\n relation: relation.value,\n dependency: dependency.value,\n } as const;\n if (relation.value === \"drops\") {\n return Option.match(range, {\n onNone: () => Option.some({ ...base, range: ANY_RANGE }),\n onSome: () => Option.none(),\n });\n }\n return pipe(\n range,\n Option.flatMap(validRange),\n Option.map((valid): ExitCondition => ({ ...base, range: valid })),\n );\n};\n\nconst registryCondition = (text: string): Option.Option<ExitCondition> => {\n const found = REGISTRY_CONDITION.exec(text);\n if (found === null) {\n return Option.none();\n }\n const subject = Option.all({\n registry: Option.filter(groupOf(\"registry\")(found), isRegistry),\n name: groupOf(\"name\")(found),\n });\n const range = groupOf(\"range\")(found);\n const conditionOf = (resolved: Subject): Option.Option<ExitCondition> =>\n Option.match(range, {\n onNone: () => declared(resolved, found),\n onSome: (published) =>\n Option.map(validRange(published), (valid): ExitCondition => ({\n kind: \"published\",\n ...resolved,\n range: valid,\n })),\n });\n return pipe(subject, Option.flatMap(conditionOf));\n};\n\nconst githubCondition = (text: string): Option.Option<ExitCondition> => {\n const found = GITHUB_CONDITION.exec(text);\n const issueNumber = pipe(groupOf(\"number\")(found), Option.map(Number));\n return pipe(\n Option.all({\n owner: groupOf(\"owner\")(found),\n repo: groupOf(\"repo\")(found),\n number: issueNumber,\n }),\n Option.map((issue): ExitCondition => ({ kind: \"closed\", ...issue })),\n );\n};\n\nconst alternativeOf = (text: string): Option.Option<ExitCondition> => {\n if (text === UNUSED) {\n return Option.some({ kind: \"unused\" });\n }\n return Option.orElse(registryCondition(text), () => githubCondition(text));\n};\n\nexport const parseCondition = (text: string): Option.Option<readonly ExitCondition[]> =>\n pipe(\n Str.split(text, ALTERNATIVE),\n Arr.map((alternative) => alternativeOf(Str.trim(alternative))),\n Option.all,\n );\n\nexport const exitTextOf = (comment: string): Option.Option<string> =>\n groupOf(\"condition\")(EXIT_COMMENT.exec(Str.trim(comment)));\n\nconst describeDeclares = (condition: Declares): string => {\n const subject = `${condition.registry}:${condition.name} ${condition.relation} ${condition.dependency}`;\n if (condition.relation === \"drops\") {\n return subject;\n }\n return `${subject}@${condition.range}`;\n};\n\nexport const describeCondition = (condition: ExitCondition): string =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => UNUSED,\n published: ({ registry, name, range }) => `${registry}:${name}@${range}`,\n declares: describeDeclares,\n closed: ({ owner, repo, number }) => `github:${owner}/${repo}#${String(number)}`,\n }),\n );\n\nexport const isUnused = (condition: ExitCondition): boolean => condition.kind === \"unused\";\n","import {\n Array as Arr,\n Effect,\n HashMap,\n Match,\n Option,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClientError, HttpClient } from \"effect/http\";\nimport semver from \"semver\";\n\nimport { fetched, githubToken, jsonLookup, publicLookup } from \"#/shared/lib/lookup.ts\";\n\nimport { commentsByLine } from \"./deviation-entries.ts\";\nimport type { DeviationEntry, Deviations, Section } from \"./deviation-entries.ts\";\nimport { describeCondition, exitTextOf, parseCondition } from \"./exit-condition.ts\";\nimport type { Closed, Declares, ExitCondition, Published } from \"./exit-condition.ts\";\n\nconst NPM = \"https://registry.npmjs.org/\";\nconst CRATES = \"https://crates.io/api/v1/crates/\";\nconst GITHUB = \"https://api.github.com/repos/\";\nconst LOOKUP_CONCURRENCY = 4;\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\n\nconst DECLARING_SECTIONS = [\"optionalDependencies\", \"peerDependencies\", \"dependencies\"] as const;\nconst Dependencies = Schema.Record(Schema.String, Schema.String);\nconst NpmVersion = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeDependencies = Schema.decodeUnknownOption(Dependencies);\nconst NpmPackument = Schema.Struct({\n \"dist-tags\": Schema.Struct({ latest: Schema.String }),\n versions: Schema.Record(Schema.String, NpmVersion),\n});\nconst Crate = Schema.Struct({\n crate: Schema.Struct({\n max_stable_version: Schema.NullOr(Schema.String),\n newest_version: Schema.String,\n }),\n versions: Schema.Array(Schema.Struct({ num: Schema.String, yanked: Schema.Boolean })),\n});\nconst CrateDependencies = Schema.Struct({\n dependencies: Schema.Array(Schema.Struct({ crate_id: Schema.String, req: Schema.String })),\n});\nconst Issue = Schema.Struct({ state: Schema.String });\n\ntype NpmVersionType = typeof NpmVersion.Type;\ntype LookupError = HttpClientError.HttpClientError | Schema.SchemaError;\n\n/** @internal */\nexport interface Release {\n readonly versions: readonly string[];\n readonly latestDependencies: Readonly<Record<string, string>>;\n}\n\n/** @internal */\nexport interface ExitEntry {\n readonly line: number;\n readonly section: Section;\n readonly key: string;\n readonly conditions: readonly ExitCondition[];\n}\n\n/** @internal */\nexport interface MetExit {\n readonly entry: ExitEntry;\n readonly condition: string;\n readonly outcome: \"met\" | \"unchecked\";\n}\n\nconst declaredBy = (version: NpmVersionType): Readonly<Record<string, string>> =>\n pipe(\n DECLARING_SECTIONS,\n Arr.flatMap((section) =>\n pipe(\n decodeDependencies(version[section]),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n ),\n ),\n Rec.fromEntries,\n );\n\nconst npmRelease = (name: string): Effect.Effect<Release, LookupError, HttpClient.HttpClient> =>\n fetched(publicLookup(`${NPM}${Str.replace(\"/\", \"%2f\")(name)}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(NpmPackument)),\n Effect.map(({ \"dist-tags\": tags, versions }) => ({\n versions: Rec.keys(versions),\n latestDependencies: pipe(\n Rec.get(versions, tags.latest),\n Option.map(declaredBy),\n Option.getOrElse(() => ({})),\n ),\n })),\n );\n\nconst crateRelease = Effect.fn(\"crateRelease\")(function* lookupCrate(name: string) {\n const found = yield* fetched(publicLookup(`${CRATES}${name}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Crate)),\n );\n const latest = found.crate.max_stable_version ?? found.crate.newest_version;\n const { dependencies } = yield* fetched(\n publicLookup(`${CRATES}${name}/${latest}/dependencies`),\n ).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(CrateDependencies)));\n const release: Release = {\n versions: pipe(\n found.versions,\n Arr.filter(({ yanked }) => !yanked),\n Arr.map(({ num }) => num),\n ),\n latestDependencies: Rec.fromEntries(\n pipe(\n dependencies,\n Arr.map(({ crate_id: crateId, req }) => [crateId, req] as const),\n ),\n ),\n };\n return release;\n});\n\nconst releaseOf = (\n condition: Published | Declares,\n): Effect.Effect<Release, LookupError, HttpClient.HttpClient> => {\n if (condition.registry === \"npm\") {\n return npmRelease(condition.name);\n }\n return crateRelease(condition.name);\n};\n\nconst declaresMet =\n (release: Release) =>\n (condition: Declares): boolean => {\n const declared = Rec.get(release.latestDependencies, condition.dependency);\n if (condition.relation === \"drops\") {\n return Option.isNone(declared);\n }\n return Option.exists(declared, (range) => {\n if (semver.validRange(range) === null) {\n return false;\n }\n if (condition.relation === \"allows\") {\n return semver.intersects(range, condition.range, RANGE_OPTIONS);\n }\n return semver.subset(range, condition.range, RANGE_OPTIONS);\n });\n };\n\n/** @internal */\nexport const isMet =\n (release: Release) =>\n (condition: ExitCondition): boolean =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => false,\n closed: () => false,\n published: ({ range }) =>\n pipe(\n release.versions,\n Arr.some((version) => semver.satisfies(version, range)),\n ),\n declares: declaresMet(release),\n }),\n );\n\nconst issueClosed = Effect.fn(\"issueClosed\")(function* lookupIssue(condition: Closed) {\n const token = yield* githubToken;\n const issue = yield* fetched(\n jsonLookup({\n url: `${GITHUB}${condition.owner}/${condition.repo}/issues/${String(condition.number)}`,\n token,\n }),\n ).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(Issue)));\n return issue.state === \"closed\";\n});\n\nconst conditionMet = (\n condition: ExitCondition,\n): Effect.Effect<boolean, LookupError, HttpClient.HttpClient> =>\n Match.value(condition).pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n unused: () => Effect.succeed(false),\n closed: issueClosed,\n published: (published) =>\n Effect.map(releaseOf(published), (release) => isMet(release)(published)),\n declares: (declares) =>\n Effect.map(releaseOf(declares), (release) => isMet(release)(declares)),\n }),\n );\n\n/** @internal */\nexport const exitEntries = (deviations: Deviations): readonly ExitEntry[] => {\n const comments = commentsByLine(deviations.comments);\n const entryOf = ({ line, section, key }: DeviationEntry): readonly ExitEntry[] =>\n pipe(\n HashMap.get(comments, line),\n Option.flatMap(({ text }) => exitTextOf(text)),\n Option.flatMap(parseCondition),\n Option.map((conditions): ExitEntry => ({ line, section, key, conditions })),\n Option.toArray,\n );\n return pipe(deviations.entries, Arr.flatMap(entryOf));\n};\n\nconst metOf = (\n entry: ExitEntry,\n condition: ExitCondition,\n): Effect.Effect<Option.Option<MetExit>, never, HttpClient.HttpClient> => {\n const described = describeCondition(condition);\n return conditionMet(condition).pipe(\n Effect.match({\n onSuccess: (met) =>\n Option.liftPredicate({ entry, condition: described, outcome: \"met\" } as const, () => met),\n onFailure: (error) =>\n Option.some({\n entry,\n condition: `${described} (${String(error)})`,\n outcome: \"unchecked\",\n } as const),\n }),\n );\n};\n\n/** @internal */\nexport const metExits = Effect.fn(\"metExits\")(function* metExits(entries: readonly ExitEntry[]) {\n const checksOf = (entry: ExitEntry): readonly ReturnType<typeof metOf>[] =>\n pipe(\n entry.conditions,\n Arr.map((condition) => metOf(entry, condition)),\n );\n const checks = pipe(entries, Arr.flatMap(checksOf));\n const results = yield* Effect.all(checks, { concurrency: LOOKUP_CONCURRENCY });\n return Arr.getSomes(results);\n});\n","import { Array as Arr, Effect, HashMap, HashSet, Option, pipe } from \"effect\";\n\nimport type { Problem, RuleName } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { problemAtIndex } from \"#/shared/lib/text-position.ts\";\n\nimport { cargoDeviations, commentsByLine, workspaceDeviations } from \"./deviation-entries.ts\";\nimport type { DeviationEntry, Deviations } from \"./deviation-entries.ts\";\nimport { GRAMMAR, exitTextOf, isUnused, parseCondition } from \"./exit-condition.ts\";\nimport { exitEntries, metExits } from \"./met-exits.ts\";\nimport type { ExitEntry, MetExit } from \"./met-exits.ts\";\n\nconst RULE: RuleName = \"upstream-exit\";\nconst ROOT_FILES = [\n { name: \"pnpm-workspace.yaml\", deviationsOf: workspaceDeviations },\n { name: \"Cargo.toml\", deviationsOf: cargoDeviations },\n] as const;\nconst REASON =\n \"Every deviation from an upstream package is temporary, and the comment says when to go back to the official package so that msch-exits can tell.\";\nconst STRAY =\n \"An exit condition belongs at the end of the line of an overrides, patchedDependencies, packageExtensions or [patch] entry. Move it there or delete it.\";\n\ninterface ReadFile {\n readonly file: string;\n readonly source: string;\n readonly deviations: Deviations;\n}\n\nconst messageFor = (\n entry: DeviationEntry,\n exitText: Option.Option<string>,\n): Option.Option<string> => {\n if (Option.isNone(exitText)) {\n return Option.some(\n `${entry.section} entry ${entry.key} has no exit condition. ${REASON} Add \\`# exit: <condition>\\` at the end of the line, where the condition is ${GRAMMAR}.`,\n );\n }\n const conditions = parseCondition(exitText.value);\n if (Option.isNone(conditions)) {\n return Option.some(\n `The exit condition \\`${exitText.value}\\` of ${entry.key} is not one msch-exits can check. Write ${GRAMMAR}.`,\n );\n }\n if (entry.section !== \"overrides\" && pipe(conditions.value, Arr.some(isUnused))) {\n return Option.some(\n `\\`unused\\` is checked only for overrides, by the unused-override and removable-override checks. Give ${entry.key} a condition on a release or an issue.`,\n );\n }\n return Option.none();\n};\n\nconst entryProblems = (read: ReadFile): readonly Problem[] => {\n const comments = commentsByLine(read.deviations.comments);\n return pipe(\n read.deviations.entries,\n Arr.flatMap((entry) => {\n const exitText = pipe(\n HashMap.get(comments, entry.line),\n Option.flatMap(({ text }) => exitTextOf(text)),\n );\n return pipe(\n messageFor(entry, exitText),\n Option.map((message) => problemAtIndex(RULE)(read.file, read.source)(entry.index, message)),\n Option.toArray,\n );\n }),\n );\n};\n\nconst strayProblems = (read: ReadFile): readonly Problem[] => {\n const entryLines = HashSet.fromIterable(\n pipe(\n read.deviations.entries,\n Arr.map(({ line }) => line),\n ),\n );\n return pipe(\n read.deviations.comments,\n Arr.filter(\n (comment) =>\n Option.isSome(exitTextOf(comment.text)) && !HashSet.has(entryLines, comment.line),\n ),\n Arr.map((comment) => problemAtIndex(RULE)(read.file, read.source)(comment.index, STRAY)),\n );\n};\n\nconst readRootFiles = Effect.fn(\"readRootFiles\")(function* readRootFiles(root: string) {\n const files = yield* RepositoryFiles;\n const read = yield* Effect.forEach(\n ROOT_FILES,\n ({ name, deviationsOf }) => {\n const file = files.join(root, name);\n return Effect.map(\n files.readFile(file),\n Option.map((source): ReadFile => ({ file, source, deviations: deviationsOf(source) })),\n );\n },\n { concurrency: \"unbounded\" },\n );\n return Arr.getSomes(read);\n});\n\n/** @internal */\nexport const checkUpstreamExits = Effect.fn(\"checkUpstreamExits\")(function* checkUpstreamExits(\n root: string,\n) {\n const read = yield* readRootFiles(root);\n return pipe(\n read,\n Arr.flatMap((file) => [...entryProblems(file), ...strayProblems(file)]),\n );\n});\n\n/** @internal */\nexport interface FileExit {\n readonly file: string;\n readonly met: MetExit;\n}\n\n/** @internal */\nexport const upstreamExitsMet = Effect.fn(\"upstreamExitsMet\")(function* upstreamExitsMet(\n root: string,\n) {\n const read = yield* readRootFiles(root);\n const perFile = yield* Effect.forEach(\n read,\n ({ file, deviations }) => {\n const entries: readonly ExitEntry[] = exitEntries(deviations);\n return Effect.map(\n metExits(entries),\n Arr.map((met): FileExit => ({ file, met })),\n );\n },\n { concurrency: 1 },\n );\n return Arr.flatten(perFile);\n});\n"],"mappings":";;;;;;;;;AAKA,MAAM,QAAQ;AACd,MAAM,eAAe;AAErB,MAAa,cACV,YACA,UAAoD;CACnD,MAAM,SAAS,KAAK,QAAQA,SAAI,MAAM,OAAO,KAAK,GAAGA,SAAI,MAAM,IAAI,CAAC;CACpE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MAAM,IAAI;EAClC,OAAO,OAAO,IACZ,MAAM,SAAS,IAAI,GACnB,OAAO,KAAK,YAAsB;GAAE;GAAM;GAAQ,YAAY,aAAa,MAAM;EAAE,EAAE,CACvF;CACF,GACA,EAAE,aAAa,YAAY,CAC7B;CACA,OAAOA,MAAI,SAAS,IAAI;AAC1B,CAAC;;AAGD,MAAa,qBAAqB,OAAO,GAAG,oBAAoB,CAAC,CAAC,UAAU,mBAC1E,MACA;CACA,MAAM,OAAO,OAAO,cAAc,IAAI;CACtC,OAAO,KACL,MACAA,MAAI,SAAS,SAAS,CAAC,GAAG,cAAc,IAAI,GAAG,GAAG,cAAc,IAAI,CAAC,CAAC,CACxE;AACF,CAAC;;AASD,MAAa,mBAAmB,OAAO,GAAG,kBAAkB,CAAC,CAAC,UAAU,iBACtE,MACA;CACA,MAAM,OAAO,OAAO,cAAc,IAAI;CACtC,MAAM,UAAU,OAAO,OAAO,QAC5B,OACC,EAAE,MAAM,iBAAiB;EACxB,MAAM,UAAgC,YAAY,UAAU;EAC5D,OAAO,OAAO,IACZ,SAAS,OAAO,GAChBA,MAAI,KAAK,SAAmB;GAAE;GAAM;EAAI,EAAE,CAC5C;CACF,GACA,EAAE,aAAa,EAAE,CACnB;CACA,OAAOA,MAAI,QAAQ,OAAO;AAC5B,CAAC"}
|
package/dist/wake.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runCli } from "./runtime-
|
|
2
|
+
import { t as runCli } from "./runtime-mDBC8Yey.mjs";
|
|
3
3
|
import { n as actionsOidcToken, t as BROKER } from "./credential-broker-9FMyTp1H.mjs";
|
|
4
4
|
import { Boolean, Console, Effect, Option, Schema } from "effect";
|
|
5
5
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-MUn1dolO.mjs";
|
|
2
2
|
export { type DependencyAllowance, type DependencySets, type IgnoredDirectory, type RuleSet, type RuleSets, type SettingsOptions, type WorkspaceLint, type WorkspaceSettings, type WorkspaceTasks, ignoredDirectories, workspaceSettings };
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { o as workspaceDirectories, r as readManifest, t as MANIFEST_FILE } from "./dependencies-
|
|
2
|
-
import { A as programOf, D as testsItself, E as tasksOf, L as literalOf, M as usedFrom, O as literalSettings, R as nestedValues, _ as deployEntries, a as EntryManifestJson, b as prefixed, c as publicEntriesOf, f as depPathsOf, h as wantedLockfile, j as settingsInvalid, k as merged, n as entriesOf, t as PackEntry, u as linkedPaths, v as shadcnUiIn, x as NO_TASKS } from "./published-
|
|
1
|
+
import { o as workspaceDirectories, r as readManifest, t as MANIFEST_FILE } from "./dependencies-BDQ7XSwU.mjs";
|
|
2
|
+
import { A as programOf, D as testsItself, E as tasksOf, L as literalOf, M as usedFrom, O as literalSettings, R as nestedValues, _ as deployEntries, a as EntryManifestJson, b as prefixed, c as publicEntriesOf, f as depPathsOf, h as wantedLockfile, j as settingsInvalid, k as merged, n as entriesOf, t as PackEntry, u as linkedPaths, v as shadcnUiIn, x as NO_TASKS } from "./published-DnkuW2Tw.mjs";
|
|
3
|
+
import { n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-mOPItI5o.mjs";
|
|
3
4
|
import { n as FINGERPRINT_FILE, r as LOCK_FILE, t as CLOSURE_FILE } from "./locked-closure-paths-Dtqs8uBU.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { i as reachable, r as ignoredDirectories, t as collectIgnoredDirectories } from "./ignored-directories-BgUqwuc4.mjs";
|
|
5
|
+
import { i as reachable, r as ignoredDirectories, t as collectIgnoredDirectories } from "./ignored-directories-DurTKTTN.mjs";
|
|
6
6
|
import { Array, Effect, Option, Record, Schema, String, pipe } from "effect";
|
|
7
|
+
// src/entities/workspace/model/site-entries.ts
|
|
8
|
+
const READ_CONCURRENCY$1 = 16;
|
|
9
|
+
const SCRIPT = /\.[cm]?tsx?$/u;
|
|
10
|
+
const SKIPPED = /\.test\.|\.d\.[cm]?ts$/u;
|
|
11
|
+
const SERVER_ENTRY_IMPORT = /from\s+["']@effect\/ui\/html\/HtmlServerHttp["']/u;
|
|
12
|
+
const siteEntries = Effect.fn("siteEntries")(function* siteEntries(root) {
|
|
13
|
+
const files = yield* RepositoryFiles;
|
|
14
|
+
const listed = yield* files.listedFiles(root);
|
|
15
|
+
const candidates = pipe(listed, Array.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)));
|
|
16
|
+
const texts = yield* Effect.forEach(candidates, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$1 });
|
|
17
|
+
return pipe(Array.zip(candidates, texts), Array.filter(([, text]) => Option.exists(text, (value) => SERVER_ENTRY_IMPORT.test(value))), Array.map(([file]) => file));
|
|
18
|
+
});
|
|
7
19
|
// src/entities/workspace/model/locked-closures.ts
|
|
8
20
|
const IMPORTER = "importer:";
|
|
9
21
|
const ROOT_IMPORTER = ".";
|
|
@@ -273,7 +285,8 @@ const collectWorkspaceSettings = Effect.fn("collectWorkspaceSettings")(function*
|
|
|
273
285
|
overrides: pipe(found, Array.flatMap(({ overrides }) => overrides)),
|
|
274
286
|
shadcnUi: Array.getSomes(shadcnUi),
|
|
275
287
|
publicEntries: pipe(found, Array.flatMap(({ publicEntries }) => publicEntries)),
|
|
276
|
-
deployEntries: yield* deployEntries(options.root)
|
|
288
|
+
deployEntries: yield* deployEntries(options.root),
|
|
289
|
+
siteEntries: yield* siteEntries(options.root)
|
|
277
290
|
},
|
|
278
291
|
testProjects: pipe(found, Array.filter(({ ownTests }) => !ownTests), Array.map(({ testProject }) => testProject)),
|
|
279
292
|
tasks: mergedTasks(found),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-settings.mjs","names":["Rec","Arr","Str","Str","Arr","Rec","Names","Arr","Rec","Arr","Rec","Arr"],"sources":["../src/entities/workspace/model/locked-closures.ts","../src/entities/workspace/model/locked-closure-files.ts","../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, String as Str, pipe } from \"effect\";\n\nimport { reachable } from \"#/shared/lib/reachable.ts\";\nimport type { Edges } from \"#/shared/lib/reachable.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { depPathsOf } from \"./locked-graph.ts\";\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { linkedPaths } from \"./locked-links.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\ntype LockedClosures = Readonly<Record<string, readonly string[]>>;\n\nconst IMPORTER = \"importer:\";\nconst ROOT_IMPORTER = \".\";\n\ntype Sections = readonly (ResolvedDependencies | undefined)[];\ntype Edge = readonly [string, readonly string[]];\n\ninterface Used {\n readonly dependencies?: ResolvedDependencies | undefined;\n readonly optionalDependencies?: ResolvedDependencies | undefined;\n}\n\ninterface Importer {\n readonly id: string;\n readonly own: readonly string[];\n readonly used: readonly string[];\n}\n\nconst usedSections = ({ dependencies, optionalDependencies }: Used): Sections => [\n dependencies,\n optionalDependencies,\n];\n\nconst packageEdges = <Package extends string>(\n packages: Readonly<Record<Package, Used>>,\n): readonly Edge[] =>\n pipe(\n Rec.toEntries(packages),\n Arr.map(([id, snapshot]): Edge => [id, pipe(usedSections(snapshot), Arr.flatMap(depPathsOf))]),\n );\n\nconst closureOf =\n (edges: Edges) =>\n ({ own }: Importer): readonly string[] => {\n const packages = pipe(\n reachable(edges, own),\n Arr.filter((id) => !Str.startsWith(IMPORTER)(id)),\n );\n return Arr.sort(packages, Str.Order);\n };\n\n/** @internal */\nexport const lockedClosures = Effect.fn(\"lockedClosures\")(function* lockedClosures(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const nodesOf = (id: string, sections: Sections): readonly string[] => [\n ...pipe(sections, Arr.flatMap(depPathsOf)),\n ...pipe(\n linkedPaths(sections),\n Arr.map((path) => files.relative(root, files.join(root, id, path))),\n Arr.map(\n (linked) =>\n `${IMPORTER}${Option.getOrElse(Option.liftPredicate(linked, Str.isNonEmpty), () => ROOT_IMPORTER)}`,\n ),\n ),\n ];\n return pipe(\n lockfile,\n Option.map(({ importers, packages }): LockedClosures => {\n const found = pipe(\n Rec.toEntries(importers),\n Arr.map(([id, project]): Importer => {\n const used = usedSections(project);\n return {\n id,\n own: nodesOf(id, [...used, project.devDependencies]),\n used: nodesOf(id, used),\n };\n }),\n );\n const edges = Rec.fromEntries([\n ...pipe(\n found,\n Arr.map(({ id, used }): Edge => [`${IMPORTER}${id}`, used]),\n ),\n ...packageEdges(packages ?? {}),\n ]);\n return Rec.fromEntries(\n pipe(\n found,\n Arr.map((importer) => [importer.id, closureOf(edges)(importer)] as const),\n ),\n );\n }),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { CLOSURE_FILE, FINGERPRINT_FILE, LOCK_FILE } from \"#/shared/lib/locked-closure-paths.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { lockedClosures } from \"./locked-closures.ts\";\n\nconst LINE = \"\\n\";\nconst FILE_CONCURRENCY = 16;\n\nconst writeChanged = Effect.fn(\"writeChanged\")(function* writeChanged(file: string, text: string) {\n const files = yield* RepositoryFiles;\n const written = yield* files.readFile(file);\n if (!Option.exists(written, (found) => found === text)) {\n yield* files.writeFile(file, text);\n }\n});\n\nconst isWritten = Effect.fn(\"isWritten\")(function* isWritten(root: string, fingerprint: string) {\n const files = yield* RepositoryFiles;\n const recorded = yield* files.readFile(files.join(root, FINGERPRINT_FILE));\n const [hash, ...importers] = Str.split(\n Option.getOrElse(recorded, () => \"\"),\n LINE,\n );\n if (hash !== fingerprint) {\n return false;\n }\n const present = yield* Effect.forEach(\n importers,\n (importer) => files.exists(files.join(root, importer, CLOSURE_FILE)),\n { concurrency: FILE_CONCURRENCY },\n );\n return pipe(present, Arr.every(Boolean));\n});\n\nconst writeAll = Effect.fn(\"writeAll\")(function* writeAll(root: string, fingerprint: string) {\n const files = yield* RepositoryFiles;\n const closures = yield* lockedClosures(root);\n const entries = Rec.toEntries(Option.getOrElse(closures, () => ({})));\n yield* Effect.forEach(\n entries,\n ([importer, closure]) =>\n writeChanged(files.join(root, importer, CLOSURE_FILE), Arr.join(closure, LINE)),\n { concurrency: FILE_CONCURRENCY, discard: true },\n );\n const importers = pipe(\n entries,\n Arr.map(([importer]) => importer),\n );\n yield* files.writeFile(\n files.join(root, FINGERPRINT_FILE),\n Arr.join([fingerprint, ...importers], LINE),\n );\n});\n\n/** @internal */\nexport const writeLockedClosures = Effect.fn(\"writeLockedClosures\")(function* writeLockedClosures(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const fingerprint = yield* files.hashFile(files.join(root, LOCK_FILE));\n if (Option.isNone(fingerprint)) {\n return;\n }\n const written = yield* isWritten(root, fingerprint.value);\n if (!written) {\n yield* writeAll(root, fingerprint.value);\n }\n});\n","import { Array as Arr, Effect, Option, 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.String.pipe(Schema.Array, Schema.optional);\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.String.pipe(Schema.Array, Schema.optional);\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: WorkspaceOverride.pipe(Schema.Array, Schema.optional),\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":";;;;;;;AAaA,MAAM,WAAW;AACjB,MAAM,gBAAgB;AAgBtB,MAAM,gBAAgB,EAAE,cAAc,2BAA2C,CAC/E,cACA,oBACF;AAEA,MAAM,gBACJ,aAEA,KACEA,OAAI,UAAU,QAAQ,GACtBC,MAAI,KAAK,CAAC,IAAI,cAAoB,CAAC,IAAI,KAAK,aAAa,QAAQ,GAAGA,MAAI,QAAQ,UAAU,CAAC,CAAC,CAAC,CAC/F;AAEF,MAAM,aACH,WACA,EAAE,UAAuC;CACxC,MAAM,WAAW,KACf,UAAU,OAAO,GAAG,GACpBA,MAAI,QAAQ,OAAO,CAACC,OAAI,WAAW,QAAQ,CAAC,CAAC,EAAE,CAAC,CAClD;CACA,OAAOD,MAAI,KAAK,UAAUC,OAAI,KA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I;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"}
|
|
1
|
+
{"version":3,"file":"workspace-settings.mjs","names":["READ_CONCURRENCY","Arr","Rec","Arr","Str","Str","Arr","Rec","Names","Arr","Rec","Arr","Rec","Arr"],"sources":["../src/entities/workspace/model/site-entries.ts","../src/entities/workspace/model/locked-closures.ts","../src/entities/workspace/model/locked-closure-files.ts","../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, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst READ_CONCURRENCY = 16;\nconst SCRIPT = /\\.[cm]?tsx?$/u;\nconst SKIPPED = /\\.test\\.|\\.d\\.[cm]?ts$/u;\nconst SERVER_ENTRY_IMPORT = /from\\s+[\"']@effect\\/ui\\/html\\/HtmlServerHttp[\"']/u;\n\nexport const siteEntries = Effect.fn(\"siteEntries\")(function* siteEntries(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const candidates = pipe(\n listed,\n Arr.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)),\n );\n const texts = yield* Effect.forEach(\n candidates,\n (file) => files.readFile(files.join(root, file)),\n { concurrency: READ_CONCURRENCY },\n );\n return pipe(\n Arr.zip(candidates, texts),\n Arr.filter(([, text]) => Option.exists(text, (value) => SERVER_ENTRY_IMPORT.test(value))),\n Arr.map(([file]) => file),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { reachable } from \"#/shared/lib/reachable.ts\";\nimport type { Edges } from \"#/shared/lib/reachable.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { depPathsOf } from \"./locked-graph.ts\";\nimport type { ResolvedDependencies } from \"./locked-graph.ts\";\nimport { linkedPaths } from \"./locked-links.ts\";\nimport { wantedLockfile } from \"./locked-packages.ts\";\n\ntype LockedClosures = Readonly<Record<string, readonly string[]>>;\n\nconst IMPORTER = \"importer:\";\nconst ROOT_IMPORTER = \".\";\n\ntype Sections = readonly (ResolvedDependencies | undefined)[];\ntype Edge = readonly [string, readonly string[]];\n\ninterface Used {\n readonly dependencies?: ResolvedDependencies | undefined;\n readonly optionalDependencies?: ResolvedDependencies | undefined;\n}\n\ninterface Importer {\n readonly id: string;\n readonly own: readonly string[];\n readonly used: readonly string[];\n}\n\nconst usedSections = ({ dependencies, optionalDependencies }: Used): Sections => [\n dependencies,\n optionalDependencies,\n];\n\nconst packageEdges = <Package extends string>(\n packages: Readonly<Record<Package, Used>>,\n): readonly Edge[] =>\n pipe(\n Rec.toEntries(packages),\n Arr.map(([id, snapshot]): Edge => [id, pipe(usedSections(snapshot), Arr.flatMap(depPathsOf))]),\n );\n\nconst closureOf =\n (edges: Edges) =>\n ({ own }: Importer): readonly string[] => {\n const packages = pipe(\n reachable(edges, own),\n Arr.filter((id) => !Str.startsWith(IMPORTER)(id)),\n );\n return Arr.sort(packages, Str.Order);\n };\n\n/** @internal */\nexport const lockedClosures = Effect.fn(\"lockedClosures\")(function* lockedClosures(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* wantedLockfile(root);\n const nodesOf = (id: string, sections: Sections): readonly string[] => [\n ...pipe(sections, Arr.flatMap(depPathsOf)),\n ...pipe(\n linkedPaths(sections),\n Arr.map((path) => files.relative(root, files.join(root, id, path))),\n Arr.map(\n (linked) =>\n `${IMPORTER}${Option.getOrElse(Option.liftPredicate(linked, Str.isNonEmpty), () => ROOT_IMPORTER)}`,\n ),\n ),\n ];\n return pipe(\n lockfile,\n Option.map(({ importers, packages }): LockedClosures => {\n const found = pipe(\n Rec.toEntries(importers),\n Arr.map(([id, project]): Importer => {\n const used = usedSections(project);\n return {\n id,\n own: nodesOf(id, [...used, project.devDependencies]),\n used: nodesOf(id, used),\n };\n }),\n );\n const edges = Rec.fromEntries([\n ...pipe(\n found,\n Arr.map(({ id, used }): Edge => [`${IMPORTER}${id}`, used]),\n ),\n ...packageEdges(packages ?? {}),\n ]);\n return Rec.fromEntries(\n pipe(\n found,\n Arr.map((importer) => [importer.id, closureOf(edges)(importer)] as const),\n ),\n );\n }),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { CLOSURE_FILE, FINGERPRINT_FILE, LOCK_FILE } from \"#/shared/lib/locked-closure-paths.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { lockedClosures } from \"./locked-closures.ts\";\n\nconst LINE = \"\\n\";\nconst FILE_CONCURRENCY = 16;\n\nconst writeChanged = Effect.fn(\"writeChanged\")(function* writeChanged(file: string, text: string) {\n const files = yield* RepositoryFiles;\n const written = yield* files.readFile(file);\n if (!Option.exists(written, (found) => found === text)) {\n yield* files.writeFile(file, text);\n }\n});\n\nconst isWritten = Effect.fn(\"isWritten\")(function* isWritten(root: string, fingerprint: string) {\n const files = yield* RepositoryFiles;\n const recorded = yield* files.readFile(files.join(root, FINGERPRINT_FILE));\n const [hash, ...importers] = Str.split(\n Option.getOrElse(recorded, () => \"\"),\n LINE,\n );\n if (hash !== fingerprint) {\n return false;\n }\n const present = yield* Effect.forEach(\n importers,\n (importer) => files.exists(files.join(root, importer, CLOSURE_FILE)),\n { concurrency: FILE_CONCURRENCY },\n );\n return pipe(present, Arr.every(Boolean));\n});\n\nconst writeAll = Effect.fn(\"writeAll\")(function* writeAll(root: string, fingerprint: string) {\n const files = yield* RepositoryFiles;\n const closures = yield* lockedClosures(root);\n const entries = Rec.toEntries(Option.getOrElse(closures, () => ({})));\n yield* Effect.forEach(\n entries,\n ([importer, closure]) =>\n writeChanged(files.join(root, importer, CLOSURE_FILE), Arr.join(closure, LINE)),\n { concurrency: FILE_CONCURRENCY, discard: true },\n );\n const importers = pipe(\n entries,\n Arr.map(([importer]) => importer),\n );\n yield* files.writeFile(\n files.join(root, FINGERPRINT_FILE),\n Arr.join([fingerprint, ...importers], LINE),\n );\n});\n\n/** @internal */\nexport const writeLockedClosures = Effect.fn(\"writeLockedClosures\")(function* writeLockedClosures(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const fingerprint = yield* files.hashFile(files.join(root, LOCK_FILE));\n if (Option.isNone(fingerprint)) {\n return;\n }\n const written = yield* isWritten(root, fingerprint.value);\n if (!written) {\n yield* writeAll(root, fingerprint.value);\n }\n});\n","import { Array as Arr, Effect, Option, 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.String.pipe(Schema.Array, Schema.optional);\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 siteEntries,\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.String.pipe(Schema.Array, Schema.optional);\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: WorkspaceOverride.pipe(Schema.Array, Schema.optional),\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 readonly siteEntries: 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 siteEntries: yield* siteEntries(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":";;;;;;;AAIA,MAAMA,qBAAmB;AACzB,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,sBAAsB;AAE5B,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,OAAO,MAAM,YAAY,IAAI;CAC5C,MAAM,aAAa,KACjB,QACAC,MAAI,QAAQ,SAAS,OAAO,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAC/D;CACA,MAAM,QAAQ,OAAO,OAAO,QAC1B,aACC,SAAS,MAAM,SAAS,MAAM,KAAK,MAAM,IAAI,CAAC,GAC/C,EAAE,aAAaD,mBAAiB,CAClC;CACA,OAAO,KACLC,MAAI,IAAI,YAAY,KAAK,GACzBA,MAAI,QAAQ,GAAG,UAAU,OAAO,OAAO,OAAO,UAAU,oBAAoB,KAAK,KAAK,CAAC,CAAC,GACxFA,MAAI,KAAK,CAAC,UAAU,IAAI,CAC1B;AACF,CAAC;;ACbD,MAAM,WAAW;AACjB,MAAM,gBAAgB;AAgBtB,MAAM,gBAAgB,EAAE,cAAc,2BAA2C,CAC/E,cACA,oBACF;AAEA,MAAM,gBACJ,aAEA,KACEC,OAAI,UAAU,QAAQ,GACtBC,MAAI,KAAK,CAAC,IAAI,cAAoB,CAAC,IAAI,KAA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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;GAChD,aAAa,OAAO,YAAY,QAAQ,IAAI;EAC9C;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.65.
|
|
3
|
+
"version": "0.65.1",
|
|
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",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@r_masseater/textlint-rule-preset-ja": "^0.2.1",
|
|
106
106
|
"@r_masseater/vite-plus-adopt": "^0.14.0",
|
|
107
107
|
"@r_masseater/wism": "^0.4.0",
|
|
108
|
-
"@r_masseater/y8": "^0.
|
|
108
|
+
"@r_masseater/y8": "^0.5.0",
|
|
109
109
|
"@shadcn/lint": "^0.2.5",
|
|
110
110
|
"@tanstack/intent": "^0.5.6",
|
|
111
111
|
"@textlint-ja/textlint-rule-preset-ai-writing": "^1.7.2",
|
|
@@ -117,24 +117,21 @@
|
|
|
117
117
|
"htmlparser2": "^12.0.0",
|
|
118
118
|
"modern-web-guidance": "^1.0.2",
|
|
119
119
|
"oxlint-plugin-eslint": "^1.95.0",
|
|
120
|
-
"remark-parse": "^11.0.0",
|
|
121
120
|
"semver": "^7.8.6",
|
|
122
121
|
"sql-parser-cst": "^0.45.0",
|
|
123
122
|
"synckit": "^0.12.3",
|
|
124
123
|
"textlint-rule-preset-ja-technical-writing": "^12.1.0",
|
|
125
124
|
"toml-eslint-parser": "^1.0.3",
|
|
126
|
-
"unified": "^11.0.5",
|
|
127
|
-
"unist-util-visit": "^5.2.0",
|
|
128
125
|
"yaml": "^2.9.1"
|
|
129
126
|
},
|
|
130
127
|
"devDependencies": {
|
|
131
128
|
"@effect/tsgo": "0.73.7",
|
|
132
129
|
"@effect/vitest": "4.1.5",
|
|
130
|
+
"@masseater.dev/lint-host": "0.0.0",
|
|
133
131
|
"@masseater.dev/path-kit": "0.0.0",
|
|
134
132
|
"@r_masseater/github-workflow": "0.1.1",
|
|
135
133
|
"@r_masseater/node-main": "0.1.0",
|
|
136
134
|
"@r_masseater/vitest-otlp": "0.2.2",
|
|
137
|
-
"@types/mdast": "4.0.4",
|
|
138
135
|
"@types/node": "26.6.10",
|
|
139
136
|
"@types/semver": "7.8.0",
|
|
140
137
|
"effect": "4.1.5",
|
|
@@ -39,9 +39,9 @@ For a met condition, remove the entry and its patch file and run verify. If veri
|
|
|
39
39
|
|
|
40
40
|
## Reference links
|
|
41
41
|
|
|
42
|
-
A Markdown link whose destination is `github:<owner>/<repo>[/<path>][#<symbol>]` or `npm:<package
|
|
42
|
+
A Markdown link whose destination is `github:<owner>/<repo>[/<path>][#<symbol>]` or `npm:<package>[@<version>]` points at a source. The version is an exact version or a dist-tag, not a range. The `docs/source-reference` rule of the y8 markdown check reports a destination in a form that cannot be looked up. A link to a path of a branch on github.com (`https://github.com/<owner>/<repo>/blob/<branch>/<path>`) is checked as the same kind of pointer, so a README can keep a link that readers can click.
|
|
43
43
|
|
|
44
|
-
Run `vp exec msch-refs` at the repository root to look each target up on GitHub and npm. It reports a repository that moved or was archived, a path or symbol that is gone and a deprecated
|
|
44
|
+
Run `vp exec msch-refs` at the repository root to look each target up on GitHub and npm. It reports a repository that moved or was archived, a path or symbol that is gone, a package or version that is not published and a deprecated version, and exits with 1 when it finds one or cannot check one. `--json` prints the results as JSON. The root `daily` task runs it, and a private repository needs `GH_TOKEN` to be readable.
|
|
45
45
|
|
|
46
46
|
## Git hooks
|
|
47
47
|
|
|
@@ -22,6 +22,8 @@ Every release is manual. Nothing publishes on a push to main, and msch reports r
|
|
|
22
22
|
2. Merge the PR.
|
|
23
23
|
3. Dispatch the `publish` workflow on main with the workspace directory, such as `libs/y8` or `apps/yakusu`.
|
|
24
24
|
|
|
25
|
+
When the release adds a check or makes one stricter, run it against the latest main of masseater.dev, skills, personal-space and mirucord before dispatching, and confirm that it reports nothing that those repositories legitimately do. Count usage in a current checkout of each repository, because an old checkout hides what the newest commits added; 0.64.0 wrongly forbade `@stability` and `oxlint-disable` that way. When the release removes an allowance, grep every one of the four for the removed entry first.
|
|
26
|
+
|
|
25
27
|
An AI agent dispatches the `publish` workflow itself once the version bump is on main, without asking the owner first. The owner's repositories are set up so that a release an agent starts on its own does no harm.
|
|
26
28
|
|
|
27
29
|
A version that is already on npm or already has a GitHub Release with assets is skipped, so dispatching twice is safe. A version that is published but has no tag, including an older version, gets its tag on the next dispatch, on the commit its npm provenance names. The tag is created with a GitHub token from the credential broker when the broker grants one, because the workflow token cannot tag a commit that changes `.github/workflows`. A package whose `workspace:` dependencies are not on npm at their current versions is refused; publish those first.
|