/// <reference types="node" />
import type { WriteStream } from 'node:tty';
import type { IComponentsManagerBuilderOptions } from 'componentsjs';
import { ComponentsManager } from 'componentsjs';
import type { App } from './App';
import type { CliArgv, Shorthand, VariableBindings } from './variables/Types';
/**
 * Parameters that can be used to instantiate the server through code.
 */
export interface AppRunnerInput {
    /**
     * Properties that will be used when building the Components.js manager.
     * Default values:
     *  - `typeChecking`: `false`, as the server components would otherwise error.
     *  - `mainModulePath`: `@css:`, which resolves to the directory of the CSS package.
     *                      This is useful for packages that depend on the CSS
     *                      but do not create any new modules themselves.
     */
    loaderProperties?: Partial<IComponentsManagerBuilderOptions<App>>;
    /**
     * Path to the server config file(s). Defaults to `@css:config/default.json`.
     */
    config?: string | string[];
    /**
     * Values to apply to the Components.js variables.
     * These are the variables CLI values will be converted to.
     * The keys should be the variable URIs.
     * E.g.: `{ 'urn:solid-server:default:variable:rootFilePath': '.data' }`.
     */
    variableBindings?: VariableBindings;
    /**
     * CLI argument names and their corresponding values.
     * E.g.: `{ rootFilePath: '.data' }`.
     * Abbreviated parameter names can not be used, so `{ f: '.data' }` would not work.
     *
     * In case both `shorthand` and `variableBindings` have entries that would result in a value for the same variable,
     * `variableBindings` has priority.
     */
    shorthand?: Shorthand;
    /**
     * An array containing CLI arguments passed to start the process.
     * Entries here have the lowest priority for assigning values to variables.
     */
    argv?: string[];
}
/**
 * A class that can be used to instantiate and start a server based on a Component.js configuration.
 */
export declare class AppRunner {
    private readonly logger;
    /**
     * Starts the server with a given config.
     *
     * @param input - All values necessary to configure the server.
     */
    run(input: AppRunnerInput): Promise<void>;
    /**
     * Returns an App object, created with the given config, that can start and stop the Solid server.
     *
     * @param input - All values necessary to configure the server.
     */
    create(input?: AppRunnerInput): Promise<App>;
    /**
     * Starts the server as a command-line application.
     * Will exit the process on failure.
     *
     * Made non-async to lower the risk of unhandled promise rejections.
     * This is only relevant when this is used to start as a Node.js application on its own,
     * if you use this as part of your code you probably want to use the async version.
     *
     * @param argv - Input parameters.
     * @param argv.argv - Command line arguments.
     * @param argv.stderr - Stream that should be used to output errors before the logger is enabled.
     */
    runCliSync({ argv, stderr }: {
        argv?: CliArgv;
        stderr?: WriteStream;
    }): void;
    /**
     * Starts the server as a command-line application.
     *
     * @param argv - Command line arguments.
     */
    runCli(argv?: CliArgv): Promise<void>;
    /**
     * Returns an App object, created by parsing the Command line arguments, that can start and stop the Solid server.
     * Will exit the process on failure.
     *
     * @param argv - Command line arguments.
     */
    createCli(argv?: CliArgv): Promise<App>;
    /**
     * Retrieves settings from package.json or configuration file when
     * part of an npm project.
     * @returns The settings defined in the configuration file
     */
    getPackageSettings(): Promise<undefined | Record<string, unknown>>;
    /**
     * Creates the Components Manager that will be used for instantiating.
     */
    createComponentsManager<T>(loaderProperties: IComponentsManagerBuilderOptions<T>, configs: string[]): Promise<ComponentsManager<T>>;
    /**
     * Instantiates the {@link CliResolver}.
     */
    private createCliResolver;
    /**
     * Uses the {@link CliExtractor} to convert the CLI args to a {@link Shorthand} object.
     */
    private extractShorthand;
    /**
     * Uses the {@link ShorthandResolver} to convert {@link Shorthand} to {@link VariableBindings} .
     */
    private resolveShorthand;
    /**
     * The second Components.js instantiation,
     * where the App is created and started using the variable mappings.
     */
    private createApp;
    /**
     * Throws a new error that provides additional information through the extra message.
     * Also appends the stack trace to the message.
     * This is needed for errors that are thrown before the logger is created as we can't log those the standard way.
     */
    private resolveError;
}
