/** * DI Analyzer Strategy * * Picks which DI analyzer generates a project's design graph. The primary * driver is the project's `role` nx tag; the `framework` env set (its libType) * only distinguishes the client runtime by set membership: * * - env set includes `express` → {@link InversifyAnalyzer} (roots on `@DocumentDesign`) * - env set includes `angular` → {@link AngularAnalyzer} (roots on the bootstrap/route components) * - anything else (`react`, `browser`, `node`, ...) → {@link EmptyAnalyzer} (skip) * * The explicit tags are the source of truth. When the role tag is ABSENT (e.g. * before retag), a cheap marker pre-scan corroborates: `@Component(` / * `bootstrapApplication` → angular; `@DocumentDesign(` → Inversify. This makes the * committed design.* identical whether selection is tag- or marker-driven. */ import type * as ts from 'typescript'; import { DiGraph } from './model'; import { DiRootMode } from './analyzer'; /** Which framework a source tree's decorators point at (marker pre-scan fallback). */ export declare class FrameworkMarkers { angular: boolean; controller: boolean; constructor(angular: boolean, controller: boolean); } /** Statically analyzes one project's DI dependency DAG into a `DiGraph`. */ export interface DiAnalyzer { analyzeProject(program: ts.Program, workspaceRoot: string, projectRoot: string, projectName: string): DiGraph; } /** * Inversify analyzer: one design per `@DocumentDesign` root. The `rootMode` only * sets the root box kind: * - `'controller'` (server projects) → `controller`. * - `'apiImplementation'` (role:designed-lib) → `apiImplementation`. */ export declare class InversifyAnalyzer implements DiAnalyzer { private readonly rootMode; constructor(rootMode?: DiRootMode); analyzeProject(program: ts.Program, workspaceRoot: string, projectRoot: string, projectName: string): DiGraph; } /** Angular: one design per entry component (bootstrap + routed). */ export declare class AngularAnalyzer implements DiAnalyzer { analyzeProject(program: ts.Program, workspaceRoot: string, projectRoot: string, projectName: string): DiGraph; } /** Non-angular/non-express projects: an empty graph (skip). */ export declare class EmptyAnalyzer implements DiAnalyzer { analyzeProject(_program: ts.Program, _workspaceRoot: string, _projectRoot: string, projectName: string): DiGraph; } /** Extract the FIRST explicit `framework:` nx tag, or null when the project has none. */ export declare function explicitFrameworkTag(tags: readonly string[]): string | null; /** Extract every explicit `framework:` nx tag as an env set (the project's libType). */ export declare function frameworkTags(tags: readonly string[]): string[]; /** Extract the explicit `role:` nx tag, or null when the project has none. */ export declare function explicitRoleTag(tags: readonly string[]): string | null; /** * Choose the analyzer for a project. `role` (server|designed-lib|lib|client) is * the source of truth for WHAT to root on; `frameworks` is the project's env set * (its libType) and distinguishes the client runtime (angular vs other) by set * membership; `markers` corroborate only when the role tag is ABSENT (rollout * fallback keeps pre-retag designs identical). * * - `server` → Inversify, roots on `@DocumentDesign` (controller kind) * - `app` → Inversify, roots on `@DocumentDesign` (controller kind) — a runnable * (non-HTTP) application bootstrapped via `container.get(XxxApp)`, e.g. the * tooling packages (AiRulesApp, RulesApp). Drawn exactly like a server. * - `bundle` → skip (an aggregator of apps; no design of its own) * - `designed-lib` → Inversify, roots on `@DocumentDesign` (apiImplementation kind) * - `client` → Angular design for angular apps; otherwise skip * - `lib` → skip (plain libraries get no design) * - `api-lib` → skip (contract-only libraries get no design) * - role absent → legacy framework/marker selection */ export declare function selectAnalyzer(role: string | null, frameworks: string[], markers: FrameworkMarkers): DiAnalyzer;