Documentation
    Preparing search index...

    IndexGeneratorSource handles the generation of a single index file.

    This class is responsible for scanning a source directory, processing files according to configuration, and generating an index file that exports the discovered modules. It supports both barrel file generation and custom generation strategies.

    const source = new IndexGeneratorSource(appRoot, {
    source: 'app/controllers',
    output: 'app/controllers/index.ts',
    as: 'barrelFile',
    exportName: 'controllers'
    })
    await source.generate()
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    name: string

    Unique name for this index generator source

    Methods

    • Set the logger instance used for CLI output

      Parameters

      • cliLogger: Logger

        New logger instance to use

      Returns void

    • Add a file to the virtual file system and regenerate index if needed

      If the file matches the configured glob patterns, it will be added to the virtual file system and the index file will be regenerated.

      Parameters

      • filePath: string

        Absolute path of the file to add

      Returns Promise<void>

    • Remove a file from the virtual file system and regenerate index if needed

      If the file was previously tracked, it will be removed from the virtual file system and the index file will be regenerated.

      Parameters

      • filePath: string

        Absolute path of the file to remove

      Returns Promise<void>

    • Generate the index file

      This method scans the source directory, processes files according to the configuration, and writes the generated index file to disk.

      Returns Promise<void>