Skip to content

0.1.2

Choose a tag to compare

@ursm ursm released this 06 May 22:11
· 56 commits to main since this release
e5c08c3

Mostly tooling. No behavioral changes; same 275 tests pass.

Added

  • RBS type signatures. Six files under sig/ mirror lib/, covering every public entry point on CSS, the AST node classes (CSS::Nodes::*, CSS::Selectors::*, CSS::MediaQueries::*), and the Cascade. Distributed in the gem, so type checkers like Steep pick them up automatically when p_css is a dependency. CI runs bundle exec rbs -I sig validate on every push.

    Symbol unions match the implementation:

    • combinator = :descendant | :child | :next_sibling | :subsequent_sibling
    • attribute_matcher = :exact | :includes | :dash | :prefix | :suffix | :substring
    • comparison_op = :eq | :lt | :le | :gt | :ge

    Element types in the matcher are kept as untyped — Nokogiri elements work without any wrapping.

Internals

  • Simplify pass on the 0.1.1 cascade work: dropped a dead constant (Cascade::EMPTY_INDEXES) and an unused method (Selectors::Matcher#class_list); replaced ad-hoc [:id, name] anchor tuples with a Cascade::AnchorKey Data class; collapsed the three sequential compound.components.each scans in anchor_key into a single pass; switched Selectors::Matcher::Context from Struct.new(keyword_init:) to Data.define for codebase consistency; replaced the Set + to_a + sort! candidate-collection with Array#concat + sort! + uniq! (buckets are already sorted at compile time).

Compatibility

Same as 0.1.0 / 0.1.1 — Ruby 3.4+, no mandatory runtime dependencies.