mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 11:13:21 +00:00
* test(architecture): ratchet top-level layer direction and mutual imports Declare a layer for every top-level src/ directory and root source file (domain, contracts, foundation, providers, application, composition, adapters) in scripts/lib/module-layers.mjs. verify:module-boundaries now also builds the production import graph between those units and compares it with a counted baseline: 45 unit pairs import a higher layer (248 imports) and 23 unit pairs import each other. A new upward pair, more imports on a recorded pair, a new mutual import, or an undeclared unit fails; shrinkage is reported so the baseline can be lowered. * fix(architecture): enforce layers for isolated units
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/** One dependency crossing a settled source ownership boundary. */
|
|
export interface ModuleBoundaryViolation {
|
|
readonly file: string;
|
|
readonly line: number;
|
|
readonly specifier: string;
|
|
readonly target: string;
|
|
readonly boundary:
|
|
| "artifact-acquisition"
|
|
| "process-capture"
|
|
| "pure-layer"
|
|
| "application-composition"
|
|
| "provider-construction"
|
|
| "provider-generated-catalog";
|
|
}
|
|
|
|
/** Check resolved source ownership, including type imports and reexports. */
|
|
export function inspectModuleBoundaries(
|
|
file: string,
|
|
source: string,
|
|
root: string,
|
|
): readonly ModuleBoundaryViolation[];
|
|
|
|
/** One own-source import, resolved to its repository path. */
|
|
export interface ResolvedModuleImport {
|
|
readonly file: string;
|
|
readonly line: number;
|
|
readonly specifier: string;
|
|
readonly typeOnly: boolean;
|
|
readonly target: string;
|
|
}
|
|
|
|
/** Each own-source import of a file, resolved to its repository path. */
|
|
export function resolveModuleImports(
|
|
file: string,
|
|
source: string,
|
|
root: string,
|
|
): readonly ResolvedModuleImport[];
|
|
|
|
/** Check already resolved imports, as returned by resolveModuleImports. */
|
|
export function inspectResolvedModuleBoundaries(
|
|
imports: readonly ResolvedModuleImport[],
|
|
): readonly ModuleBoundaryViolation[];
|