Skip to content

Migrate to @webref/css v7 #304

@caugner

Description

@caugner

See w3c/webref#1519 (comment) for details.

Currently, this causes build warnings, and breaks the CSSSyntax macro:

Updating @webref/css to 7.0.11

thread 'main' panicked at crates/rari-deps/src/webref_css.rs:70:63:
called `Result::unwrap()` on an `Err` value: Error("invalid type: null, expected a sequence", line: 0, column: 0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

See also: https://unpkg.com/@webref/css@7.0.11/CHANGELOG.md

v7.0.11 - 2025-09-04

CSS extracts are now consolidated into a single file.

Breaking changes

  • A single consolidated css.json file replaces CSS extracts per spec.

How to upgrade

In version 6, listAll() resolved with an object where the keys were spec shortnames, and the values mostly matched the structure of the consolidated object that the function now returns. On top of the consolidation itself, main differences are:

  • Functions and types were merged in a values category in version 6, they now appear in separate functions and types categories.
  • Functions and types that were scoped to another CSS feature appeared nested under that CSS feature in version 6. They now appear directly under functions and types with a for key that contains the list of scoping features for that feature. A scoping feature may be a property, a function or a type. When the scoping feature is a type, its name in the for key is enclosed between < and >.
  • Feature syntaxes were stored in a value key. That key is now named syntax. Actual syntax values are the same as before and can be parsed with CSSTree.
  • The shortname of the spec (or specs) that defines a feature is no longer readily available (but note the href key targets the defining spec). If you need the specs' shortnames, please raise an issue to describe your use case.
  • The consolidation removes duplicates, merging extended definitions into a single feature. The definition from the latest spec level is used when a feature is defined in more than one level. If you need the definition from earlier levels, please raise an issue to describe your needs!
  • Some of the possible values that a CSS feature could take appeared nested under that feature definition in a values key in version 6. Such values are no longer reported in the new version: they were confusing in any case because they did not cover the whole range of values that a feature could take, and could contain values that were not atomic keyword values. Values could be re-introduced when CSS specs are more systematic about them. In the meantime, you will need to parse the feature's syntax (the syntax key) to extract keyword values.

Additionally, the package now also exposes a new index() async method that resolves with an object similar to that returned by listAll(), except that lists of features under each category are indexed by feature names. For scoped features, the feature name is used as identifier when it is unambiguous. If a feature is defined differently for different scopes, the feature name is completed with the name of the first scoping feature to disambiguate. For example, type() for @function, type() for attr().

Metadata

Metadata

Assignees

Labels

p0Urgent. We will address this as soon as possible.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions