"""
This type stub file was generated by pyright.
"""

from typing import TYPE_CHECKING
from graph_sitter.core.directory import Directory
from graph_sitter.core.file import File
from graph_sitter.writer_decorators import ts_apidoc
from graph_sitter.typescript.config_parser import TSConfigParser

if TYPE_CHECKING:
    ...
logger = ...
@ts_apidoc
class TSConfig:
    """TypeScript configuration file specified in tsconfig.json, used for import resolution and computing dependencies."""
    config_file: File
    config_parser: TSConfigParser
    config: dict
    _base_config: TSConfig | None = ...
    _base_url: str | None = ...
    _out_dir: str | None = ...
    _root_dir: str | None = ...
    _root_dirs: list[str] = ...
    _paths: dict[str, list[str]] = ...
    _references: list[tuple[str, Directory | File]] = ...
    _self_base_url: str | None = ...
    _self_out_dir: str | None = ...
    _self_root_dir: str | None = ...
    _self_root_dirs: list[str] = ...
    _self_paths: dict[str, list[str]] = ...
    _self_references: list[Directory | File] = ...
    _computed_path_import_aliases: bool = ...
    _path_import_aliases: dict[str, list[str]] = ...
    _reference_import_aliases: dict[str, list[str]] = ...
    _import_optimization_enabled: bool = ...
    def __init__(self, config_file: File, config_parser: TSConfigParser) -> None:
        ...
    
    def __repr__(self): # -> str:
        ...
    
    def translate_import_path(self, import_path: str) -> str:
        """Translates an import path to an absolute path using the tsconfig paths.

        Takes an import path and translates it to an absolute path using the configured paths in the tsconfig file. If the import
        path matches a path alias, it will be resolved according to the tsconfig paths mapping.

        For example, converts `@abc/my/pkg/src` to `a/b/c/my/pkg/src` or however it's defined in the tsconfig.

        Args:
            import_path (str): The import path to translate.

        Returns:
            str: The translated absolute path. If no matching path alias is found, returns the original import path unchanged.
        """
        ...
    
    def translate_absolute_path(self, absolute_path: str) -> str:
        """Translates an absolute path to an import path using the tsconfig paths.

        Takes an absolute path and translates it to an import path using the configured paths in the tsconfig file.

        For example, converts `a/b/c/my/pkg/src` to `@abc/my/pkg/src` or however it's defined in the tsconfig.

        Args:
            import_path (str): The absolute path to translate.

        Returns:
            str: The translated import path.
        """
        ...
    
    def resolve_base_url(self, import_path: str) -> str:
        """Resolves an import path with the base url.

        If a base url is not defined, try to resolve it with its base config.
        """
        ...
    
    @property
    def base_config(self) -> TSConfig | None:
        """Returns the base TSConfig that this config inherits from.

        Gets the base configuration file that this TSConfig extends. The base configuration is used for inheriting settings like paths, baseUrl,and other compiler options.

        Returns:
            TSConfig | None: The parent TSConfig object if this config extends another config file, None otherwise.
        """
        ...
    
    @property
    def base_url(self) -> str | None:
        """Returns the base URL defined in the TypeScript configuration.

        This property retrieves the baseUrl from the project's TypeScript configuration file.
        The baseUrl is used for resolving non-relative module names.

        Returns:
            str | None: The base URL if defined in the config file or inherited from a base config,
                None if not specified.
        """
        ...
    
    @property
    def out_dir(self) -> str | None:
        """Returns the outDir defined in the TypeScript configuration.

        The outDir specifies the output directory for all emitted files. When specified, .js (as well as .d.ts, .js.map, etc.)
        files will be emitted into this directory. The directory structure of the source files is preserved.

        Returns:
            str | None: The output directory path if specified in the config file or inherited from a base config,
                None if not specified.
        """
        ...
    
    @property
    def root_dir(self) -> str | None:
        """Returns the rootDir defined in the TypeScript configuration.

        The rootDir specifies the root directory of input files. This is used to control the output directory structure
        with outDir. When TypeScript compiles files, it maintains the directory structure of the source files relative
        to rootDir when generating output.

        Returns:
            str | None: The root directory path if specified in the config file or inherited from a base config,
                None if not specified.
        """
        ...
    
    @property
    def root_dirs(self) -> list[str]:
        """Returns the rootDirs defined in the TypeScript configuration.

        The rootDirs allows a list of root directories to be specified that are merged and treated as one virtual directory.
        This can be used when your project structure doesn't match your runtime expectations. For example, when you have
        both generated and hand-written source files that need to appear to be in the same directory at runtime.

        Returns:
            list[str]: A list of root directory paths specified in the config file or inherited from a base config.
                Returns an empty list if not specified.
        """
        ...
    
    @property
    def paths(self) -> dict[str, list[str]]:
        """Returns all custom module path mappings defined in the tsconfig file.

        Retrieves path mappings from both the current tsconfig file and any inherited base config file,
        translating all relative paths to absolute paths.

        Returns:
            dict[str, list[str]]: A dictionary mapping path patterns to lists of absolute path destinations.
                Each key is a path pattern (e.g., '@/*') and each value is a list of corresponding
                absolute path destinations.
        """
        ...
    
    @property
    def references(self) -> list[Directory | File]:
        """Returns a list of directories that this TypeScript configuration file depends on.

        The references are defined in the 'references' field of the tsconfig.json file. These directories
        are used to resolve import conflicts and narrow the search space for import resolution.

        Returns:
            list[Directory | File | TSConfig]: A list of Directory, File, or TSConfig objects representing the dependent directories.
        """
        ...
    
    @property
    def path_import_aliases(self) -> dict[str, list[str]]:
        """Returns a formatted version of the paths property from a TypeScript configuration file.

        Processes the paths dictionary by formatting path patterns and their corresponding target paths. All wildcards (*), trailing slashes, and double
        slashes are removed from both the path patterns and their target paths. Target paths are also converted from relative to absolute paths.

        Returns:
            dict[str, list[str]]: A dictionary where keys are formatted path patterns and values are lists of formatted absolute target paths.
        """
        ...
    
    @property
    def reference_import_aliases(self) -> dict[str, list[str]]:
        """Returns a formatted version of the references property from a TypeScript configuration file.

        Processes the references dictionary by formatting reference paths and their corresponding target paths. For each
        reference, retrieves its tsconfig file and path mappings. Also includes any path mappings inherited from base
        configs.

        Returns:
            dict[str, list[str]]: A dictionary where keys are formatted reference paths (e.g. 'module/dist') and values
                are lists of absolute target paths derived from the referenced tsconfig's rootDirs and outDir settings.
        """
        ...
    


