Skip to main content

omena_transform_passes/
lib.rs

1//! Transform pass registry and DAG planner for the post-v5 omena-css track.
2//!
3//! This crate consumes `omena-transform-cst` contracts. It does not duplicate
4//! transform metadata; its job is to register safe mutations, cascade-proven
5//! combinations, conservative lowerings, and emission boundaries as a
6//! DAG-respecting execution plan for downstream transform crates.
7
8pub use omena_cascade::CustomPropertyLeastFixedPointSummaryV0;
9
10mod domains;
11mod helpers;
12mod model;
13mod registry;
14mod runtime;
15
16pub use domains::css_modules_values::resolve_static_css_modules_local_value_resolutions_from_source;
17pub use domains::number::reduce_static_numeric_expression;
18pub use domains::vendor_prefix::StaleVendorPrefixRemovalProofCandidateV0;
19pub use model::*;
20#[cfg(feature = "lawvere-trace")]
21pub use omena_lawvere::{
22    LawvereDifferentialCommutativityWitnessV0, LawvereModelTraceV0, ReorderabilityCertificateV0,
23    TransformPassParallelPlanV0,
24};
25pub use omena_value_lattice::{
26    StaticSrgbColorWithAlpha, can_shorten_hex_pairs, compress_hex_color_token_text,
27    compress_number_prefix, compress_numeric_token_text, format_css_number, numeric_prefix_end,
28    parse_basic_named_static_color_with_alpha, parse_color_function_value, parse_color_mix_value,
29    parse_numeric_value_with_unit, parse_oklab_oklch_value, parse_reducible_abs_value,
30    parse_reducible_calc_value, parse_reducible_clamp_value, parse_reducible_exp_value,
31    parse_reducible_hypot_value, parse_reducible_log_value, parse_reducible_max_value,
32    parse_reducible_min_value, parse_reducible_mod_value, parse_reducible_pow_value,
33    parse_reducible_rem_value, parse_reducible_round_value, parse_reducible_sign_value,
34    parse_reducible_sqrt_value, parse_static_hsl_function_color_with_alpha,
35    parse_static_hwb_function_color_with_alpha, parse_static_rgb_function_color_with_alpha,
36    parse_static_srgb_color, parse_static_srgb_color_with_alpha, shorten_hex_pairs,
37    shortest_static_srgb_color_with_alpha_text,
38};
39pub use registry::{
40    inline_css_imports, inline_css_imports_for_static_module_evaluation,
41    parse_static_css_cascade_value, restore_less_inline_literal_placeholders,
42    summarize_static_css_custom_property_fixed_point_from_source,
43};
44pub use runtime::executor::{
45    classify_transform_reachability_precision,
46    execute_transform_passes_on_module_with_dialect_context_and_closed_world_bundle,
47    execute_transform_passes_on_source, execute_transform_passes_on_source_with_dialect,
48    execute_transform_passes_on_source_with_dialect_and_context,
49    execute_transform_passes_on_source_with_dialect_and_context_without_lex_cache_for_measurement,
50    execute_transform_passes_on_source_with_dialect_and_context_without_semantic_trust_for_measurement,
51    execute_transform_passes_on_source_with_dialect_context_and_closed_world_bundle,
52    execute_transform_passes_on_source_with_dialect_context_and_policy,
53    execute_transform_passes_on_source_with_dialect_context_closed_world_bundle_and_precision,
54    execute_transform_passes_on_source_with_dialect_context_closed_world_bundle_precision_and_policy,
55};
56#[cfg(feature = "lawvere-trace")]
57pub use runtime::executor::{
58    evaluate_lawvere_reorderability_with_differential_corpus,
59    execute_transform_passes_on_source_with_lawvere_trace,
60    execute_transform_passes_on_source_with_lawvere_trace_and_dialect,
61};
62pub use runtime::fuzz::{run_transform_cascade_safe_fuzz_case, run_transform_fuzz_seed_corpus};
63pub use runtime::incremental::{
64    execute_transform_passes_incremental_with_database, transform_pass_incremental_graph_input,
65};
66pub use runtime::lex_cache::{
67    reset_transform_lex_cache_splice_telemetry, transform_lex_cache_splice_telemetry_snapshot,
68};
69#[cfg(feature = "lawvere-trace")]
70pub use runtime::planner::plan_transform_passes_parallel_lawvere_layers;
71pub use runtime::planner::{
72    default_transform_pass_registry, implemented_mutation_pass_ids, plan_transform_passes,
73    plan_transform_passes_checked, summarize_omena_transform_passes_boundary,
74};
75pub use runtime::semantic_preservation::{
76    ExternalCssSemanticChangeClassificationV0, ExternalCssSemanticChangeKindV0,
77    ExternalCssSemanticChangeV0, ExternalCssSemanticDiffV0, ExternalCssSemanticEntryV0,
78    TransformSemanticPreservationDecisionV0, compare_external_css_semantic_changes_v0,
79    compare_transform_css_semantics_v0, external_css_semantic_diff_is_total_v0,
80};
81pub use runtime::structural_shadow::{
82    TransformStructuralIrPipelineShadowFixtureInputV0, TransformStructuralIrShadowFixtureInputV0,
83    summarize_structural_ir_pipeline_shadow_equivalence_for_fixtures_v0,
84    summarize_structural_ir_shadow_equivalence_for_fixtures_v0,
85    summarize_structural_ir_shadow_equivalence_v0,
86};
87pub use runtime::winner_equality::compare_transform_winner_equality_for_conformance_v0;
88
89/// Expand a CSS Nesting selector against its canonical parent selector.
90///
91/// This is exposed for analysis/query layers that must compare selectors in
92/// their resolved form without running the full transform pipeline.
93pub fn expand_css_nested_selector(parent_selector: &str, nested_selector: &str) -> Option<String> {
94    domains::nesting::expand_nested_selector(parent_selector, nested_selector)
95}
96
97/// Return proof candidates for stale vendor-prefix removals.
98///
99/// Each candidate identifies both the removable prefixed declaration and the
100/// exact unprefixed peer that must survive for the rewrite to be considered.
101pub fn collect_stale_vendor_prefix_removal_proof_candidates_from_source(
102    source: &str,
103    dialect: omena_parser::StyleDialect,
104) -> Vec<StaleVendorPrefixRemovalProofCandidateV0> {
105    domains::vendor_prefix::collect_stale_vendor_prefix_removal_proof_candidates_with_lexer(
106        source, dialect,
107    )
108}
109
110#[cfg(test)]
111mod tests;