import type { AstroSettings } from '../../types/astro.js';
import type { AstroConfig, CspAlgorithm } from '../../types/public/index.js';
import type { BuildInternals } from '../build/internal.js';
import type { CspDirective, CspHash, CspHashEntry, CspResourceEntry } from './config.js';
type EnabledCsp = Exclude<AstroConfig['security']['csp'], false>;
export declare function shouldTrackCspHashes(csp: any): csp is EnabledCsp;
export declare function getAlgorithm(csp: EnabledCsp): CspAlgorithm;
export declare function getScriptResources(csp: EnabledCsp): CspResourceEntry[];
export declare function getScriptHashes(csp: EnabledCsp): CspHashEntry[];
export declare function getStyleResources(csp: EnabledCsp): CspResourceEntry[];
export declare function getStyleHashes(csp: EnabledCsp): CspHashEntry[];
export declare function getDirectives(settings: AstroSettings): CspDirective[];
export declare function getStrictDynamic(csp: EnabledCsp): boolean;
interface TrackCspHashesOptions {
    internals: BuildInternals;
    settings: AstroSettings;
    algorithm: CspAlgorithm;
}
export declare function trackStyleHashes({ internals, settings, algorithm, }: TrackCspHashesOptions): Promise<CspHash[]>;
export declare function trackScriptHashes({ internals, settings, algorithm, }: TrackCspHashesOptions): Promise<CspHash[]>;
interface TrackScriptIntegrityOptions {
    settings: AstroSettings;
    algorithm: CspAlgorithm;
    clientRoot: URL;
    /** Paths of the files in the client output directory, relative to `clientRoot`. */
    clientFiles: Iterable<string>;
    /** Query string the adapter appends to rendered asset URLs (`assetQueryParams`). */
    assetQueryString?: string;
}
interface ScriptIntegrity {
    /** JSON content of a `<script type="importmap">` whose `integrity` map covers every client script. */
    importMapContent: string;
    /** Hashes of every client script and of the import map itself, for `script-src`. */
    hashes: CspHash[];
}
/**
 * Hashes every JavaScript file Astro emitted under `build.assets` in the client output.
 *
 * Under `'strict-dynamic'`, browsers ignore `'self'`, so module scripts (`<script src>`, the chunks
 * they import, and the `import()` calls of islands) load only when their hash is in `script-src` and
 * the browser has integrity metadata for the request. An import map `integrity` entry provides that
 * metadata for every module request, including the root `<script src>`.
 *
 * Returns `undefined` when the client output has no scripts.
 */
export declare function trackScriptIntegrity({ settings, algorithm, clientRoot, clientFiles, assetQueryString, }: TrackScriptIntegrityOptions): Promise<ScriptIntegrity | undefined>;
export {};
