/// <reference types="node" />
import matter from 'gray-matter';
import fsMod from 'node:fs';
import type { EmitFile } from 'rollup';
import { ViteDevServer } from 'vite';
import { z } from 'zod';
import type { AstroConfig, AstroSettings } from '../@types/astro.js';
export declare const collectionConfigParser: z.ZodObject<{
    schema: z.ZodOptional<z.ZodAny>;
}, "strip", z.ZodTypeAny, {
    schema?: any;
}, {
    schema?: any;
}>;
export declare function getDotAstroTypeReference({ root, srcDir }: {
    root: URL;
    srcDir: URL;
}): string;
export declare const contentConfigParser: z.ZodObject<{
    collections: z.ZodRecord<z.ZodString, z.ZodObject<{
        schema: z.ZodOptional<z.ZodAny>;
    }, "strip", z.ZodTypeAny, {
        schema?: any;
    }, {
        schema?: any;
    }>>;
}, "strip", z.ZodTypeAny, {
    collections: Record<string, {
        schema?: any;
    }>;
}, {
    collections: Record<string, {
        schema?: any;
    }>;
}>;
export type CollectionConfig = z.infer<typeof collectionConfigParser>;
export type ContentConfig = z.infer<typeof contentConfigParser>;
type EntryInternal = {
    rawData: string;
    filePath: string;
};
export type EntryInfo = {
    id: string;
    slug: string;
    collection: string;
};
export declare const msg: {
    collectionConfigMissing: (collection: string) => string;
};
/**
 * Mutate (arf) the entryData to reroute assets to their final paths
 */
export declare function patchAssets(frontmatterEntry: Record<string, any>, watchMode: boolean, fileEmitter: EmitFile, astroSettings: AstroSettings): Promise<void>;
export declare function getEntrySlug({ id, collection, slug, unvalidatedSlug, }: EntryInfo & {
    unvalidatedSlug?: unknown;
}): string;
export declare function getEntryData(entry: EntryInfo & {
    unvalidatedData: Record<string, unknown>;
    _internal: EntryInternal;
}, collectionConfig: CollectionConfig): Promise<{
    [x: string]: unknown;
}>;
export declare function getContentEntryExts(settings: Pick<AstroSettings, 'contentEntryTypes'>): string[];
export declare class NoCollectionError extends Error {
}
export declare function getEntryInfo(params: Pick<ContentPaths, 'contentDir'> & {
    entry: URL;
    allowFilesOutsideCollection?: true;
}): EntryInfo;
export declare function getEntryType(entryPath: string, paths: Pick<ContentPaths, 'config' | 'contentDir'>, contentFileExts: string[]): 'content' | 'config' | 'ignored' | 'unsupported';
/**
 * Match YAML exception handling from Astro core errors
 * @see 'astro/src/core/errors.ts'
 */
export declare function parseFrontmatter(fileContents: string, filePath: string): matter.GrayMatterFile<string>;
/**
 * The content config is loaded separately from other `src/` files.
 * This global observable lets dependent plugins (like the content flag plugin)
 * subscribe to changes during dev server updates.
 */
export declare const globalContentConfigObserver: ContentObservable;
export declare function loadContentConfig({ fs, settings, viteServer, }: {
    fs: typeof fsMod;
    settings: AstroSettings;
    viteServer: ViteDevServer;
}): Promise<ContentConfig | undefined>;
type ContentCtx = {
    status: 'init';
} | {
    status: 'loading';
} | {
    status: 'does-not-exist';
} | {
    status: 'loaded';
    config: ContentConfig;
} | {
    status: 'error';
    error: Error;
};
type Observable<C> = {
    get: () => C;
    set: (ctx: C) => void;
    subscribe: (fn: (ctx: C) => void) => () => void;
};
export type ContentObservable = Observable<ContentCtx>;
export declare function contentObservable(initialCtx: ContentCtx): ContentObservable;
export type ContentPaths = {
    contentDir: URL;
    assetsDir: URL;
    cacheDir: URL;
    typesTemplate: URL;
    virtualModTemplate: URL;
    config: {
        exists: boolean;
        url: URL;
    };
};
export declare function getContentPaths({ srcDir, root }: Pick<AstroConfig, 'root' | 'srcDir'>, fs?: typeof fsMod): ContentPaths;
export {};
