@r_masseater/msch 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1027 -824
- package/dist/cli.mjs.map +1 -1
- package/dist/{comment-directives-DApQXgQf.mjs → comment-directives-TN0dNEbg.mjs} +2 -2
- package/dist/comment-directives-TN0dNEbg.mjs.map +1 -0
- package/dist/decision-rules.mjs +1 -1
- package/dist/decision-rules.mjs.map +1 -1
- package/dist/inline-exports.d.mts +2 -2
- package/dist/inline-exports.mjs +7 -7
- package/dist/inline-exports.mjs.map +1 -1
- package/dist/lint.mjs +9 -9
- package/dist/lint.mjs.map +1 -1
- package/dist/oxlint.mjs +3 -3
- package/dist/oxlint.mjs.map +1 -1
- package/dist/{cli-contract-c3l4AjvJ.mjs → problem-BeBSq75T.mjs} +11 -7
- package/dist/problem-BeBSq75T.mjs.map +1 -0
- package/dist/repository-files-CfhXZQrO.mjs +55 -0
- package/dist/repository-files-CfhXZQrO.mjs.map +1 -0
- package/dist/{workspace-tasks-DqSpU9ij.mjs → workspace-jN1GGTGn.mjs} +196 -39
- package/dist/workspace-jN1GGTGn.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +8 -8
- package/dist/workspace-settings.mjs +5 -17
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +6 -3
- package/dist/cli-contract-c3l4AjvJ.mjs.map +0 -1
- package/dist/comment-directives-DApQXgQf.mjs.map +0 -1
- package/dist/dependencies-CVEeDVp2.mjs +0 -187
- package/dist/dependencies-CVEeDVp2.mjs.map +0 -1
- package/dist/workspace-tasks-DqSpU9ij.mjs.map +0 -1
- /package/src/{vite.d.ts → app/vite.d.ts} +0 -0
package/dist/oxlint.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.mjs","names":["Arr"],"sources":["../src/oxlint-rule.ts","../src/oxlint.ts"],"sourcesContent":["import { Array as Arr, pipe } from \"effect\";\nimport type { Diagnostic, Plugin, Rule } from \"vite-plus/lint/plugins\";\n\nimport { describeFinding } from \"
|
|
1
|
+
{"version":3,"file":"oxlint.mjs","names":["Arr"],"sources":["../src/features/oxlint-plugin/model/oxlint-rule.ts","../src/app/oxlint.ts"],"sourcesContent":["import { Array as Arr, pipe } from \"effect\";\nimport type { Diagnostic, Plugin, Rule } from \"vite-plus/lint/plugins\";\n\nimport { describeFinding } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { POSITION_BASE } from \"#/shared/lib/syntax.ts\";\n\nexport type ProblemLoader = (cwd: string) => readonly Problem[];\n\nconst diagnosticOf = (problem: Problem): Diagnostic => ({\n message: describeFinding(problem),\n loc: { start: { line: problem.line, column: problem.column - POSITION_BASE } },\n});\n\nconst vocabularyRule = (load: ProblemLoader): Rule => ({\n create: (context) => ({\n Program: () => {\n const problems = pipe(\n load(context.cwd),\n Arr.filter((problem) => problem.file === context.filename),\n );\n for (const problem of problems) {\n context.report(diagnosticOf(problem));\n }\n },\n }),\n});\n\nexport const mschPlugin = (load: ProblemLoader): Plugin & { rules: { vocabulary: Rule } } => ({\n meta: { name: \"msch\" },\n rules: { vocabulary: vocabularyRule(load) },\n});\n","import { execFileSync } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { Option, Schema } from \"effect\";\n\nimport { mschPlugin } from \"#/features/oxlint-plugin/index.ts\";\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { ProblemList } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\n\nconst CLI_PATH = fileURLToPath(import.meta.resolve(\"@r_masseater/msch/cli\"));\nconst decodeProblems = Schema.decodeUnknownSync(Schema.fromJsonString(ProblemList));\nconst loaded = new Map<string, readonly Problem[]>();\n\nconst runCli = (cwd: string): readonly Problem[] =>\n decodeProblems(\n execFileSync(process.execPath, [CLI_PATH, JSON_FLAG], {\n cwd,\n encoding: \"utf8\",\n maxBuffer: Number.MAX_SAFE_INTEGER,\n }),\n );\n\nconst loadProblems = (cwd: string): readonly Problem[] =>\n Option.fromUndefinedOr(loaded.get(cwd)).pipe(\n Option.getOrElse(() => {\n const problems = runCli(cwd);\n loaded.set(cwd, problems);\n return problems;\n }),\n );\n\nexport default mschPlugin(loadProblems);\n"],"mappings":";;;;;AASA,MAAM,gBAAgB,aAAkC;CACtD,SAAS,gBAAgB,OAAO;CAChC,KAAK,EAAE,OAAO;EAAE,MAAM,QAAQ;EAAM,QAAQ,QAAQ,SAAA;CAAuB,EAAE;AAC/E;AAEA,MAAM,kBAAkB,UAA+B,EACrD,SAAS,aAAa,EACpB,eAAe;CACb,MAAM,WAAW,KACf,KAAK,QAAQ,GAAG,GAChBA,MAAI,QAAQ,YAAY,QAAQ,SAAS,QAAQ,QAAQ,CAC3D;CACA,KAAK,MAAM,WAAW,UACpB,QAAQ,OAAO,aAAa,OAAO,CAAC;AAExC,EACF,GACF;AAEA,MAAa,cAAc,UAAmE;CAC5F,MAAM,EAAE,MAAM,OAAO;CACrB,OAAO,EAAE,YAAY,eAAe,IAAI,EAAE;AAC5C;;ACrBA,MAAM,WAAW,cAAc,YAAY,QAAQ,uBAAuB,CAAC;AAC3E,MAAM,iBAAiB,OAAO,kBAAkB,OAAO,eAAe,WAAW,CAAC;AAClF,MAAM,yBAAS,IAAI,IAAgC;AAEnD,MAAM,UAAU,QACd,eACE,aAAa,QAAQ,UAAU,CAAC,UAAU,SAAS,GAAG;CACpD;CACA,UAAU;CACV,WAAW,OAAO;AACpB,CAAC,CACH;AAEF,MAAM,gBAAgB,QACpB,OAAO,gBAAgB,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,KACtC,OAAO,gBAAgB;CACrB,MAAM,WAAW,OAAO,GAAG;CAC3B,OAAO,IAAI,KAAK,QAAQ;CACxB,OAAO;AACT,CAAC,CACH;AAEF,IAAA,iBAAe,WAAW,YAAY"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as NODE_MODULES } from "./repository-files-CfhXZQrO.mjs";
|
|
2
2
|
import { Array, Option, Order, Schema, String as String$1, pipe } from "effect";
|
|
3
3
|
import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
|
|
4
4
|
import { isArrayLiteralExpression, isBinaryExpression, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportDeclaration, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
|
|
5
5
|
import { API, IndexKind } from "typescript/sync";
|
|
6
|
-
// src/
|
|
6
|
+
// src/shared/lib/cli-contract.ts
|
|
7
|
+
const JSON_FLAG = "--json";
|
|
8
|
+
// src/shared/lib/syntax.ts
|
|
7
9
|
const NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;
|
|
8
10
|
const uniqueByReference = (items) => Array.dedupeWith(items, (left, right) => left === right);
|
|
9
11
|
const childrenOf = (node) => {
|
|
@@ -53,7 +55,7 @@ const moduleSpecifierOf = (statement) => {
|
|
|
53
55
|
return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter((specifier) => isStringLiteral(specifier)), Option.map((specifier) => specifier.text));
|
|
54
56
|
};
|
|
55
57
|
const importedModulesOf = (sourceFile) => pipe(sourceFile.statements, Array.map((statement) => moduleSpecifierOf(statement)), Array.getSomes);
|
|
56
|
-
// src/problem.ts
|
|
58
|
+
// src/shared/lib/problem.ts
|
|
57
59
|
const RuleNameSchema = Schema.Literals([
|
|
58
60
|
"owner-annotation",
|
|
59
61
|
"duplicate-value-set",
|
|
@@ -67,6 +69,9 @@ const RuleNameSchema = Schema.Literals([
|
|
|
67
69
|
"hidden-unicode",
|
|
68
70
|
"python-file",
|
|
69
71
|
"python-command",
|
|
72
|
+
"unneeded-file",
|
|
73
|
+
"unneeded-setup",
|
|
74
|
+
"cargo-outside-pnpm",
|
|
70
75
|
"nested-docs",
|
|
71
76
|
"root-readme",
|
|
72
77
|
"stack-dependency",
|
|
@@ -74,6 +79,7 @@ const RuleNameSchema = Schema.Literals([
|
|
|
74
79
|
"unverified-crate",
|
|
75
80
|
"hidden-verify",
|
|
76
81
|
"root-workspace-path",
|
|
82
|
+
"shared-uncached-task",
|
|
77
83
|
"colocated-test",
|
|
78
84
|
"comment"
|
|
79
85
|
]);
|
|
@@ -109,8 +115,6 @@ const problemKey = (problem) => pipe([
|
|
|
109
115
|
const sortProblems = (problems) => Array.sort(Array.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)), problemOrder);
|
|
110
116
|
const describeFinding = (problem) => `[${problem.rule}] ${problem.message}`;
|
|
111
117
|
const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;
|
|
112
|
-
|
|
113
|
-
const JSON_FLAG = "--json";
|
|
114
|
-
export { isTypeAliasDeclaration as $, getTextOfJSDocComment as A, isInterfaceDeclaration as B, API as C, getJSDocTags as D, SyntaxKind as E, isElementAccessExpression as F, isObjectLiteralExpression as G, isModuleDeclaration as H, isEnumDeclaration as I, isSatisfiesExpression as J, isPropertyAccessExpression as K, isExportDeclaration as L, isBinaryExpression as M, isCallExpression as N, getLeadingCommentRanges as O, isClassDeclaration as P, isStringLiteral as Q, isIdentifier as R, uniqueByReference as S, InternalSymbolName as T, isNewExpression as U, isModuleBlock as V, isNumericLiteral as W, isSourceFile as X, isSignatureDeclaration as Y, isSpreadElement as Z, lineOf as _, problemAt as a, isVariableStatement as at, resolvedSymbol as b, childrenOf as c, declarationsOf as d, isTypeLiteralNode as et, descendantsOf as f, isTypeDeclaration as g, isGenericDeclaration as h, formatProblem as i, isVariableDeclarationList as it, isArrayLiteralExpression as j, getNameOfDeclaration as k, columnOf as l, isExternalDeclaration as m, ProblemList as n, isUnionTypeNode as nt, sortProblems as o, importedModulesOf as p, isPropertyAssignment as q, describeFinding as r, isVariableDeclaration as rt, NODE_MODULES_SEGMENT as s, JSON_FLAG as t, isTypeReferenceNode as tt, contains as u, propertyNamesOf as v, IndexKind as w, symbolAt as x, referencedSymbols as y, isImportDeclaration as z };
|
|
118
|
+
export { isTypeLiteralNode as $, isArrayLiteralExpression as A, isModuleBlock as B, IndexKind as C, getLeadingCommentRanges as D, getJSDocTags as E, isEnumDeclaration as F, isPropertyAccessExpression as G, isNewExpression as H, isExportDeclaration as I, isSignatureDeclaration as J, isPropertyAssignment as K, isIdentifier as L, isCallExpression as M, isClassDeclaration as N, getNameOfDeclaration as O, isElementAccessExpression as P, isTypeAliasDeclaration as Q, isImportDeclaration as R, API as S, SyntaxKind as T, isNumericLiteral as U, isModuleDeclaration as V, isObjectLiteralExpression as W, isSpreadElement as X, isSourceFile as Y, isStringLiteral as Z, propertyNamesOf as _, sortProblems as a, JSON_FLAG as at, symbolAt as b, columnOf as c, descendantsOf as d, isTypeReferenceNode as et, importedModulesOf as f, lineOf as g, isTypeDeclaration as h, problemAt as i, isVariableStatement as it, isBinaryExpression as j, getTextOfJSDocComment as k, contains as l, isGenericDeclaration as m, describeFinding as n, isVariableDeclaration as nt, NODE_MODULES_SEGMENT as o, isExternalDeclaration as p, isSatisfiesExpression as q, formatProblem as r, isVariableDeclarationList as rt, childrenOf as s, ProblemList as t, isUnionTypeNode as tt, declarationsOf as u, referencedSymbols as v, InternalSymbolName as w, uniqueByReference as x, resolvedSymbol as y, isInterfaceDeclaration as z };
|
|
115
119
|
|
|
116
|
-
//# sourceMappingURL=
|
|
120
|
+
//# sourceMappingURL=problem-BeBSq75T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem-BeBSq75T.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/cli-contract.ts","../src/shared/lib/syntax.ts","../src/shared/lib/problem.ts"],"sourcesContent":["export const JSON_FLAG = \"--json\";\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\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\nexport const 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\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 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\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 isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\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 symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\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 isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\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","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"unneeded-file\",\n \"unneeded-setup\",\n \"cargo-outside-pnpm\",\n \"nested-docs\",\n \"root-readme\",\n \"stack-dependency\",\n \"install-size\",\n \"unverified-crate\",\n \"hidden-verify\",\n \"root-workspace-path\",\n \"shared-uncached-task\",\n \"colocated-test\",\n \"comment\",\n]);\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n"],"mappings":";;;;;;AAAA,MAAa,YAAY;;AC0BzB,MAAa,uBAAuB,IAAI,aAAa;AAIrD,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,MAAa,iBAAiB,SAC5B,KACE,WAAW,IAAI,GACfA,MAAI,SAAS,UAAUA,MAAI,QAAQ,cAAc,KAAK,GAAG,KAAK,CAAC,CACjE;AAEF,MAAM,kBACH,aACA,eACCC,SAAI,SAAS,oBAAoB,CAAC,CAAC,WAAW,QAAQ,KACtD,QAAQ,gCAAgC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CAC3B,MAAM,OAAO,IAAI;CACjB,QAAQ,SAAS,IAAI;CACrB;CACA;AACF;AAEF,MAAM,eAAqC,MAAM,WAAW;CAC1D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,MAAM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAa,gBAAgB,aAC3BA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAa,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAE1F,MAAa,iBACV,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Array, Context, Effect, FileSystem, Layer, Path, Stream, String, pipe } from "effect";
|
|
2
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
3
|
+
import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
|
|
4
|
+
// src/shared/lib/node-services.ts
|
|
5
|
+
/** @internal */
|
|
6
|
+
const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
|
|
7
|
+
// src/shared/lib/repository-files.ts
|
|
8
|
+
const MISSING_SIZE = 0;
|
|
9
|
+
const GENERATED_PATHSPEC = ":(attr:linguist-generated)";
|
|
10
|
+
const LISTED_ARGS = [
|
|
11
|
+
"--cached",
|
|
12
|
+
"--others",
|
|
13
|
+
"--exclude-standard"
|
|
14
|
+
];
|
|
15
|
+
const NODE_MODULES = "node_modules";
|
|
16
|
+
var RepositoryFiles = class extends Context.Service()("@r_masseater/msch/shared/lib/repository-files/RepositoryFiles") {};
|
|
17
|
+
const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* nodeRepositoryFiles() {
|
|
18
|
+
const fs = yield* FileSystem.FileSystem;
|
|
19
|
+
const path = yield* Path.Path;
|
|
20
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
21
|
+
const gitFiles = (root, args) => Effect.gen(function* listFiles() {
|
|
22
|
+
const listed = yield* (yield* ChildProcess.make("git", [
|
|
23
|
+
"ls-files",
|
|
24
|
+
"-z",
|
|
25
|
+
...args
|
|
26
|
+
], {
|
|
27
|
+
cwd: root,
|
|
28
|
+
stdin: "ignore"
|
|
29
|
+
})).stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
30
|
+
return pipe(String.split(listed, "\0"), Array.filter(String.isNonEmpty));
|
|
31
|
+
}).pipe(Effect.scoped, Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), Effect.orElseSucceed(() => []));
|
|
32
|
+
return RepositoryFiles.of({
|
|
33
|
+
generatedFiles: (root) => gitFiles(root, ["--", GENERATED_PATHSPEC]).pipe(Effect.map(Array.map((file) => path.join(root, file)))),
|
|
34
|
+
listedFiles: (root) => gitFiles(root, LISTED_ARGS),
|
|
35
|
+
matchingFiles: (root, pathspecs) => gitFiles(root, [
|
|
36
|
+
...LISTED_ARGS,
|
|
37
|
+
"--",
|
|
38
|
+
...pathspecs
|
|
39
|
+
]),
|
|
40
|
+
readFile: (file) => fs.readFileString(file).pipe(Effect.option),
|
|
41
|
+
exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),
|
|
42
|
+
realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),
|
|
43
|
+
readDirectory: (directory) => fs.readDirectory(directory).pipe(Effect.orElseSucceed(() => [])),
|
|
44
|
+
isDirectory: (file) => fs.stat(file).pipe(Effect.map((info) => info.type === "Directory"), Effect.option),
|
|
45
|
+
fileSize: (file) => fs.stat(file).pipe(Effect.map((info) => Number(info.size)), Effect.orElseSucceed(() => MISSING_SIZE)),
|
|
46
|
+
join: (...segments) => path.join(...segments),
|
|
47
|
+
resolve: (...segments) => path.resolve(...segments),
|
|
48
|
+
relative: (from, to) => path.relative(from, to),
|
|
49
|
+
dirname: (file) => path.dirname(file),
|
|
50
|
+
basename: (file) => path.basename(file)
|
|
51
|
+
});
|
|
52
|
+
})).pipe(Layer.provide(nodeServicesLayer));
|
|
53
|
+
export { nodeServicesLayer as i, RepositoryFiles as n, nodeRepositoryFiles as r, NODE_MODULES as t };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=repository-files-CfhXZQrO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-files-CfhXZQrO.mjs","names":["Str","Arr"],"sources":["../src/shared/lib/node-services.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { Layer } from \"effect\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n","import {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { Option } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeServicesLayer } from \"./node-services.ts\";\n\nconst MISSING_SIZE = 0;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\"];\n\nexport const NODE_MODULES = \"node_modules\";\n\nexport class RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly matchingFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/shared/lib/repository-files/RepositoryFiles\") {}\n\nexport const nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitFiles = (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n Effect.gen(function* listFiles() {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", ...args], {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n listedFiles: (root) => gitFiles(root, LISTED_ARGS),\n matchingFiles: (root, pathspecs) => gitFiles(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer));\n"],"mappings":";;;;;AASA,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;;ACIA,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,cAAc;CAAC;CAAY;CAAY;AAAoB;AAEjE,MAAa,eAAe;AAE5B,IAAa,kBAAb,cAAqC,QAAQ,QAqB3C,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAEtE,MAAa,sBAAsB,MAAM,OACvC,iBACA,OAAO,IAAI,UAAU,sBAAsB;CACzC,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,YAAY,MAAc,SAC9B,OAAO,IAAI,UAAU,YAAY;EAK/B,MAAM,SAAS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,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,144 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Array, Effect, Match, Option, Predicate, Record, Schema, String, pipe } from "effect";
|
|
1
|
+
import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-CfhXZQrO.mjs";
|
|
2
|
+
import { Array, Effect, Match, Option, Order, Predicate, Record, Schema, String, pipe } from "effect";
|
|
3
3
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
4
4
|
import { parse as parse$1 } from "yaml";
|
|
5
|
-
// src/
|
|
5
|
+
// src/entities/package/model/dependencies.ts
|
|
6
|
+
const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
|
|
7
|
+
const PackageManifest = Schema.Struct({
|
|
8
|
+
name: Schema.optional(Schema.String),
|
|
9
|
+
dependencies: DependencyMap,
|
|
10
|
+
devDependencies: DependencyMap,
|
|
11
|
+
peerDependencies: DependencyMap,
|
|
12
|
+
exports: Schema.optional(Schema.Unknown),
|
|
13
|
+
types: Schema.optional(Schema.String),
|
|
14
|
+
typings: Schema.optional(Schema.String),
|
|
15
|
+
main: Schema.optional(Schema.String)
|
|
16
|
+
});
|
|
17
|
+
const MANIFEST_FILE$1 = "package.json";
|
|
18
|
+
const WORKSPACE_PROTOCOL = "workspace:";
|
|
19
|
+
const ROOT_SUBPATH$1 = ".";
|
|
20
|
+
const SUBPATH_PREFIX = "./";
|
|
21
|
+
const WILDCARD = "*";
|
|
22
|
+
const TYPES_CONDITION = "types";
|
|
23
|
+
const TYPES_SCOPE = "@types/";
|
|
24
|
+
const TYPES_SCOPE_SEPARATOR = "__";
|
|
25
|
+
const CONDITION_DEPTH_LIMIT = 8;
|
|
26
|
+
const ROOT_DEPTH = 0;
|
|
27
|
+
const DEPTH_STEP = 1;
|
|
28
|
+
const DECLARATIONS_SUFFIX = /\.d\.[cm]?ts$|\.[cm]?tsx?$/u;
|
|
29
|
+
const SCRIPT_SUFFIX = /\.(?<module>[cm]?)js$/u;
|
|
30
|
+
const readManifest = Effect.fn("readManifest")(function* readManifest(directory) {
|
|
31
|
+
const files = yield* RepositoryFiles;
|
|
32
|
+
const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE$1));
|
|
33
|
+
const text = yield* Effect.fromOption(manifestText);
|
|
34
|
+
return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);
|
|
35
|
+
}, Effect.option);
|
|
36
|
+
const conditionsOf = (held) => {
|
|
37
|
+
if (!Predicate.isObject(held)) return [];
|
|
38
|
+
return Record.toEntries(held);
|
|
39
|
+
};
|
|
40
|
+
const typesConditionIn = (held, depth) => {
|
|
41
|
+
if (depth > CONDITION_DEPTH_LIMIT) return Option.none();
|
|
42
|
+
const entries = conditionsOf(held);
|
|
43
|
+
const declared = Array.findFirst(entries, ([condition, target]) => Option.liftPredicate(target, (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate))).pipe(Option.filter(Predicate.isString));
|
|
44
|
+
return Option.orElse(declared, () => Array.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)));
|
|
45
|
+
};
|
|
46
|
+
const anyConditionIn = (held, depth) => {
|
|
47
|
+
if (Predicate.isString(held)) return Option.some(held);
|
|
48
|
+
if (depth > CONDITION_DEPTH_LIMIT) return Option.none();
|
|
49
|
+
return Array.findFirst(conditionsOf(held), ([, nested]) => anyConditionIn(nested, depth + DEPTH_STEP));
|
|
50
|
+
};
|
|
51
|
+
const targetPathsOf = (target) => Array.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);
|
|
52
|
+
const subpathTargetsOf = (exportsField) => {
|
|
53
|
+
if (Predicate.isString(exportsField)) return [{
|
|
54
|
+
subpath: ROOT_SUBPATH$1,
|
|
55
|
+
target: exportsField
|
|
56
|
+
}];
|
|
57
|
+
const entries = conditionsOf(exportsField);
|
|
58
|
+
if (!pipe(entries, Array.some(([subpath]) => String.startsWith(ROOT_SUBPATH$1)(subpath)))) return Array.match(entries, {
|
|
59
|
+
onEmpty: () => [],
|
|
60
|
+
onNonEmpty: () => [{
|
|
61
|
+
subpath: ROOT_SUBPATH$1,
|
|
62
|
+
target: exportsField
|
|
63
|
+
}]
|
|
64
|
+
});
|
|
65
|
+
return pipe(entries, Array.filter(([subpath]) => subpath === ROOT_SUBPATH$1 || String.startsWith(SUBPATH_PREFIX)(subpath)), Array.filter(([subpath]) => !String.includes(WILDCARD)(subpath)), Array.map(([subpath, target]) => ({
|
|
66
|
+
subpath,
|
|
67
|
+
target
|
|
68
|
+
})));
|
|
69
|
+
};
|
|
70
|
+
const declarationsCandidateFor = (entryPath) => {
|
|
71
|
+
if (DECLARATIONS_SUFFIX.test(entryPath)) return Option.some(entryPath);
|
|
72
|
+
if (!SCRIPT_SUFFIX.test(entryPath)) return Option.none();
|
|
73
|
+
return Option.some(String.replace(SCRIPT_SUFFIX, ".d.$<module>ts")(entryPath));
|
|
74
|
+
};
|
|
75
|
+
const firstDeclarationsAmong = Effect.fn("firstDeclarationsAmong")(function* firstDeclarations(directory, entryPaths) {
|
|
76
|
+
const files = yield* RepositoryFiles;
|
|
77
|
+
const candidates = Array.getSomes(pipe(entryPaths, Array.map((entryPath) => declarationsCandidateFor(entryPath))));
|
|
78
|
+
const existing = yield* Effect.filter(pipe(candidates, Array.map((candidate) => files.join(directory, candidate))), (candidate) => files.exists(candidate));
|
|
79
|
+
return yield* Option.match(Array.head(existing), {
|
|
80
|
+
onNone: () => Effect.succeedNone,
|
|
81
|
+
onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome)
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
const importNameOf = (packageName) => {
|
|
85
|
+
if (!String.startsWith(TYPES_SCOPE)(packageName)) return packageName;
|
|
86
|
+
const unscoped = String.slice(7)(packageName);
|
|
87
|
+
if (!String.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) return unscoped;
|
|
88
|
+
return `@${String.replace(TYPES_SCOPE_SEPARATOR, "/")(unscoped)}`;
|
|
89
|
+
};
|
|
90
|
+
const specifierFor = (packageName, subpath) => {
|
|
91
|
+
const importName = importNameOf(packageName);
|
|
92
|
+
if (subpath === ROOT_SUBPATH$1) return importName;
|
|
93
|
+
return `${importName}/${String.slice(2)(subpath)}`;
|
|
94
|
+
};
|
|
95
|
+
const rootEntryPaths = (manifest) => Array.getSomes([
|
|
96
|
+
Option.fromUndefinedOr(manifest.types),
|
|
97
|
+
Option.fromUndefinedOr(manifest.typings),
|
|
98
|
+
Option.fromUndefinedOr(manifest.main)
|
|
99
|
+
]);
|
|
100
|
+
const subpathEntriesOf = Effect.fn("subpathEntriesOf")(function* subpathEntriesOf(packageName, directory, manifest) {
|
|
101
|
+
const found = yield* Effect.forEach(subpathTargetsOf(manifest.exports), ({ subpath, target }) => firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(Effect.map(Option.map((declarationsPath) => ({
|
|
102
|
+
packageName,
|
|
103
|
+
specifier: specifierFor(packageName, subpath),
|
|
104
|
+
declarationsPath
|
|
105
|
+
})))));
|
|
106
|
+
return Array.getSomes(found);
|
|
107
|
+
});
|
|
108
|
+
const entriesOfDependency = Effect.fn("entriesOfDependency")(function* entriesOfDependency(packageName, directory) {
|
|
109
|
+
const manifest = yield* readManifest(directory);
|
|
110
|
+
if (Option.isNone(manifest)) return [];
|
|
111
|
+
const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);
|
|
112
|
+
const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH$1);
|
|
113
|
+
if (pipe(subpathEntries, Array.some((entry) => entry.specifier === rootSpecifier))) return subpathEntries;
|
|
114
|
+
return [...(yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value))).pipe(Option.map((declarationsPath) => ({
|
|
115
|
+
packageName,
|
|
116
|
+
specifier: rootSpecifier,
|
|
117
|
+
declarationsPath
|
|
118
|
+
})), Option.toArray), ...subpathEntries];
|
|
119
|
+
});
|
|
120
|
+
const declaredDependencies = (manifest) => pipe(Record.toEntries({
|
|
121
|
+
...manifest.dependencies,
|
|
122
|
+
...manifest.devDependencies,
|
|
123
|
+
...manifest.peerDependencies
|
|
124
|
+
}), Array.filter(([, range]) => !String.startsWith(WORKSPACE_PROTOCOL)(range)), Array.map(([packageName]) => packageName));
|
|
125
|
+
const workspaceDependencies = (manifest) => pipe(Record.toEntries({
|
|
126
|
+
...manifest.dependencies,
|
|
127
|
+
...manifest.devDependencies
|
|
128
|
+
}), Array.filter(([, range]) => String.startsWith(WORKSPACE_PROTOCOL)(range)), Array.map(([packageName]) => packageName));
|
|
129
|
+
const entryOrder = Order.mapInput(Order.String, (entry) => entry.specifier);
|
|
130
|
+
const dependencyEntries = Effect.fn("dependencyEntries")(function* dependencyEntries(packageDirectory) {
|
|
131
|
+
const files = yield* RepositoryFiles;
|
|
132
|
+
const manifest = yield* readManifest(packageDirectory);
|
|
133
|
+
if (Option.isNone(manifest)) return [];
|
|
134
|
+
const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) => entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)));
|
|
135
|
+
return Array.sort(Array.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier), entryOrder);
|
|
136
|
+
});
|
|
137
|
+
// src/entities/package/model/public-entries.ts
|
|
6
138
|
const SOURCE = /\.[cm]?tsx?$/u;
|
|
7
139
|
const BUILT = /\.(?:d\.)?[cm]?[jt]s$/u;
|
|
8
140
|
const DECLARATION = ".d.";
|
|
9
|
-
const SEPARATOR$
|
|
141
|
+
const SEPARATOR$2 = "/";
|
|
10
142
|
const ROOT_SUBPATH = ".";
|
|
11
143
|
const BIN_LABEL = "bin";
|
|
12
144
|
const targetsIn = (held) => {
|
|
@@ -28,7 +160,7 @@ const binsOf = (manifest) => {
|
|
|
28
160
|
if (!Predicate.isObject(manifest.bin)) return [];
|
|
29
161
|
return pipe(Record.toEntries(manifest.bin), Array.map(([name, target]) => [`${BIN_LABEL} ${name}`, target]));
|
|
30
162
|
};
|
|
31
|
-
const baseNameOf = (target) => pipe(String.split(target, SEPARATOR$
|
|
163
|
+
const baseNameOf = (target) => pipe(String.split(target, SEPARATOR$2), Array.last, Option.getOrElse(() => target), String.replace(BUILT, ""));
|
|
32
164
|
const sourceOf = ({ join, packEntries }) => (target) => {
|
|
33
165
|
if (SOURCE.test(target) && !String.includes(DECLARATION)(target)) return Option.some(join(target));
|
|
34
166
|
const name = baseNameOf(target);
|
|
@@ -38,9 +170,9 @@ const publicEntriesOf = (lookup) => pipe([...subpathsOf(lookup.manifest.exports)
|
|
|
38
170
|
label,
|
|
39
171
|
source
|
|
40
172
|
})))), Array.dedupeWith((left, right) => left.label === right.label && left.source === right.source));
|
|
41
|
-
// src/published.ts
|
|
42
|
-
const CONFIG_FILE = "vite.config.ts";
|
|
43
|
-
const SEPARATOR = "/";
|
|
173
|
+
// src/entities/package/model/published.ts
|
|
174
|
+
const CONFIG_FILE$1 = "vite.config.ts";
|
|
175
|
+
const SEPARATOR$1 = "/";
|
|
44
176
|
const READ_CONCURRENCY = 16;
|
|
45
177
|
const SOURCE_EXTENSION = /\.[cm]?tsx?$/u;
|
|
46
178
|
const UNIT_BYTES = [
|
|
@@ -73,7 +205,7 @@ const PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(f
|
|
|
73
205
|
const taggedError$1 = Schema.TaggedError;
|
|
74
206
|
var WorkspaceConfigUnreadable = class extends taggedError$1()("WorkspaceConfigUnreadable", { file: Schema.String }) {};
|
|
75
207
|
const bytesPer = (unit) => pipe(UNIT_BYTES, Array.findFirst(([name]) => name === unit), Option.map(([, bytes]) => bytes), Option.getOrElse(() => NaN));
|
|
76
|
-
const nameOf = (source) => pipe(String.split(source, SEPARATOR), Array.last, Option.getOrElse(() => source), String.replace(SOURCE_EXTENSION, ""));
|
|
208
|
+
const nameOf = (source) => pipe(String.split(source, SEPARATOR$1), Array.last, Option.getOrElse(() => source), String.replace(SOURCE_EXTENSION, ""));
|
|
77
209
|
const entriesOf = (entry) => {
|
|
78
210
|
if (Predicate.isString(entry)) return [{
|
|
79
211
|
name: nameOf(entry),
|
|
@@ -129,35 +261,11 @@ const publishedIn = Effect.fn("publishedIn")(function* publishedIn(root, configN
|
|
|
129
261
|
const publishedWorkspaces = Effect.fn("publishedWorkspaces")(function* publishedWorkspaces(root) {
|
|
130
262
|
const files = yield* RepositoryFiles;
|
|
131
263
|
const names = yield* files.listedFiles(root);
|
|
132
|
-
const configs = pipe(names, Array.filter((name) => files.basename(name) === CONFIG_FILE && String.includes(SEPARATOR)(name)));
|
|
264
|
+
const configs = pipe(names, Array.filter((name) => files.basename(name) === CONFIG_FILE$1 && String.includes(SEPARATOR$1)(name)));
|
|
133
265
|
const found = yield* Effect.forEach(configs, (name) => publishedIn(root, name), { concurrency: READ_CONCURRENCY });
|
|
134
266
|
return Array.getSomes(found);
|
|
135
267
|
});
|
|
136
|
-
// src/workspace-
|
|
137
|
-
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
138
|
-
const MANIFEST_FILE = "package.json";
|
|
139
|
-
const NEGATION = "!";
|
|
140
|
-
const WorkspaceFile = Schema.Struct({ packages: Schema.optionalKey(Schema.Array(Schema.String)) });
|
|
141
|
-
const decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);
|
|
142
|
-
const manifestPathspec = (pattern) => {
|
|
143
|
-
if (String.startsWith(NEGATION)(pattern)) return `:(glob,exclude)${String.slice(1)(pattern)}/${MANIFEST_FILE}`;
|
|
144
|
-
return `:(glob)${pattern}/${MANIFEST_FILE}`;
|
|
145
|
-
};
|
|
146
|
-
const packagesOf = (text) => {
|
|
147
|
-
const raw = parse$1(text);
|
|
148
|
-
return pipe(decodeWorkspaceFile(raw), Option.flatMap(({ packages }) => Option.fromUndefinedOr(packages)), Option.getOrElse(() => []));
|
|
149
|
-
};
|
|
150
|
-
/** @internal */
|
|
151
|
-
const workspaceDirectories = Effect.fn("workspaceDirectories")(function* workspaceDirectories(root) {
|
|
152
|
-
const files = yield* RepositoryFiles;
|
|
153
|
-
const text = yield* files.readFile(files.join(root, WORKSPACE_FILE));
|
|
154
|
-
const patterns = pipe(text, Option.map(packagesOf), Option.getOrElse(() => []));
|
|
155
|
-
if (!Array.isReadonlyArrayNonEmpty(patterns)) return [];
|
|
156
|
-
const manifests = yield* files.matchingFiles(root, pipe(patterns, Array.map(manifestPathspec)));
|
|
157
|
-
const directories = pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
|
|
158
|
-
return Array.sort(directories, String.Order);
|
|
159
|
-
});
|
|
160
|
-
// src/config-literal.ts
|
|
268
|
+
// src/entities/workspace/model/config-literal.ts
|
|
161
269
|
const WRAPPERS = [
|
|
162
270
|
"TSAsExpression",
|
|
163
271
|
"TSSatisfiesExpression",
|
|
@@ -240,8 +348,9 @@ const nestedValues = (path) => (node) => {
|
|
|
240
348
|
const [outer, inner] = path;
|
|
241
349
|
return [...pipe(Option.some(node), Option.flatMap(propertyValue(outer)), Option.flatMap(propertyValue(inner)), Option.toArray), ...pipe(childrenOf(node), Array.flatMap(nestedValues(path)))];
|
|
242
350
|
};
|
|
243
|
-
// src/workspace-config-source.ts
|
|
351
|
+
// src/entities/workspace/model/workspace-config-source.ts
|
|
244
352
|
const SINGLE = 1;
|
|
353
|
+
const CONFIG_FILE = "vite.config.ts";
|
|
245
354
|
const taggedError = Schema.TaggedError;
|
|
246
355
|
var WorkspaceSettingsInvalid = class extends taggedError()("WorkspaceSettingsInvalid", {
|
|
247
356
|
file: Schema.String,
|
|
@@ -276,7 +385,55 @@ const programOf = Effect.fn("programOf")(function* programOf(file, text) {
|
|
|
276
385
|
if (Array.isReadonlyArrayNonEmpty(parsed.errors)) return yield* settingsInvalid(file)("vite.config.ts does not parse.");
|
|
277
386
|
return parsed.program;
|
|
278
387
|
});
|
|
279
|
-
|
|
388
|
+
const workspaceConfigOf = Effect.fn("workspaceConfigOf")(function* workspaceConfigOf(root, directory) {
|
|
389
|
+
const files = yield* RepositoryFiles;
|
|
390
|
+
const file = files.join(root, directory, CONFIG_FILE);
|
|
391
|
+
const text = yield* files.readFile(file);
|
|
392
|
+
if (Option.isNone(text)) return Option.none();
|
|
393
|
+
const program = yield* programOf(file, text.value);
|
|
394
|
+
return Option.some({
|
|
395
|
+
file,
|
|
396
|
+
source: text.value,
|
|
397
|
+
program
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
// src/entities/workspace/model/workspace-directories.ts
|
|
401
|
+
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
402
|
+
const MANIFEST_FILE = "package.json";
|
|
403
|
+
const NEGATION$1 = "!";
|
|
404
|
+
const WorkspaceFile = Schema.Struct({ packages: Schema.optionalKey(Schema.Array(Schema.String)) });
|
|
405
|
+
const decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);
|
|
406
|
+
const manifestPathspec = (pattern) => {
|
|
407
|
+
if (String.startsWith(NEGATION$1)(pattern)) return `:(glob,exclude)${String.slice(1)(pattern)}/${MANIFEST_FILE}`;
|
|
408
|
+
return `:(glob)${pattern}/${MANIFEST_FILE}`;
|
|
409
|
+
};
|
|
410
|
+
const packagesOf = (text) => {
|
|
411
|
+
const raw = parse$1(text);
|
|
412
|
+
return pipe(decodeWorkspaceFile(raw), Option.flatMap(({ packages }) => Option.fromUndefinedOr(packages)), Option.getOrElse(() => []));
|
|
413
|
+
};
|
|
414
|
+
/** @internal */
|
|
415
|
+
const workspaceDirectories = Effect.fn("workspaceDirectories")(function* workspaceDirectories(root) {
|
|
416
|
+
const files = yield* RepositoryFiles;
|
|
417
|
+
const text = yield* files.readFile(files.join(root, WORKSPACE_FILE));
|
|
418
|
+
const patterns = pipe(text, Option.map(packagesOf), Option.getOrElse(() => []));
|
|
419
|
+
if (!Array.isReadonlyArrayNonEmpty(patterns)) return [];
|
|
420
|
+
const manifests = yield* files.matchingFiles(root, pipe(patterns, Array.map(manifestPathspec)));
|
|
421
|
+
const directories = pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
|
|
422
|
+
return Array.sort(directories, String.Order);
|
|
423
|
+
});
|
|
424
|
+
// src/entities/workspace/model/workspace-patterns.ts
|
|
425
|
+
const SEPARATOR = "/";
|
|
426
|
+
const NEGATION = "!";
|
|
427
|
+
const RELATIVE = "./";
|
|
428
|
+
const withoutRelative = (target) => {
|
|
429
|
+
if (String.startsWith(RELATIVE)(target)) return String.slice(2)(target);
|
|
430
|
+
return target;
|
|
431
|
+
};
|
|
432
|
+
const prefixed = (directory) => (pattern) => {
|
|
433
|
+
if (String.startsWith(NEGATION)(pattern)) return `${NEGATION}${directory}${SEPARATOR}${String.slice(1)(pattern)}`;
|
|
434
|
+
return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;
|
|
435
|
+
};
|
|
436
|
+
// src/entities/workspace/model/workspace-tasks.ts
|
|
280
437
|
const VERIFY_TASK = ["tasks", "verify"];
|
|
281
438
|
const NO_TASKS = { verify: [] };
|
|
282
439
|
const Tasks = Schema.Struct({ verify: Schema.Unknown });
|
|
@@ -293,6 +450,6 @@ const tasksOf = (manifest) => (program) => pipe(manifest, Option.flatMap((found)
|
|
|
293
450
|
onNone: () => NO_TASKS,
|
|
294
451
|
onSome: (name) => ({ verify: Array.filter([`${name}#verify`], () => definesTask(VERIFY_TASK)(program)) })
|
|
295
452
|
}));
|
|
296
|
-
export { publishedWorkspaces as _, tasksOf as a,
|
|
453
|
+
export { publicEntriesOf as C, workspaceDependencies as D, readManifest as E, publishedWorkspaces as S, dependencyEntries as T, keyName as _, tasksOf as a, PackEntry as b, workspaceDirectories as c, programOf as d, settingsInvalid as f, childrenOf as g, KeySchema as h, hasVerifyTask as i, literalSettings as l, workspaceConfigOf as m, VERIFY_TASK as n, prefixed as o, usedFrom as p, definesTask as r, withoutRelative as s, NO_TASKS as t, merged as u, literalOf as v, MANIFEST_FILE$1 as w, entriesOf as x, nestedValues as y };
|
|
297
454
|
|
|
298
|
-
//# sourceMappingURL=workspace-
|
|
455
|
+
//# sourceMappingURL=workspace-jN1GGTGn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-jN1GGTGn.mjs","names":["MANIFEST_FILE","ROOT_SUBPATH","Rec","Arr","Str","SEPARATOR","Rec","Arr","Str","CONFIG_FILE","SEPARATOR","taggedError","Arr","Str","Rec","MANIFEST_FILE","Arr","Rec","Arr","Rec","NEGATION","Str","parse","Arr","Str","Arr"],"sources":["../src/entities/package/model/dependencies.ts","../src/entities/package/model/public-entries.ts","../src/entities/package/model/published.ts","../src/entities/workspace/model/config-literal.ts","../src/entities/workspace/model/workspace-config-source.ts","../src/entities/workspace/model/workspace-directories.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/workspace-tasks.ts"],"sourcesContent":["import {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Schema,\n String as Str,\n Record as Rec,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles, NODE_MODULES } from \"#/shared/lib/repository-files.ts\";\n\nexport interface DependencyEntry {\n readonly packageName: string;\n readonly specifier: string;\n readonly declarationsPath: string;\n}\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\n\nconst PackageManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: DependencyMap,\n devDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n exports: Schema.optional(Schema.Unknown),\n types: Schema.optional(Schema.String),\n typings: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n});\n\nexport type Manifest = typeof PackageManifest.Type;\n\nexport const MANIFEST_FILE = \"package.json\";\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst ROOT_SUBPATH = \".\";\nconst SUBPATH_PREFIX = \"./\";\nconst WILDCARD = \"*\";\nconst TYPES_CONDITION = \"types\";\nconst TYPES_SCOPE = \"@types/\";\nconst TYPES_SCOPE_SEPARATOR = \"__\";\nconst CONDITION_DEPTH_LIMIT = 8;\nconst ROOT_DEPTH = 0;\nconst DEPTH_STEP = 1;\nconst DECLARATIONS_SUFFIX = /\\.d\\.[cm]?ts$|\\.[cm]?tsx?$/u;\nconst SCRIPT_SUFFIX = /\\.(?<module>[cm]?)js$/u;\n\nexport const readManifest = Effect.fn(\"readManifest\")(function* readManifest(directory: string) {\n const files = yield* RepositoryFiles;\n const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const text = yield* Effect.fromOption(manifestText);\n return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);\n}, Effect.option);\n\nconst conditionsOf = (held: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(held)) {\n return [];\n }\n return Rec.toEntries(held);\n};\n\nconst typesConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n const entries = conditionsOf(held);\n const declared = Arr.findFirst(entries, ([condition, target]) =>\n Option.liftPredicate(\n target,\n (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate),\n ),\n ).pipe(Option.filter(Predicate.isString));\n return Option.orElse(declared, () =>\n Arr.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)),\n );\n};\n\nconst anyConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (Predicate.isString(held)) {\n return Option.some(held);\n }\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n return Arr.findFirst(conditionsOf(held), ([, nested]) =>\n anyConditionIn(nested, depth + DEPTH_STEP),\n );\n};\n\nconst targetPathsOf = (target: unknown): readonly string[] =>\n Arr.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);\n\ninterface SubpathTarget {\n readonly subpath: string;\n readonly target: unknown;\n}\n\nconst subpathTargetsOf = (exportsField: unknown): readonly SubpathTarget[] => {\n if (Predicate.isString(exportsField)) {\n return [{ subpath: ROOT_SUBPATH, target: exportsField }];\n }\n const entries = conditionsOf(exportsField);\n if (\n !pipe(\n entries,\n Arr.some(([subpath]) => Str.startsWith(ROOT_SUBPATH)(subpath)),\n )\n ) {\n return Arr.match(entries, {\n onEmpty: () => [],\n onNonEmpty: () => [{ subpath: ROOT_SUBPATH, target: exportsField }],\n });\n }\n return pipe(\n entries,\n Arr.filter(([subpath]) => subpath === ROOT_SUBPATH || Str.startsWith(SUBPATH_PREFIX)(subpath)),\n Arr.filter(([subpath]) => !Str.includes(WILDCARD)(subpath)),\n Arr.map(([subpath, target]) => ({ subpath, target })),\n );\n};\n\nconst declarationsCandidateFor = (entryPath: string): Option.Option<string> => {\n if (DECLARATIONS_SUFFIX.test(entryPath)) {\n return Option.some(entryPath);\n }\n if (!SCRIPT_SUFFIX.test(entryPath)) {\n return Option.none();\n }\n return Option.some(Str.replace(SCRIPT_SUFFIX, \".d.$<module>ts\")(entryPath));\n};\n\nconst firstDeclarationsAmong = Effect.fn(\"firstDeclarationsAmong\")(function* firstDeclarations(\n directory: string,\n entryPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const candidates = Arr.getSomes(\n pipe(\n entryPaths,\n Arr.map((entryPath) => declarationsCandidateFor(entryPath)),\n ),\n );\n const existing = yield* Effect.filter(\n pipe(\n candidates,\n Arr.map((candidate) => files.join(directory, candidate)),\n ),\n (candidate) => files.exists(candidate),\n );\n return yield* Option.match(Arr.head(existing), {\n onNone: (): Effect.Effect<Option.Option<string>> => Effect.succeedNone,\n onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome),\n });\n});\n\nconst importNameOf = (packageName: string): string => {\n if (!Str.startsWith(TYPES_SCOPE)(packageName)) {\n return packageName;\n }\n const unscoped = Str.slice(TYPES_SCOPE.length)(packageName);\n if (!Str.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) {\n return unscoped;\n }\n return `@${Str.replace(TYPES_SCOPE_SEPARATOR, \"/\")(unscoped)}`;\n};\n\nconst specifierFor = (packageName: string, subpath: string): string => {\n const importName = importNameOf(packageName);\n if (subpath === ROOT_SUBPATH) {\n return importName;\n }\n return `${importName}/${Str.slice(SUBPATH_PREFIX.length)(subpath)}`;\n};\n\nconst rootEntryPaths = (manifest: Manifest): readonly string[] =>\n Arr.getSomes([\n Option.fromUndefinedOr(manifest.types),\n Option.fromUndefinedOr(manifest.typings),\n Option.fromUndefinedOr(manifest.main),\n ]);\n\nconst subpathEntriesOf = Effect.fn(\"subpathEntriesOf\")(function* subpathEntriesOf(\n packageName: string,\n directory: string,\n manifest: Manifest,\n) {\n const found = yield* Effect.forEach(subpathTargetsOf(manifest.exports), ({ subpath, target }) =>\n firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(\n Effect.map(\n Option.map((declarationsPath) => ({\n packageName,\n specifier: specifierFor(packageName, subpath),\n declarationsPath,\n })),\n ),\n ),\n );\n return Arr.getSomes(found);\n});\n\nconst entriesOfDependency = Effect.fn(\"entriesOfDependency\")(function* entriesOfDependency(\n packageName: string,\n directory: string,\n) {\n const manifest = yield* readManifest(directory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);\n const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);\n if (\n pipe(\n subpathEntries,\n Arr.some((entry) => entry.specifier === rootSpecifier),\n )\n ) {\n return subpathEntries;\n }\n const rootDeclarations = yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value));\n const rootEntries = rootDeclarations.pipe(\n Option.map((declarationsPath) => ({ packageName, specifier: rootSpecifier, declarationsPath })),\n Option.toArray,\n );\n return [...rootEntries, ...subpathEntries];\n});\n\nconst declaredDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n }),\n Arr.filter(([, range]) => !Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nexport const workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({ ...manifest.dependencies, ...manifest.devDependencies }),\n Arr.filter(([, range]) => Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst entryOrder = Order.mapInput(Order.String, (entry: DependencyEntry) => entry.specifier);\n\nexport const dependencyEntries = Effect.fn(\"dependencyEntries\")(function* dependencyEntries(\n packageDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(packageDirectory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) =>\n entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)),\n );\n return Arr.sort(\n Arr.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier),\n entryOrder,\n );\n});\n","import { Array as Arr, Option, Predicate, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst SEPARATOR = \"/\";\nconst ROOT_SUBPATH = \".\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport interface EntryManifest {\n readonly name?: string | undefined;\n readonly exports?: unknown;\n readonly bin?: unknown;\n}\n\nexport interface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst targetsIn = (held: unknown): readonly string[] => {\n if (Predicate.isString(held)) {\n return [held];\n }\n if (!Predicate.isObject(held)) {\n return [];\n }\n return pipe(Rec.values(held), Arr.flatMap(targetsIn));\n};\n\nconst subpathsOf = (exportsField: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(exportsField)) {\n return [[ROOT_SUBPATH, exportsField]];\n }\n const entries = Rec.toEntries(exportsField);\n if (\n pipe(\n entries,\n Arr.some(([key]) => Str.startsWith(ROOT_SUBPATH)(key)),\n )\n ) {\n return entries;\n }\n return [[ROOT_SUBPATH, exportsField]];\n};\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] => {\n if (Predicate.isString(manifest.bin)) {\n const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => \"\");\n return [[`${BIN_LABEL} ${name}`, manifest.bin]];\n }\n if (!Predicate.isObject(manifest.bin)) {\n return [];\n }\n return pipe(\n Rec.toEntries(manifest.bin),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n};\n\nconst baseNameOf = (target: string): string =>\n pipe(\n Str.split(target, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => target),\n Str.replace(BUILT, \"\"),\n );\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = baseNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nexport const publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...subpathsOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n","import {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./dependencies.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nexport const PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst PackSettings = Schema.Struct({ entry: Schema.optional(PackEntry) });\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst WorkspaceConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n pack: Schema.optional(PackList),\n});\nconst PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(false)) });\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nexport interface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\nexport interface PublishedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly installSize: string;\n readonly installBudget: number;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nexport const entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packEntriesOf = (pack: typeof WorkspaceConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return pipe(config, Option.flatMap(Schema.decodeUnknownOption(WorkspaceConfig)));\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n return Option.exists(text, (found) =>\n Option.isSome(Schema.decodeOption(Schema.fromJsonString(PublicManifest))(found)),\n );\n});\n\nconst workspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ msch, pack }: typeof WorkspaceConfig.Type): PublishedWorkspace => {\n const [amount, , unit] = msch.publish.installSize;\n return {\n directory,\n configFile,\n installSize: `${amount} ${unit}`,\n installBudget: amount * bytesPer(unit),\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n };\n };\n\nconst publishedIn = Effect.fn(\"publishedIn\")(function* publishedIn(\n root: string,\n configName: string,\n) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<PublishedWorkspace>();\n }\n const settings = yield* settingsIn(configFile);\n return pipe(\n settings,\n Option.map(workspaceOf(directory, configFile, (source) => files.join(directory, source))),\n );\n});\n\n/** @internal */\nexport const publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n const configs = pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n const found = yield* Effect.forEach(configs, (name) => publishedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n","import { Array as Arr, Match, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\n\nexport type Literal = string | number | boolean | null | readonly Literal[] | LiteralObject;\n\nexport interface LiteralObject {\n readonly [key: string]: Literal;\n}\n\nconst WRAPPERS = [\"TSAsExpression\", \"TSSatisfiesExpression\", \"ParenthesizedExpression\"] as const;\n\nexport const KeySchema = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"Literal\"), value: Schema.String }),\n]);\nconst Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });\nconst PropertyNode = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n});\nconst WrappedNode = Schema.Struct({ type: Schema.Literals(WRAPPERS), expression: Schema.Unknown });\nconst ValueNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"Literal\"),\n value: Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]),\n }),\n Schema.Struct({\n type: Schema.Literal(\"TemplateLiteral\"),\n expressions: Schema.Tuple([]),\n quasis: Schema.Array(Quasi),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ArrayExpression\"),\n elements: Schema.Array(Schema.Unknown),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(PropertyNode),\n }),\n]);\n\nconst decodeWrapped = Schema.decodeUnknownOption(WrappedNode);\nconst decodeValue = Schema.decodeUnknownOption(ValueNode);\nconst decodeProperty = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"Property\"), key: KeySchema, value: Schema.Unknown }),\n);\nconst decodeObject = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n);\n\nexport const keyName = (key: typeof KeySchema.Type): string =>\n Match.value(key).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Identifier: (identifier) => identifier.name,\n Literal: (literal) => literal.value,\n }),\n );\n\nexport const literalOf = (node: unknown): Option.Option<Literal> => {\n const wrapped = decodeWrapped(node);\n if (Option.isSome(wrapped)) {\n return literalOf(wrapped.value.expression);\n }\n return pipe(\n decodeValue(node),\n Option.flatMap((value) =>\n Match.value(value).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Literal: (scalar): Option.Option<Literal> => Option.some(scalar.value),\n TemplateLiteral: (template): Option.Option<Literal> =>\n Option.some(\n pipe(\n template.quasis,\n Arr.map((quasi) => quasi.value.cooked),\n Arr.join(\"\"),\n ),\n ),\n ArrayExpression: (array): Option.Option<Literal> =>\n pipe(array.elements, Arr.map(literalOf), Option.all),\n ObjectExpression: (object): Option.Option<Literal> =>\n pipe(\n object.properties,\n Arr.map((property) =>\n pipe(\n literalOf(property.value),\n Option.map((literal) => [keyName(property.key), literal] as const),\n ),\n ),\n Option.all,\n Option.map(Rec.fromEntries),\n ),\n }),\n ),\n ),\n );\n};\n\nconst propertyValue =\n (name: string) =>\n (object: unknown): Option.Option<unknown> =>\n pipe(\n decodeObject(object),\n Option.flatMap(({ properties }) =>\n pipe(\n properties,\n Arr.findFirst((property) =>\n pipe(\n decodeProperty(property),\n Option.filter(({ key }) => keyName(key) === name),\n Option.map(({ value }) => value),\n ),\n ),\n ),\n ),\n );\n\nexport const childrenOf = (node: unknown): readonly unknown[] => {\n if (Arr.isArray(node)) {\n return node;\n }\n if (Predicate.isReadonlyObject(node)) {\n return Rec.values(node);\n }\n return [];\n};\n\nexport const nestedValues =\n (path: readonly [string, string]) =>\n (node: unknown): readonly unknown[] => {\n const [outer, inner] = path;\n const own = pipe(\n Option.some(node),\n Option.flatMap(propertyValue(outer)),\n Option.flatMap(propertyValue(inner)),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(nestedValues(path)))];\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { literalOf, nestedValues } from \"./config-literal.ts\";\n\nconst SINGLE = 1;\nconst CONFIG_FILE = \"vite.config.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceSettingsInvalid extends taggedError<\n WorkspaceSettingsInvalid,\n { readonly brand: unique symbol }\n>()(\"WorkspaceSettingsInvalid\", { file: Schema.String, message: Schema.String }) {}\n\nexport const settingsInvalid =\n (file: string) =>\n (reason: string): WorkspaceSettingsInvalid =>\n WorkspaceSettingsInvalid.make({ file, message: `${file}: ${reason}` });\n\nexport interface WorkspaceSource {\n readonly file: string;\n readonly directory: string;\n readonly program: unknown;\n}\n\nexport type SettingsPath = readonly [string, string];\n\nconst notLiteral = ([outer, inner]: SettingsPath): string =>\n `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Name a set the root config defines in use instead of importing values.`;\n\nexport const merged = <Value>(\n records: readonly Readonly<Record<string, Value>>[],\n): Record<string, Value> => pipe(records, Arr.flatMap(Rec.toEntries), Rec.fromEntries);\n\nexport const usedFrom = Effect.fn(\"usedFrom\")(function* usedFrom<Value>(\n file: string,\n sets: Readonly<Record<string, Value>>,\n used: readonly string[],\n) {\n const unknownSets = pipe(\n used,\n Arr.filter((name) => !Rec.has(sets, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(unknownSets)) {\n return yield* settingsInvalid(file)(\n `msch uses sets the root does not define: ${Arr.join(unknownSets, \", \")}. Defined: ${Arr.join(Rec.keys(sets), \", \")}.`,\n );\n }\n return pipe(\n used,\n Arr.flatMap((name) => Option.toArray(Rec.get(sets, name))),\n );\n});\n\nconst singleValue = Effect.fn(\"singleValue\")(function* singleValue(\n source: WorkspaceSource,\n path: SettingsPath,\n) {\n const found = nestedValues(path)(source.program);\n if (found.length > SINGLE) {\n return yield* settingsInvalid(source.file)(`${Arr.join(path, \".\")} appears more than once.`);\n }\n return Arr.head(found);\n});\n\nexport interface LiteralSettingsRequest<Settings> {\n readonly source: WorkspaceSource;\n readonly path: SettingsPath;\n readonly decode: (input: unknown) => Effect.Effect<Settings, Schema.SchemaError>;\n}\n\nexport const literalSettings = <Settings>({\n source,\n path,\n decode,\n}: LiteralSettingsRequest<Settings>): Effect.Effect<\n Option.Option<Settings>,\n WorkspaceSettingsInvalid\n> =>\n Effect.gen(function* literalSettingsIn() {\n const node = yield* singleValue(source, path);\n if (Option.isNone(node)) {\n return Option.none();\n }\n const literal = literalOf(node.value);\n if (Option.isNone(literal)) {\n return yield* settingsInvalid(source.file)(notLiteral(path));\n }\n const settings = yield* decode(literal.value).pipe(\n Effect.mapError((error) => settingsInvalid(source.file)(error.message)),\n );\n return Option.some(settings);\n });\n\nexport const programOf = Effect.fn(\"programOf\")(function* programOf(file: string, text: string) {\n const parsed = yield* Effect.promise(() => parse(file, text, { lang: \"ts\" }));\n if (Arr.isReadonlyArrayNonEmpty(parsed.errors)) {\n return yield* settingsInvalid(file)(\"vite.config.ts does not parse.\");\n }\n const program: unknown = parsed.program;\n return program;\n});\n\ninterface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst MANIFEST_FILE = \"package.json\";\nconst NEGATION = \"!\";\n\nconst WorkspaceFile = Schema.Struct({ packages: Schema.optionalKey(Schema.Array(Schema.String)) });\nconst decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);\n\nconst manifestPathspec = (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `:(glob,exclude)${Str.slice(NEGATION.length)(pattern)}/${MANIFEST_FILE}`;\n }\n return `:(glob)${pattern}/${MANIFEST_FILE}`;\n};\n\nconst packagesOf = (text: string): readonly string[] => {\n const raw: unknown = parse(text);\n return pipe(\n decodeWorkspaceFile(raw),\n Option.flatMap(({ packages }) => Option.fromUndefinedOr(packages)),\n Option.getOrElse((): readonly string[] => []),\n );\n};\n\n/** @internal */\nexport const workspaceDirectories = Effect.fn(\"workspaceDirectories\")(\n function* workspaceDirectories(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, WORKSPACE_FILE));\n const patterns = pipe(\n text,\n Option.map(packagesOf),\n Option.getOrElse((): readonly string[] => []),\n );\n if (!Arr.isReadonlyArrayNonEmpty(patterns)) {\n return [];\n }\n const manifests = yield* files.matchingFiles(root, pipe(patterns, Arr.map(manifestPathspec)));\n const directories = pipe(\n manifests,\n Arr.map((manifest) => files.dirname(manifest)),\n );\n return Arr.sort(directories, Str.Order);\n },\n);\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { Manifest } from \"#/entities/package/@x/workspace.ts\";\n\nimport { nestedValues } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const VERIFY_TASK = [\"tasks\", \"verify\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n return Option.exists(config, isVerified);\n});\n\nexport const tasksOf =\n (manifest: Option.Option<Manifest>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (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ACzC,CAAC;AAED,MAAa,WACV,cACA,YACC,KACE,UACA,OAAO,SAAS,UAAU,OAAO,gBAAgB,MAAM,IAAI,CAAC,GAC5D,OAAO,MAAM;CACX,cAAc;CACd,SAAS,UAAU,EACjB,QAAQA,MAAI,OAAO,CAAC,GAAG,KAAK,QAAQ,SAAS,YAAY,WAAW,CAAC,CAAC,OAAO,CAAC,EAChF;AACF,CAAC,CACH"}
|
|
@@ -3,30 +3,30 @@ import { OxlintOverride } from "vite-plus/lint";
|
|
|
3
3
|
interface WorkspaceTasks {
|
|
4
4
|
readonly verify: readonly string[];
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
type RuleSet = Readonly<Record<string, unknown>>;
|
|
7
|
+
type RuleSets = Readonly<Record<string, RuleSet>>;
|
|
8
|
+
type DependencySets = Readonly<Record<string, readonly string[]>>;
|
|
9
|
+
interface DevDependencyAllowance {
|
|
10
10
|
readonly workspaces: readonly string[];
|
|
11
11
|
readonly dependencies: readonly string[];
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface WorkspaceLint {
|
|
14
14
|
readonly ignorePatterns: readonly string[];
|
|
15
15
|
readonly overrides: readonly OxlintOverride[];
|
|
16
16
|
readonly shadcnUi: readonly string[];
|
|
17
17
|
readonly publicEntries: readonly string[];
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
interface WorkspaceSettings {
|
|
20
20
|
readonly lint: WorkspaceLint;
|
|
21
21
|
readonly testProjects: readonly string[];
|
|
22
22
|
readonly tasks: WorkspaceTasks;
|
|
23
23
|
readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface SettingsOptions {
|
|
26
26
|
readonly root: string;
|
|
27
27
|
readonly ruleSets: RuleSets;
|
|
28
28
|
readonly dependencySets: DependencySets;
|
|
29
29
|
}
|
|
30
30
|
export declare const workspaceSettings: (options: SettingsOptions) => Promise<WorkspaceSettings>;
|
|
31
|
-
export type { WorkspaceTasks };
|
|
31
|
+
export type { DependencySets, DevDependencyAllowance, RuleSet, RuleSets, SettingsOptions, WorkspaceLint, WorkspaceSettings, WorkspaceTasks };
|
|
32
32
|
//# sourceMappingURL=workspace-settings.d.mts.map
|