Files
reverse-engineering-anything/scripts/lib/module-layers.d.mts
T
morluto 8c052bdec5 test(architecture): ratchet top-level layer direction and mutual imports (#10584)
* 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
2026-11-15 08:37:04 +08:00

22 lines
768 B
TypeScript

export declare const LAYER_ORDER: readonly string[];
export declare const UNIT_LAYERS: Readonly<Record<string, string>>;
/** The top-level unit of a production `src/` file, or undefined. */
export function sourceUnit(path: string): string | undefined;
export interface LayerGraphFacts {
readonly undeclared: readonly string[];
readonly upward: Readonly<Record<string, number>>;
readonly cycles: readonly string[];
}
export function layerGraphFacts(
imports: readonly { readonly file: string; readonly target: string }[],
files?: readonly string[],
): LayerGraphFacts;
export function compareLayerBaseline(
facts: LayerGraphFacts,
baseline: Pick<LayerGraphFacts, "upward" | "cycles">,
): { readonly failures: string[]; readonly lowerable: string[] };