Skip to content

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Dec 14, 2024

Resolves: #86

@romainmenke romainmenke enabled auto-merge (squash) December 14, 2024 10:32
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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ios_saf/10.0 format is not parseable by ua-parser-js. But a simple regex is sufficient to handle those cases.


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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Successfully merging this pull request may close these issues.

UA Financial Times library has disappeared

2 participants