Represents the entire import graph of a project.

Constructors

Properties

edges: ImportEdge[]
nodes: ImportNode[]

Methods

  • Performs a BFS on the import graph.

    Parameters

    • start: ImportNodeIdx

      The starting node index for the BFS.

    • callback: ((node: ImportNode, edge: null | ImportEdge) => void)

      A function called for each visited node and the edge through which it was reached.

    • __namedParameters: Partial<{
          direction: ImportDirection;
      }> = {}

    Returns void

  • Finds a node in the graph by its import path.

    Parameters

    • importPath: string

      The absolute path of the file to find.

    Returns undefined | ImportNode

    The ImportNode if found, or undefined if not found.

  • Iterates over all edges in the graph and calls the provided callback for each edge.

    Parameters

    • callback: ((edge: ImportEdge) => void)

      A function to be called for each edge in the graph.

        • (edge): void
        • Parameters

          Returns void

    Returns void

  • Iterates over all nodes in the graph and calls the provided callback for each nodes.

    Parameters

    • callback: ((node: ImportNode) => void)

      A function to be called for each nodes in the graph.

        • (node): void
        • Parameters

          Returns void

    Returns void

  • Returns all direct and indirect import connections for the given node index.

    Parameters

    Returns ImportNode[]

    An array of ImportNodes that are directly or indirectly imported by the given node.

  • Resolves project root based on the import directives. The project root is a directory including all the imported files.

    Returns undefined | string

    Project root directory or undefined if there are no user imports.