import { NativeTransformOptions } from '@palamedes/core-node'; export { CatalogCompileArtifactResult, CatalogDiagnostic, CatalogLoaderOptions, CatalogLoaderResult, CatalogSourceKey, MissingCatalogMessage, createCatalogLoaderResult, createCompileErrorMessage, createDiagnosticMessage, createMissingErrorMessage, renderCatalogModule } from './catalogLoader.js'; /** * Source map interface (compatible with standard source map format) */ type SourceMap = { version: number; sources: string[]; sourcesContent?: (string | null)[]; names: string[]; mappings: string; file?: string; }; /** * Configuration options for the Palamedes native transform. */ type TransformOptions = NativeTransformOptions; /** * Result of a transform operation */ type TransformResult = { /** * The transformed source code */ code: string; /** * Whether the code was modified */ hasChanged: boolean; /** * Stable compiled runtime IDs referenced by the transformed module. */ compiledIds: string[]; /** * Source map for the transformation. */ map: SourceMap | null; }; /** * Palamedes macro package names that we recognize */ declare const PALAMEDES_MACRO_PACKAGES: readonly ["@palamedes/core/macro", "@palamedes/react/macro", "@palamedes/remix/macro", "@palamedes/solid/macro"]; /** * Default source filter for bundler integrations that can transform both ESM * and CommonJS modules. * * Loader-only integrations may intentionally use a narrower filter when their * host cannot execute the ESM imports emitted by the macro transform. */ declare const PALAMEDES_BUNDLER_TRANSFORM_INCLUDE: RegExp; /** * JS macro function names */ declare const JS_MACROS: readonly ["t", "plural", "select", "selectOrdinal"]; /** * JSX macro component names */ declare const JSX_MACROS: readonly ["Trans", "Plural", "Select", "SelectOrdinal"]; declare function transformPalamedesMacros(code: string, filename: string, options?: TransformOptions): TransformResult; /** * Detection utilities to check if a file contains Palamedes macros */ type ImportInfo = { localName: string; importedName: string; source: string; }; /** * Quickly check if code might contain Palamedes macro imports. * This is a fast pre-check before parsing to avoid unnecessary work. */ declare function mightContainPalamedesMacros(code: string): boolean; /** * Find all Palamedes macro imports in an AST */ declare function findMacroImports(program: unknown): Map; /** * Framework selection shared by the bundler plugins. * * Which UI framework an app uses is a compilation concern, not a catalog one: * extracted messages are identical for React and Solid, so `palamedes.yaml` * deliberately says nothing about it. The plugins own the choice instead, and * derive framework-dependent component defaults from this single option. * Locale is fixed for the lifetime of a document. Macro calls always use the * framework-neutral, hook-free runtime getter. */ /** * UI framework a Palamedes plugin compiles for. * * This selects component and MDX compilation contracts only. */ type PalamedesFramework = "react" | "solid" | "none"; /** * Resolve the module the macro transform imports the runtime getter from. * * An explicit `runtimeModule` always wins, preserving advanced custom bindings. */ declare function resolveMacroRuntimeModule(runtimeModule?: string): string; /** * Framework value to hand to MDX compilation, or `undefined` when the plugin * is not compiling for a UI framework and MDX should keep its own default. */ declare function mdxFrameworkFor(framework: PalamedesFramework): "react" | "solid" | undefined; export { JSX_MACROS, JS_MACROS, PALAMEDES_BUNDLER_TRANSFORM_INCLUDE, PALAMEDES_MACRO_PACKAGES, findMacroImports, mdxFrameworkFor, mightContainPalamedesMacros, resolveMacroRuntimeModule, transformPalamedesMacros }; export type { PalamedesFramework, SourceMap, TransformOptions, TransformResult };