Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using MDN Data #163

Open
RJWadley opened this issue Jul 6, 2023 · 1 comment
Open

Using MDN Data #163

RJWadley opened this issue Jul 6, 2023 · 1 comment
Milestone

Comments

@RJWadley
Copy link
Contributor

RJWadley commented Jul 6, 2023

Not all features are in the caniuse database (e.g. #161). So, we have to use MDN data during detection somehow. I'm just not sure how yet, so I'm gonna dump my thoughts here. Open to any and all thoughts, feelings, comments, and etc. There's definitely more options than just these :P

Option 1: Use MDN for detection instead of caniuse. Quite a bit of work, but potentially a clean solution.

Pros:

  • More CSS features are tracked
  • Data includes information about prefixes
  • Data has more robust partial support info
  • Could potentially reduce the amount of boilerplate code needed for detection (in data/features)

Cons:

  • lot of work

Option 2: Convert any missing MDN data into caniuse's format and pretend it exists in caniuse-lite

Pros:

  • Gets us the new features from MDN with less effort (probably)

Cons:

  • Both datasets use a different format, and using them together could get a bit tricky. (e.g we'd have to dedupe entries, MDN compat entries are sometimes split out by value, etc.)
  • Potentially more work to maintain.
  • We'd still need MDN data to check for partial support & prefixes anyway
@clshortfuse
Copy link
Collaborator

clshortfuse commented Jul 6, 2023

I've been messing with a prototype offline where we read straight from the JSON. I took the reading of raw json update-features had and changed it to import JSON as an object (edit).

import caniuseDb from 'caniuse-db/data.json' assert { type: 'json' };

I'm thinking, and been messing around with, reading straight from caniuse-db and mdn's JSON files. Because it's an ESM import, it should technically be possible to tree-shake it, including only the parts of the JSON we need. That tree-shaken version is what gets published to NPM.

We don't need to pull in caniuse-lite except for whatever extra they have. The actual entire caniuse-db DB is 3MB, whereas caniuse-lite is 2.7MB. We're not saving much here. If we can get a workflow going, it can automatically update from MDN and caniuse-db as needed, as well as publish. It would dynamically change the way we code our selectors since MDN gives very fine tuned data.

That's kinda where my head is at now, but haven't had time to make the proof-of-concept.

@clshortfuse clshortfuse added this to the 6.1 milestone Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants