Baseline status lookup - #342
Conversation
| | '4g' | ||
| | 'fios' | ||
| | false; | ||
| '3g' | '3gfast' | '3gslow' | '2g' | 'cable' | 'dsl' | '4g' | 'fios' | false; |
There was a problem hiding this comment.
nit: was this "unwound" to a single line from a formatter, or manually?
(I'd generally prefer each on its own line for readability and maintainability, when an item gets added or removed it just affects a single line).
There was a problem hiding this comment.
It was unwound from a formatter, I'll restore the existing one-per-line formatting now.
There was a problem hiding this comment.
Let's use prettier linter to format code and make sure we codify our preferences as rules.
Add a standalone, Node-side lookup mapping MDN Browser Compatibility Data (BCD) keys to their Baseline status via the web-features package. Prefers per-compat-key status when available and returns the raw classification without reclassification. This is a self-contained slice; wiring it to the HTML/CSS/JS feature detectors follows in a later change.
836f521 to
1d2ec03
Compare
sergeychernyshev
left a comment
There was a problem hiding this comment.
Adding more types would help with maintenance in the future.
| } | ||
| } | ||
|
|
||
| const featureId = bcdKeyToFeatureId.get(bcdKey); |
There was a problem hiding this comment.
Let's define types for these variables so we don't get some weird data as we update the web-features package.
This adds a standalone lookup that maps MDN Browser Compatibility Data (BCD) keys to their Baseline status using the
web-featurespackage.The HTML, CSS, and JavaScript detectors produce BCD keys, so this provides a shared, detector-independent classification step. Connecting the lookup to those detectors and producing status-grouped output will follow in later changes.
Changes
Baseline status lookup
Adds
lookupBaselineStatus, which:feature,moved, andsplitrecords provided byweb-features.nullfor unknown BCD keys.web-features, includingfalse, without reclassification.Result types
Adds types describing Baseline classifications, supported browsers, discouraged-feature metadata, and lookup results:
Baseline date strings are returned as represented by
web-features, including uncertainty prefixes such as≤where applicable.Dependency
Adds
web-featuresas a runtime dependency. Because it contains evolving Baseline data, keeping classifications current requires periodically updating the resolved version inpackage-lock.jsonand reviewing any resulting test changes. The compatible version range permits these updates but does not update existing lockfiles automatically. This PR does not introduce an automated refresh schedule.Tests
Adds unit coverage for:
falsestatus.