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 = "transform-catalog-trace")]
21#[allow(deprecated)]
22#[deprecated(
23    since = "0.4.0",
24    note = "use the TransformCatalog metadata types; removal is not before 1.0 and requires downstream migration plus zero audited non-compatibility uses"
25)]
26pub use omena_lawvere::{
27    LawvereDifferentialCommutativityWitnessV0, LawvereModelTraceV0, TransformPassParallelPlanV0,
28};
29#[cfg(feature = "transform-catalog-trace")]
30pub use omena_lawvere::{
31    ReorderabilityCertificateV0, TransformCatalogDifferentialCommutativityWitnessV0,
32    TransformCatalogModelTraceV0, TransformCatalogTransformPassParallelPlanV0,
33};
34pub use omena_value_lattice::{
35    StaticSrgbColorWithAlpha, can_shorten_hex_pairs, compress_hex_color_token_text,
36    compress_number_prefix, compress_numeric_token_text, format_css_number, numeric_prefix_end,
37    parse_basic_named_static_color_with_alpha, parse_color_function_value, parse_color_mix_value,
38    parse_numeric_value_with_unit, parse_oklab_oklch_value, parse_reducible_abs_value,
39    parse_reducible_calc_value, parse_reducible_clamp_value, parse_reducible_exp_value,
40    parse_reducible_hypot_value, parse_reducible_log_value, parse_reducible_max_value,
41    parse_reducible_min_value, parse_reducible_mod_value, parse_reducible_pow_value,
42    parse_reducible_rem_value, parse_reducible_round_value, parse_reducible_sign_value,
43    parse_reducible_sqrt_value, parse_static_hsl_function_color_with_alpha,
44    parse_static_hwb_function_color_with_alpha, parse_static_rgb_function_color_with_alpha,
45    parse_static_srgb_color, parse_static_srgb_color_with_alpha, shorten_hex_pairs,
46    shortest_static_srgb_color_with_alpha_text,
47};
48pub use registry::{
49    inline_css_imports, inline_css_imports_for_static_module_evaluation,
50    parse_static_css_cascade_value, restore_less_inline_literal_placeholders,
51    summarize_static_css_custom_property_fixed_point_from_source,
52};
53pub use runtime::executor::{
54    classify_transform_reachability_precision,
55    execute_transform_passes_on_module_with_dialect_context_and_closed_world_bundle,
56    execute_transform_passes_on_module_with_dialect_context_policy_and_closed_world_bundle,
57    execute_transform_passes_on_module_with_dialect_context_policy_and_closed_world_bundle_and_retained_class_names,
58    execute_transform_passes_on_source, execute_transform_passes_on_source_with_dialect,
59    execute_transform_passes_on_source_with_dialect_and_context,
60    execute_transform_passes_on_source_with_dialect_and_context_without_lex_cache_for_measurement,
61    execute_transform_passes_on_source_with_dialect_and_context_without_semantic_trust_for_measurement,
62    execute_transform_passes_on_source_with_dialect_context_and_closed_world_bundle,
63    execute_transform_passes_on_source_with_dialect_context_and_policy,
64    execute_transform_passes_on_source_with_dialect_context_closed_world_bundle_and_precision,
65    execute_transform_passes_on_source_with_dialect_context_closed_world_bundle_precision_and_policy,
66};
67#[cfg(feature = "transform-catalog-trace")]
68#[allow(deprecated)]
69pub use runtime::executor::{
70    evaluate_lawvere_reorderability_with_differential_corpus,
71    execute_transform_passes_on_source_with_lawvere_trace,
72    execute_transform_passes_on_source_with_lawvere_trace_and_dialect,
73};
74#[cfg(feature = "transform-catalog-trace")]
75pub use runtime::executor::{
76    evaluate_transform_catalog_reorderability_with_differential_corpus,
77    execute_transform_passes_on_source_with_transform_catalog_trace,
78    execute_transform_passes_on_source_with_transform_catalog_trace_and_dialect,
79};
80pub use runtime::fuzz::{run_transform_cascade_safe_fuzz_case, run_transform_fuzz_seed_corpus};
81pub use runtime::incremental::{
82    execute_transform_passes_incremental_with_database, transform_pass_incremental_graph_input,
83};
84pub use runtime::lex_cache::{
85    reset_transform_lex_cache_splice_telemetry, transform_lex_cache_splice_telemetry_snapshot,
86};
87pub use runtime::observation_projection::{
88    TransformExecutableCascadeWinnerEquivalenceV0, TransformExecutableObservationProjectionV0,
89    TransformExecutableObservationReportV0, compare_transform_cascade_winner_observation_v0,
90    execute_transform_pass_selector_matching_observation_v0,
91};
92#[cfg(feature = "transform-catalog-trace")]
93#[allow(deprecated)]
94pub use runtime::planner::plan_transform_passes_parallel_lawvere_layers;
95#[cfg(feature = "transform-catalog-trace")]
96pub use runtime::planner::plan_transform_passes_parallel_transform_catalog_layers;
97pub use runtime::planner::{
98    default_transform_pass_registry, implemented_mutation_pass_ids, plan_transform_passes,
99    plan_transform_passes_checked, summarize_omena_transform_passes_boundary,
100};
101pub use runtime::semantic_preservation::{
102    ExternalCssSemanticChangeClassificationV0, ExternalCssSemanticChangeKindV0,
103    ExternalCssSemanticChangeV0, ExternalCssSemanticDiffV0, ExternalCssSemanticEntryV0,
104    TransformSemanticPreservationDecisionV0, compare_external_css_semantic_changes_v0,
105    compare_transform_css_semantics_v0, external_css_semantic_diff_is_total_v0,
106};
107pub use runtime::structural_shadow::{
108    TransformStructuralIrPipelineShadowFixtureInputV0, TransformStructuralIrShadowFixtureInputV0,
109    summarize_structural_ir_pipeline_shadow_equivalence_for_fixtures_v0,
110    summarize_structural_ir_shadow_equivalence_for_fixtures_v0,
111    summarize_structural_ir_shadow_equivalence_v0,
112};
113pub use runtime::winner_equality::compare_transform_winner_equality_for_conformance_v0;
114
115/// Expand a CSS Nesting selector against its canonical parent selector.
116///
117/// This is exposed for analysis/query layers that must compare selectors in
118/// their resolved form without running the full transform pipeline.
119pub fn expand_css_nested_selector(parent_selector: &str, nested_selector: &str) -> Option<String> {
120    domains::nesting::expand_nested_selector(parent_selector, nested_selector)
121}
122
123/// Return proof candidates for stale vendor-prefix removals.
124///
125/// Each candidate identifies both the removable prefixed declaration and the
126/// exact unprefixed peer that must survive for the rewrite to be considered.
127pub fn collect_stale_vendor_prefix_removal_proof_candidates_from_source(
128    source: &str,
129    dialect: omena_parser::StyleDialect,
130) -> Vec<StaleVendorPrefixRemovalProofCandidateV0> {
131    domains::vendor_prefix::collect_stale_vendor_prefix_removal_proof_candidates_with_lexer(
132        source, dialect,
133    )
134}
135
136#[cfg(test)]
137mod tests;