Angular Modernizer
    Preparing search index...

    Builds and maintains a project-wide index of exported classes for fast lookup of where a symbol is defined. Used to resolve project-local dependencies (components, directives, pipes) and to calculate the import paths for them.

    Index

    Constructors

    Methods

    • Build a project-wide symbol map.

      This method scans every source file in the project and indexes all exported classes by their name. The resulting map can be used to quickly find where any class is defined, which is essential for generating correct import paths.

      Parameters

      • project: Project

        The ts-morph Project instance

      Returns Map<string, ProjectSymbolInfo>

      Map from class name to SymbolInfo

      const symbolMap = symbolLocator.buildProjectSymbolMap(project);
      const symbol = symbolMap.get('AdduserEntryComponent');
      if (symbol) {
      console.info(`Found at: ${symbol.sourceFile.getFilePath()}`);
      }
    • Calculate the relative import path from one file to another.

      Given a source file and a target file, this calculates the correct relative import path (e.g., '../dialogs/xyz.component').

      Parameters

      • fromFile: SourceFile

        The file that will contain the import statement

      • toFile: SourceFile

        The file to import from

      Returns string

      The relative import path (without extension)

      // From: /project/src/app/user/user.component.ts
      // To: /project/src/app/dialogs/xyz.component.ts
      // Result: '../dialogs/xyz.component'