import * as _alepha_core1 from "alepha";
import * as _alepha_core0 from "alepha";
import { Alepha, Descriptor, KIND, Logger } from "alepha";
import { ServerHandler, ServerRouterProvider } from "alepha/server";
import { DateTimeProvider, DurationLike } from "alepha/datetime";

//#region src/descriptors/$serve.d.ts
/**
 * Create a new static file handler.
 */
declare const $serve: {
  (options?: ServeDescriptorOptions): ServeDescriptor;
  [KIND]: typeof ServeDescriptor;
};
interface ServeDescriptorOptions {
  /**
   * Prefix for the served path.
   *
   * @default "/"
   */
  path?: string;
  /**
   * Path to the directory to serve.
   *
   * @default process.cwd()
   */
  root?: string;
  /**
   * If true, descriptor will be ignored.
   *
   * @default false
   */
  disabled?: boolean;
  /**
   * Whether to keep dot files (e.g. `.gitignore`, `.env`) in the served directory.
   *
   * @default true
   */
  ignoreDotEnvFiles?: boolean;
  /**
   * Whether to use the index.html file when the path is a directory.
   *
   * @default true
   */
  indexFallback?: boolean;
  /**
   * Force all requests "not found" to be served with the index.html file.
   * This is useful for single-page applications (SPAs) that use client-side only routing.
   */
  historyApiFallback?: boolean;
  /**
   * Optional name of the descriptor.
   * This is used for logging and debugging purposes.
   *
   * @default Key name.
   */
  name?: string;
  /**
   * Whether to use cache control headers.
   *
   * @default {}
   */
  cacheControl?: Partial<CacheControlOptions> | false;
}
interface CacheControlOptions {
  /**
   * Whether to use cache control headers.
   *
   * @default [.js, .css]
   */
  fileTypes: string[];
  /**
   * The maximum age of the cache in seconds.
   *
   * @default 60 * 60 * 24 * 2 // 2 days
   */
  maxAge: DurationLike;
  /**
   * Whether to use immutable cache control headers.
   *
   * @default true
   */
  immutable: boolean;
}
declare class ServeDescriptor extends Descriptor<ServeDescriptorOptions> {}
//# sourceMappingURL=$serve.d.ts.map
//#endregion
//#region src/providers/ServerStaticProvider.d.ts
declare class ServerStaticProvider {
  protected readonly alepha: Alepha;
  protected readonly routerProvider: ServerRouterProvider;
  protected readonly dateTimeProvider: DateTimeProvider;
  protected readonly log: Logger;
  protected readonly directories: ServeDirectory[];
  protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
  createStaticServer(options: ServeDescriptorOptions): Promise<void>;
  createFileHandler(filepath: string, options: ServeDescriptorOptions): Promise<ServerHandler>;
  protected getCacheFileTypes(): string[];
  protected getCacheControl(filename: string, options: ServeDescriptorOptions): {
    maxAge: number;
    immutable: boolean;
  } | undefined;
  getAllFiles(dir: string, ignoreDotEnvFiles?: boolean): Promise<string[]>;
}
interface ServeDirectory {
  options: ServeDescriptorOptions;
  files: string[];
}
//# sourceMappingURL=ServerStaticProvider.d.ts.map
//#endregion
//#region src/index.d.ts
/**
 * Create static file server with `$static()`.
 *
 * @see {@link ServerStaticProvider}
 * @module alepha.server.static
 */
declare const AlephaServerStatic: _alepha_core0.Service<_alepha_core0.Module>;
//# sourceMappingURL=index.d.ts.map

//#endregion
export { $serve, AlephaServerStatic, CacheControlOptions, ServeDescriptor, ServeDescriptorOptions, ServeDirectory, ServerStaticProvider };
//# sourceMappingURL=index.d.ts.map