Remove @financial-times/polyfill-useragent-normaliser dependency#92
Open
romainmenke wants to merge 4 commits intomainfrom
Open
Conversation
romainmenke
commented
Dec 14, 2024
| const semver = require('semver'); | ||
| const uap = require('ua-parser-js'); | ||
|
|
||
| const SHORT_UA_REGEX = /^(android|bb|chrome|edge|edge_mob|firefox|firefox_mob|ie|ie_mob|safari|ios_saf|opera|op_mob|op_mini|samsung_mob|other)\/((?:\d+\.)*\d+)$/i; |
Member
Author
There was a problem hiding this comment.
The ios_saf/10.0 format is not parseable by ua-parser-js. But a simple regex is sufficient to handle those cases.
mhassan1
requested changes
Jan 21, 2025
|
|
||
| Support data only exists for the most common browsers (e.g. Chrome, Firefox, Safari, ...). To map any user agent to a list of needed polyfills you need to normalize the user agent to one of the known browser families and their corresponding version. | ||
|
|
||
| Since the `@financial-times/polyfill-useragent-normaliser` package was deprecated you might need to provide your own solution. |
Collaborator
There was a problem hiding this comment.
I wish we could provide a solution here. I think it will be difficult for another organization to provide this library, given that the list of normalized families and versions is so tightly coupled to polyfill-library.
What if we publish our own normalizer? At first, it could just be a wrapper around @financial-times/polyfill-useragent-normaliser (thus avoiding users of polyfill-library depending directly on it), and then we can decide whether we want to fork it or transition to another normalizer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #86