Angular Modernizer
    Preparing search index...

    Wrapper around ng-morph for Angular-specific AST operations on an existing ts-morph Project, so they work with the ts-morph based infrastructure.

    Index

    Constructors

    Methods

    • Add a declaration to an NgModule

      Parameters

      • moduleClass: ClassDeclaration

        The NgModule class declaration

      • declaration: string

        Name of the component/directive/pipe to declare

      • Optionaloptions: { unique?: boolean }

        Optional configuration

      Returns void

    • Add an import to a standalone component

      Parameters

      • componentClass: ClassDeclaration

        The component class declaration

      • importName: string

        Name of the import (e.g., 'CommonModule')

      • Optionaloptions: { unique?: boolean }

        Optional configuration

      Returns void

    • Add an import to an NgModule

      Parameters

      • moduleClass: ClassDeclaration

        The NgModule class declaration

      • moduleName: string

        Name of the module to import (e.g., 'CommonModule')

      • Optionaloptions: { unique?: boolean }

        Optional configuration

      Returns void

    • Add a provider to a standalone component

      Parameters

      • componentClass: ClassDeclaration

        The component class declaration

      • provider: string

        Provider to add (e.g., 'MyService')

      • Optionaloptions: { unique?: boolean }

        Optional configuration

      Returns void

    • Apply all changes to the file system This delegates to the ts-morph Project's save method

      Returns Promise<void>

    • Apply changes synchronously

      Returns void

    • Find the NgModule that declares a component

      Parameters

      • component: ClassDeclaration

      Returns ClassDeclaration | null

    • Get a specific component by file path

      Parameters

      • filePath: string

      Returns ClassDeclaration | undefined

    • Get all Angular components matching a pattern

      Parameters

      • Optionalpattern: string

      Returns ClassDeclaration[]

    • Get a specific module by file path

      Parameters

      • filePath: string

      Returns ClassDeclaration | undefined

    • Get all Angular modules matching a pattern

      Parameters

      • Optionalpattern: string

      Returns ClassDeclaration[]

    • Get the underlying ts-morph Project

      Returns Project

    • Remove a component from an NgModule's declarations This is a custom implementation since ng-morph doesn't provide this directly

      Uses ts-morph to manipulate the @NgModule decorator's declarations array.

      Parameters

      • moduleClass: ClassDeclaration

        The NgModule class declaration

      • componentName: string

        Name of the component to remove

      Returns boolean

      True if successfully removed, false otherwise