import { W as WritenexConfig, C as CollectionConfig, e as SchemaField, f as SingletonConfig } from './config-CWvboaLE.js'; import { z } from 'zod'; import { F as FieldDefinition } from './fields-CRJ9lwHf.js'; /** * @fileoverview Configuration loader for @writenex/astro * * This module handles loading Writenex configuration from various sources: * - writenex.config.ts (TypeScript) * - writenex.config.js (JavaScript) * - writenex.config.mjs (ES Module) * * The loader searches for configuration files in the project root and * applies default values for any missing options. * * @module @writenex/astro/config/loader */ /** * Result of loading configuration */ interface LoadConfigResult { /** The loaded and validated configuration with defaults applied */ config: Required; /** Path to the configuration file (if found) */ configPath: string | null; /** Whether a configuration file was found */ hasConfigFile: boolean; /** Any warnings generated during loading */ warnings: string[]; } /** * Find the configuration file in the project root * * @param projectRoot - The root directory of the Astro project * @returns Path to the configuration file, or null if not found */ declare function findConfigFile(projectRoot: string): string | null; /** * Load Writenex configuration from the project root * * This function: * 1. Searches for a configuration file in the project root * 2. Loads and validates the configuration if found * 3. Applies default values for any missing options * 4. Returns the resolved configuration * * If no configuration file is found, default configuration is returned * with auto-discovery enabled. * * @param projectRoot - The root directory of the Astro project * @returns LoadConfigResult with the resolved configuration * * @example * ```typescript * const { config, hasConfigFile, warnings } = await loadConfig('/path/to/project'); * * if (!hasConfigFile) { * console.log('Using auto-discovery mode'); * } * * if (warnings.length > 0) { * warnings.forEach(w => console.warn(w)); * } * ``` */ declare function loadConfig(projectRoot: string): Promise; /** * Check if a content directory exists in the project * * @param projectRoot - The root directory of the Astro project * @param contentPath - Relative path to the content directory * @returns True if the content directory exists */ declare function contentDirectoryExists(projectRoot: string, contentPath?: string): boolean; /** * @fileoverview Configuration schema and validation for @writenex/astro * * This module provides Zod schemas for validating Writenex configuration * and a helper function for defining type-safe configurations. * * @module @writenex/astro/config/schema */ declare const fieldTypeSchema: z.ZodEnum<{ string: "string"; number: "number"; boolean: "boolean"; object: "object"; slug: "slug"; url: "url"; integer: "integer"; select: "select"; multiselect: "multiselect"; checkbox: "checkbox"; date: "date"; datetime: "datetime"; image: "image"; file: "file"; array: "array"; blocks: "blocks"; relationship: "relationship"; "path-reference": "path-reference"; markdoc: "markdoc"; mdx: "mdx"; conditional: "conditional"; child: "child"; "cloud-image": "cloud-image"; empty: "empty"; "empty-content": "empty-content"; "empty-document": "empty-document"; ignored: "ignored"; }>; declare const validationSchema: z.ZodOptional; min: z.ZodOptional; max: z.ZodOptional; minLength: z.ZodOptional; maxLength: z.ZodOptional; pattern: z.ZodOptional; patternDescription: z.ZodOptional; }, z.core.$strip>>; type SchemaFieldInput = { type: z.infer; required?: boolean; default?: unknown; items?: string; description?: string; label?: string; options?: string[]; directory?: string; publicPath?: string; validation?: z.infer; fields?: Record; itemField?: SchemaFieldInput; blockTypes?: Record; collection?: string; multiline?: boolean; format?: string; itemLabel?: string; matchField?: string; matchValue?: unknown; showField?: SchemaFieldInput; accept?: string; allowExternal?: boolean; inline?: boolean; }; declare const writenexConfigSchema: z.ZodObject<{ collections: z.ZodOptional; previewUrl: z.ZodOptional; schema: z.ZodOptional>>>; images: z.ZodOptional; publicPath: z.ZodOptional; storagePath: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>>; singletons: z.ZodOptional; schema: z.ZodOptional>>>; images: z.ZodOptional; publicPath: z.ZodOptional; storagePath: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>>; images: z.ZodOptional; publicPath: z.ZodOptional; storagePath: z.ZodOptional; }, z.core.$strip>>; editor: z.ZodOptional; autosaveInterval: z.ZodOptional; }, z.core.$strip>>; discovery: z.ZodOptional>; }, z.core.$strip>>; versionHistory: z.ZodOptional; maxVersions: z.ZodOptional; storagePath: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; declare const writenexOptionsSchema: z.ZodObject<{ allowProduction: z.ZodOptional; }, z.core.$strip>; type SchemaInput = Record; type CollectionConfigInput = Omit & { schema?: SchemaInput; }; type SingletonConfigInput = Omit & { schema?: SchemaInput; }; type WritenexConfigInput = Omit & { collections?: CollectionConfigInput[]; singletons?: SingletonConfigInput[]; }; declare function defineConfig(config: WritenexConfigInput): WritenexConfig; declare function validateConfig(config: unknown): { success: true; data: WritenexConfig; } | { success: false; error: z.ZodError; }; export { type LoadConfigResult as L, type WritenexConfigInput as W, writenexOptionsSchema as a, contentDirectoryExists as c, defineConfig as d, findConfigFile as f, loadConfig as l, validateConfig as v, writenexConfigSchema as w };