/** * Source filter accepted by every first-party adapter's `include` and * `exclude` options. * * A string is a glob. Relative globs resolve from the adapter's * `projectRoot`; absolute globs and globs that start with `**` match as * written. A RegExp is tested against the normalized absolute file path. * `null` and `undefined` mean "no pattern". This is the same contract as * Vite's `FilterPattern` and `createFilter()`. */ type PalamedesFilterPattern = string | RegExp | ReadonlyArray | null | undefined; /** Options for {@link createPalamedesSourceFilter}. */ type PalamedesSourceFilterOptions = { /** Directory that relative glob patterns resolve from. */ projectRoot: string; }; /** Return whether a module ID passes the configured `include`/`exclude` filter. */ type PalamedesSourceFilter = (id: string) => boolean; /** * Resolve an adapter's `projectRoot` option. Relative values resolve from the * current working directory; an unset value uses `fallback`. */ declare function resolvePalamedesProjectRoot(projectRoot: string | undefined, fallback?: string): string; /** * Resolve an adapter's `configPath` option against its project root. * * Every adapter uses this rule: a relative `configPath` resolves from * `projectRoot`, and an absolute one stays as written. Returns `undefined` * when no config path is set, so callers keep automatic config discovery. */ declare function resolvePalamedesConfigPath(projectRoot: string, configPath: string | undefined): string | undefined; /** * Create the shared `include`/`exclude` source filter. * * IDs are normalized to forward slashes before matching. IDs that contain a * NUL byte (virtual modules) never match. An exclude match wins over an * include match, and an empty include list accepts every ID that is not * excluded. */ declare function createPalamedesSourceFilter(include: PalamedesFilterPattern, exclude: PalamedesFilterPattern, options: PalamedesSourceFilterOptions): PalamedesSourceFilter; declare const CONFIG_FILENAMES: readonly ["palamedes.yaml", "palamedes.yml", "palamedes.json", "palamedes.toml", "palamedes.config.ts", "palamedes.config.js", "palamedes.config.mjs", "palamedes.config.cjs"]; type PalamedesFallbackLocales = string[] | Record; type PalamedesSourceReferenceRoot = "git" | "lingui" | "config" | (string & {}); type PalamedesPoOutputOptions = { lineBreaks?: "auto" | "off"; }; type PalamedesCatalogConfig = { path: string; format?: "po" | "fcl"; po?: PalamedesPoOutputOptions; include: string[]; exclude?: string[]; }; type PalamedesMdxConfig = { framework?: "react" | "solid"; translatableAttributes?: string[]; frontMatterFields?: string[]; transModule?: string; runtimeModule?: string; ignoreDirective?: string; /** * Include authored source messages in generated MDX modules as diagnostic * source metadata. Defaults to `false`; it never supplies runtime output. */ includeSourceMetadata?: boolean; }; type PalamedesSourceRuleLevel = "off" | "info" | "warning" | "error"; type PalamedesLintConfig = { rules?: { placeholderOnly?: PalamedesSourceRuleLevel; emptyComponentOnly?: PalamedesSourceRuleLevel; preferTransInJsx?: PalamedesSourceRuleLevel; }; }; type PalamedesPluginDeclaration = string | readonly [specifier: string, options: unknown]; type PalamedesConfig = { locales: string[]; sourceLocale: string; fallbackLocales?: PalamedesFallbackLocales; pseudoLocale?: string; sourceReferenceRoot?: PalamedesSourceReferenceRoot; referenceScopes?: boolean; mdx?: PalamedesMdxConfig; lint?: PalamedesLintConfig; catalogs: PalamedesCatalogConfig[]; plugins?: PalamedesPluginDeclaration[]; }; type LoadedPalamedesConfig = { /** * Real paths whose contents contributed to this resolved configuration. * Populated by the loaders; optional for compatibility with caller-created values. */ configDependencies?: string[]; configPath: string; rootDir: string; sourceReferenceRoot: string; referenceScopes: boolean; } & Omit; type ConfigDependencyInput = Pick; /** Return the files whose contents define a loaded configuration. */ declare function getConfigDependencies(config: ConfigDependencyInput): string[]; /** * Hash a configuration's dependency paths and contents in a stable order. * * The path and content separators are part of the cache contract: keep them * unchanged so framework integrations invalidate identically on every host. */ declare function digestConfig(config: ConfigDependencyInput): string; type LoadPalamedesConfigOptions = { /** * Directory where config discovery starts and that a relative `configPath` * resolves from. Defaults to the current working directory. */ projectRoot?: string; /** Explicit config file, absolute or relative to `projectRoot`. */ configPath?: string; skipValidation?: boolean; }; declare function defineConfig(config: PalamedesConfig): PalamedesConfig; declare function loadPalamedesConfig(options?: LoadPalamedesConfigOptions): Promise; declare function loadPalamedesConfigSync(options?: LoadPalamedesConfigOptions): LoadedPalamedesConfig; declare function resolveCatalogPath(config: Pick, catalogPath: string, locale: string): string; declare function resolveConfigPattern(config: Pick, pattern: string): string; /** * Whether a source file belongs to a configured catalog. * * This is shared by the Vite and Next integrations. Dot-prefixed source path * segments intentionally match, matching Vite's historic filter behavior. */ declare function catalogMatchesSource(config: Pick, catalog: PalamedesCatalogConfig, sourcePath: string): boolean; /** Resolve a configured catalog to its locale-specific on-disk resource path. */ declare function catalogResourcePath(config: Pick, catalog: PalamedesCatalogConfig, locale: string): string; declare function expandFallbackLocales(locales: readonly string[], fallbackLocales?: PalamedesFallbackLocales): Record; export { CONFIG_FILENAMES, catalogMatchesSource, catalogResourcePath, createPalamedesSourceFilter, defineConfig, digestConfig, expandFallbackLocales, getConfigDependencies, loadPalamedesConfig, loadPalamedesConfigSync, resolveCatalogPath, resolveConfigPattern, resolvePalamedesConfigPath, resolvePalamedesProjectRoot }; export type { LoadPalamedesConfigOptions, LoadedPalamedesConfig, PalamedesCatalogConfig, PalamedesConfig, PalamedesFallbackLocales, PalamedesFilterPattern, PalamedesLintConfig, PalamedesMdxConfig, PalamedesPluginDeclaration, PalamedesPoOutputOptions, PalamedesSourceFilter, PalamedesSourceFilterOptions, PalamedesSourceReferenceRoot, PalamedesSourceRuleLevel };