import type { AstroConfig } from '../types/public/config.js'; import { type Preferences, type PublicPreferences } from './defaults.js'; type DotKeys = T extends object ? { [K in keyof T]: `${Exclude}${DotKeys extends never ? '' : `.${DotKeys}`}`; }[keyof T] : never; type GetDotKey, K extends string> = K extends `${infer U}.${infer Rest}` ? GetDotKey : T[K]; type PreferenceLocation = 'global' | 'project'; interface PreferenceOptions { location?: PreferenceLocation; /** * If `true`, the server will be reloaded after setting the preference. * If `false`, the server will not be reloaded after setting the preference. * * Defaults to `true`. */ reloadServer?: boolean; } type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; } : T; export type PreferenceKey = DotKeys; interface PreferenceList extends Record> { fromAstroConfig: DeepPartial; defaults: PublicPreferences; } export interface AstroPreferences { get(key: Key, opts?: PreferenceOptions): Promise>; set(key: Key, value: GetDotKey, opts?: PreferenceOptions): Promise; getAll(): Promise; list(opts?: PreferenceOptions): Promise; ignoreNextPreferenceReload: boolean; } export declare function isValidKey(key: string): key is PreferenceKey; export declare function coerce(key: string, value: unknown): any; export default function createPreferences(config: AstroConfig, dotAstroDir: URL): AstroPreferences; export {};