rfw_catalog_compiler 1.1.0
rfw_catalog_compiler: ^1.1.0 copied to clipboard
Analyzer-backed compiler pipeline for producing Remote Flutter Widget catalog IR, allocating stable wire IDs, and lowering to the public catalog schema.
rfw_catalog_compiler #
Analyzer-backed compiler pipeline that turns annotated Dart widget libraries
into a Remote Flutter Widget (RFW) catalog. It walks a customer's
@RestageLibrary / @RestageWidget source with the Dart analyzer, builds an
internal IR, allocates stable wire IDs, and lowers the result to the public
rfw_catalog_schema wire shape: the durable contract that authoring tools, SDK
runtimes, and backends decode.
A catalog produced here describes the widget vocabulary available to any server-driven UI surface, independent of which surface is being rendered.
What this package contains #
- Source walker. Analyzer-backed passes over annotated Dart libraries.
walkRestageLibraryreads a barrel's@RestageLibrarydeclaration and collects its exported@RestageWidgetclasses;walkStructuredTypedecomposes structured types (records, named-constructor variants) andresolveUnionresolves discriminated unions.classifyStructured, the value-shape resolver, the default-value resolver (constant evaluation, theme-binding and static-const member resolution), and a stable set of walker issue codes back these passes. - Internal IR. Typed intermediate-representation nodes for widgets, properties, structured types, unions, design tokens, factory variants, decomposition recipes, provenance, policy decisions, and diagnostics.
- Lowering.
lowerStructuredandlowerUnion(and the catalog-level lowering they compose into) translate compiler IR to the canonicalrfw_catalog_schematypes —Catalog,WidgetEntry,StructuredEntry,UnionEntry, and the rest. - Wire-ID allocation. An append-only event log, replay, and current-state
materialization that mints stable, monotonic
WireIds and re-uses the recorded ID for an entry that already exists, so identity survives across regenerations. Backfill helpers re-attach recorded IDs to a freshly walked catalog, and a cross-reference linker applies allocated IDs to post-allocation reference sites with explicit duplicate-key detection. - Compatibility diff. Per-entry change detection between two catalog
versions, a forwarding/breaking compatibility classifier, and
CompatRuleemission: the tooling that decides whether a regenerated catalog is a safe forwarding change. - Policy layer. Deny-lists, category and design-token heuristics, mutex rules, metadata inference, stability classification, and the structured-walk policy, with the built-in default content the compiler ships with, recorded through a policy ledger.
- Reflector adapter. An integration surface that drives the walk, IR build, lowering, and wire-ID resolution from the reflector/codegen build step, including resolver hooks for widget, property, structured, union, and deprecation identity.
Status #
The package is at 1.0.0. The barrel re-exports the walker, lowering,
wire-ID, diff, link, policy, and adapter entry points used for reflector
integration; the full IR remains internal under src/ir.
License #
Licensed under the Functional Source License, Version 1.1, ALv2 Future License
(FSL-1.1-ALv2): free for all use except building a competing product; each
release automatically becomes Apache-2.0 two years after publication. See
LICENSE for the full terms.