Angular Modernizer
    Preparing search index...

    Template Usage Analyzer with Three-Tier Strategy.

    Analyzes Angular templates to determine which imports are actually used. Uses a progressive enhancement approach for optimal performance.

    Index

    Constructors

    Methods

    • Analyze external template (from templateUrl) and return ONLY what's used.

      Loads the external template file and analyzes it using the three-tier strategy.

      Parameters

      • component: ClassDeclaration

        Component class declaration

      • templateUrl: string

        Template URL from @Component metadata (e.g., './user.component.html')

      • componentPath: string

        Absolute path to the component file

      • availableImports: string[]

        All imports from parent NgModule

      • project: Project

        ts-morph Project (for selector mapping)

      Returns Promise<string[]>

      Array of actually-used import names

    • Analyze template and return ONLY what's actually used.

      Uses three-tier strategy for optimal performance:

      • Tier 1: Fast path for simple templates (80% of cases, ~2ms)
      • Tier 2: Angular Compiler for complex templates (15% of cases, ~15ms)
      • Tier 3: Conservative fallback (5% of cases, include all imports)

      Parameters

      • component: ClassDeclaration

        Component class declaration

      • templateContent: string

        Template HTML content

      • availableImports: string[]

        All imports from parent NgModule

      • project: Project

        ts-morph Project (for selector mapping)

      Returns string[]

      Array of actually-used import names