-
-
Notifications
You must be signed in to change notification settings - Fork 755
feat: add normalizers (byEngine and toDesktop)
#511
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
base: main
Are you sure you want to change the base?
Conversation
| will return `and_chr` with the version of Chromium they are based on. | ||
| Note Edge and Opera is not normalized. Gecko-based browsers are | ||
| also normalized to Firefox, e.g., KaiOS Browser will return `and_ff`. | ||
| * `toDesktop`: Normalize mobile browsers to desktop browsers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've named it toDesktop instead of mobileToDesktop as it may be confused with the existing option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between normalizers: ['toDesktop'] and mobileToDesktop: true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ai See #510 and 2ca9e82. mobileToDesktop only resolves the version part using desktop data. For example:
$ node cli.js "last 5 and_chr versions"
and_chr 81
$ node cli.js "last 5 chrome versions"
chrome 83
chrome 81
chrome 80
chrome 79
chrome 78
$ node cli.js --mobile-to-desktop "last 5 and_chr versions"
and_chr 83
and_chr 81
and_chr 80
and_chr 79
and_chr 78
$ node cli.js --normalizers=toDesktop "last 5 and_chr versions"
chrome 81
$ node cli.js --normalizers=toDesktop --mobile-to-desktop "last 5 and_chr versions"
chrome 83
chrome 81
chrome 80
chrome 79
chrome 78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JLHwung what do you think if we change mobileToDesktop behavior? On last 5 and_chr versions we will return chrome 78-83 instead of and_chr 78-83. Now it will affect Babel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally Babel maps and_chr to chrome and it seems to me this PR moves this process to browserslists. I don't think it will affect Babel.
Another thoughts about mobileToDesktop: AFAIK opera_mob is mapped to opera, this is incorrect because they are, if not always, frequently based on different chromium versions. Can we incorporate data from https://github.com/mdn/browser-compat-data/blob/master/browsers/opera_android.json ? This can help preset-env on supporting opera_mob. Surely we can address it in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added 'op_mob 46': 63 to normalizedVersions (byEngine). I think removing it from desktopNames (mobileToDesktop) would be out of scope for this PR.
normalizers and keepOriginal optionnormalizers (toChromium and toDesktop) and keepOriginal option
README.md
Outdated
| also normalized to Firefox, e.g., KaiOS Browser will return `and_ff`. | ||
| * `toDesktop`: Normalize mobile browsers to desktop browsers. | ||
| For instance, Browserslist will return `chrome 20` on `and_chr 20` | ||
| * `keepOriginal`: Keep the original browser when normalizing with `normalizers` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why do we need this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case tools need or can process unnormalized data. I don't have any specific use case yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s remove it. I think the origin mobileToDesktop should be replaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the origin
mobileToDesktopshould be replaced.
I agree it'd be the best course of action, but it'd be a breaking change.
normalizers (toChromium and toDesktop) and keepOriginal optionnormalizers (toChromium and toDesktop)
normalizers (toChromium and toDesktop)normalizers (byEngine and toDesktop)
|
Would it be possible to also add support for |
mobileToDesktopdocumentation to match its behaviorbyEngineandtoDesktopnormalizersFixes #508, fixes #510.