import { type TasmJSONInfo } from './webEncoder.js'; /** * A construct the bundle format cannot carry, reported rather than hidden. */ export interface DiscardedAtRule { /** The at-rule's name, with its `@`, e.g. `@media`. */ name: string; /** * Why it cannot be carried. * * `unrepresentable` - Lynx's style format has no rule kind for it. * `unsupported` - the CSS parser has no case for it, so it never even reached * this module. Its contents are gone with it. * `unresolvable` - the construct exists in the format but this document cannot * express it, which currently means only `@import` with a URL. */ reason: 'unrepresentable' | 'unsupported' | 'unresolvable'; } /** * Finds every at-rule in `source` that will not survive into the bundle. * * Needed because the two kinds of loss are invisible from different places: an * `@media` node reaches {@link stripUnrepresentable} and can be counted there, * but a `@property` never becomes a node at all, so the only way to know it was * written is to look at the source. `css-serializer` re-exports the `css-tree` * it already depends on, so this costs a parse but no new dependency. * * Reported at any nesting depth, since a group's contents are dropped with it. */ export declare function diagnoseDiscardedAtRules(source: string): DiscardedAtRule[]; /** * What {@link xmlToTasmJSON} produces. */ export type XMLToTasmJSONResult = { success: true; tasmJSON: TasmJSONInfo; /** At-rules that will not appear in the bundle, empty when there are none. */ discarded: DiscardedAtRule[]; } | { success: false; /** The parser's message, formatted like the reference implementation. */ message: string; }; /** * Translates a Lynx XML document into {@link encode}'s input. * * Returns the parser's structured error instead of throwing, so a caller can * report it however it likes. */ export declare function xmlToTasmJSON(source: string): XMLToTasmJSONResult; /** * Builds a `.web.bundle` from a Lynx XML markup document. * * The bytes are an ordinary modern bundle - see the note at the top of the file * - so the existing decoder consumes them with no markup-specific handling. * * Discarded at-rules are reported on the console as well as returned, because * the common caller is a build script that would otherwise drop the information * on the floor. */ export declare function encodeLynxXML(source: string): { success: true; buffer: Uint8Array; discarded: DiscardedAtRule[]; } | { success: false; message: string; };