/** * XmlCanonical — Canonical XML 1.0 and Exclusive Canonical XML * * v1.7.0 performance improvements: * • _serializeElement: replaced new Map(ctx.nsScope) / new Map(ctx.renderedNs) full * clones (O(scope-size) per element) with delta-based save/restore — only the * keys mutated on each element are saved and restored (O(decls-on-element)). * • _normalizeText / _escapeAttrValue: collapsed chained .replace() calls into a * single regex pass with a replacer function, reducing string allocations. * • ns-sort comparator hoisted to a module-level constant to avoid closure alloc. * • regularAttrs array reused across calls where possible via pre-sized push. * • Subtree memoization via WeakMap: when the same element * is serialized multiple times within the same canonicalize() call (e.g. * diffXml comparing shared subtrees), the cached string is returned directly. * Cache key is (element, mode, withComments) — invalidated automatically when * the element is garbage-collected. * * G30 — v1.7.0 / v1.7.0 */ import { XmlDocument, XmlElement } from '../parser/XmlNodes'; /** C14N mode */ export type CanonicalizeMode = 'inclusive' | 'exclusive'; export interface CanonicalizeOptions { /** * 'inclusive' (default): all in-scope namespace declarations rendered on every element. * 'exclusive': only namespace declarations that are actually used in the subtree. */ mode?: CanonicalizeMode; /** * Exclusive C14N only: namespace prefixes in this list are always rendered even * if not directly used (xs:InclusiveNamespaces/@PrefixList). */ inclusiveNamespaces?: string[]; /** * When true, comments are preserved in output. Default: false. */ withComments?: boolean; } /** * Serialize `input` (document or element subtree) to Canonical XML form. * * @example * const c14n = canonicalize(parseXml(xmlStr)); * // → deterministic, comparable byte sequence */ export declare function canonicalize(input: XmlDocument | XmlElement, options?: CanonicalizeOptions): string; /** * Clear the subtree serialization cache. * No-op in current implementation — cache is per-invocation. * Retained for API compatibility. */ export declare function clearCanonicalCache(): void; //# sourceMappingURL=XmlCanonical.d.ts.map