ADR 0010: Bounded retentive Svelte source adapter
Document status:
accepted. Canonical source.
Decision delegated to research on 2026-08-30. Evidence:
nuif:research:svelte-source-adapter-surface,
nuif:research:tree-sitter, and
nuif:research:dependency-and-subsystem-audit.
Context
Svelte source combines declarative markup with JavaScript, TypeScript, preprocessing, directives, blocks and component-scoped CSS. NUIF needs useful source interchange without claiming that static parsing reproduces an application runtime or rewriting unrelated developer source.
Decision
nuif-svelteimplements only the versionednuif-svelte-static-0profile. It maps regulardivcontainers andspanliteral text through explicitdata-nuif-*markers and a fixed inline-style vocabulary.tree-sitter-svelte-next0.1.1 supplies the production concrete syntax tree and UTF-8 byte ranges. It does not define Svelte semantics.- Exact official
svelte5.57.0 is the foreign parser/compiler oracle. It is test tooling only and never enters a NUIF deliverable. - Synchronization edits only recorded scalar spans, rejects stale or structural changes atomically, reparses the result, and requires canonical NUIF equality.
- Scripts, stylesheets, preprocessors, expressions, blocks, directives, components, special elements and dynamic attributes are outside profile zero. Top-level comments and whitespace may be retained but have no claimed semantic mapping. Other top-level nodes are rejected.
- Component CSS is deferred. A later profile must define selector ownership, cascade, specificity, Svelte scope hashing and source-locality rules before it can be accepted.
Rationale
The official compiler is the only suitable semantic authority, but its printer may normalize whitespace and quoting. A concrete syntax tree is therefore the right production mechanism for retained spans, while live official compilation prevents that community grammar from becoming a self-oracle. The broader unofficial Rust compiler adds a second semantic implementation and a much larger dependency graph without improving the deliberately static boundary.
Consequences
The adapter is useful for generated components and controlled developer tools, not arbitrary Svelte applications. Its conformance claim includes exact round-trip and byte-complement preservation plus pinned official parse/compile acceptance. Runtime rendering equivalence and general CSS equivalence remain unclaimed.