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

Custom usage data produce invalid output? #740

Open
miqdadfwz opened this issue Nov 30, 2022 · 7 comments
Open

Custom usage data produce invalid output? #740

miqdadfwz opened this issue Nov 30, 2022 · 7 comments

Comments

@miqdadfwz
Copy link

I'm not sure this is a valid bug or just an expected design (or even I write bad configuration), but I notice there is a possible incorrect output when using custom usage data with supports query. For example I attempt to run the browserslist with this custom usage data combined with below query:

'<= 1% in my stats and not supports es6', 'iOS < 9', 'dead'

The output seems invalid? Because there is some "modern" browsers that if I refer to the caniuse they potentially already have support with es6.

  'and_chr 367',   'and_chr 109',   'and_chr 108',   'and_chr 104',
  'and_chr 102',   'and_chr 101',   'and_chr 100',   'and_chr 98',
  'and_chr 97',    'and_chr 96',    'and_chr 95',    'and_chr 94',
  'and_chr 93',    'and_chr 92',    'and_chr 91',    'and_chr 90',
  'and_chr 89',    'and_chr 88',    'and_chr 86',    'and_chr 85',
  'and_chr 84',    'and_chr 83',    'and_chr 81',    'and_chr 80',
  'and_chr 79',    'and_chr 78',    'and_chr 77',    'and_chr 76',
  'and_chr 75',    'and_chr 74',    'and_chr 73',    'and_chr 72',
  'and_chr 71',    'and_chr 70',    'and_chr 69',    'and_chr 68',
  'and_chr 67',    'and_chr 66',    'and_chr 65',    'and_chr 64',
  'and_chr 63',    'and_chr 62',    'and_chr 61',    'and_chr 60',
  'and_chr 59',    'and_chr 58',    'and_chr 57',    'and_chr 56',
  'and_chr 55',    'and_chr 54',    'and_chr 53',    'and_chr 52',
  'and_chr 51',    'and_chr 50',    'and_chr 49',    'and_chr 48',
  'and_chr 47',    'and_chr 46',    'and_chr 45',    'and_chr 44',
  'and_chr 43',    'and_chr 42',    'and_chr 39',    'and_chr 34',
  'and_chr 33',    'and_chr 32',    'and_chr 23',    'and_ff 106.0',
  'and_ff 105.0',  'and_ff 104.0',  'and_ff 103.0',  'and_ff 102.0',
  'and_ff 101.0',  'and_ff 100.0',  'and_ff 99.0',   'and_ff 98.0',
  'and_ff 97.0',   'and_ff 95.0',   'and_ff 92.0',   'and_ff 89.0',
  'and_ff 82.0',   'and_ff 71.0',   'and_ff 68.0',   'android 161.1',
  'android 8.1',   'android 8.0',   'android 7.1',   'android 7.0',
  'android 6.0',   'android 5.1',   'android 3.197', 'android 3.196',
  'android 3.194', 'android 3.184', 'android 3.116', 'android 1.0',
  'baidu 13.18',   'bb 10',         'bb 7',          'edge 108',
  ... 193 more items

But, if I change the query using region usage statistic, it will have different output and I think this is the correct output comparing with previous result:

  'android 4.2-4.3', 'android 4.1',     'android 4',       'android 3',
  'android 2.3',     'android 2.2',     'android 2.1',     'baidu 13.18',
  'bb 10',           'bb 7',            'chrome 20',       'chrome 19',
  'chrome 18',       'chrome 17',       'chrome 16',       'chrome 15',
  'chrome 14',       'chrome 13',       'chrome 12',       'chrome 11',
  'chrome 10',       'chrome 9',        'chrome 8',        'chrome 7',
  'chrome 6',        'chrome 5',        'chrome 4',        'firefox 5',
  'firefox 4',       'firefox 3.6',     'firefox 3.5',     'firefox 3',
  'firefox 2',       'ie 11',           'ie 10',           'ie 9',
  'ie 8',            'ie 7',            'ie 6',            'ie 5.5',
  'ie_mob 11',       'ie_mob 10',       'ios_saf 8.1-8.4', 'ios_saf 8',
  'ios_saf 7.0-7.1', 'ios_saf 6.0-6.1', 'ios_saf 5.0-5.1', 'ios_saf 4.2-4.3',
  'ios_saf 4.0-4.1', 'ios_saf 3.2',     'op_mini all',     'op_mob 12.1',
  'op_mob 12',       'op_mob 11.5',     'op_mob 11.1',     'op_mob 11',
  'op_mob 10',       'opera 12.1',      'opera 12',        'opera 11.6',
  'opera 11.5',      'opera 11.1',      'opera 11',        'opera 10.6',
  'opera 10.5',      'opera 10.0-10.1', 'opera 9.5-9.6',   'opera 9',
  'safari 7',        'safari 6.1',      'safari 6',        'safari 5.1',
  'safari 5',        'safari 4',        'safari 3.2',      'safari 3.1',
  'samsung 4'

I have created reproducible code if you are interested to hack around
https://stackblitz.com/edit/coba-browserlist-hpznb3?file=index.js

@ai
Copy link
Member

ai commented Nov 30, 2022

Hm, strange. I will look when after my vacation.

@Semigradsky
Copy link
Contributor

Semigradsky commented Dec 1, 2022

browserslist hasn't data about and_chr and and_ff browsers support (latest Chrome Android). See for information: #734, #156
It looks like in this case the lack of information is used as not supports.

@miqdadfwz
Copy link
Author

that is maybe true in certain browsers, but I also see modern firefox versions are there which I assume it should not be logged.

@ai
Copy link
Member

ai commented Dec 17, 2022

Avoiding using in my stats will generate expected results: https://browsersl.ist/#q=%3C%3D+1%25+and+not+supports+es6%2C+iOS+%3C+9%2C+dead

The main difference between Browserslist built-in data and your custom data, that you have separated versions for Android Chrome.

(Can I Use data is packed in a crazy way, I'm afraid that we will not have a solution with expected result in any case. It is better to add hack to your custom data.)

@alex-polunochev
Copy link

It is better to add hack to your custom data

@ai any recommendations?

E.g. if I have these

  "and_chr": {
    "107": 24.41946549886685
  },
  "and_ff": {
    "106": 0.13197484608919838
  },
...
  "chrome": {
   ...
    "107": 16.23044857702772,   <<<<<
    "108": 6.044158794994393,
    "109": 0.014599707458853159,
    "110": 0.0028137733092502898
  },

should I change the latter to add android numbers on top and remove and_chr for cleanliness?

 "107": 40.64991407589457,

And perhaps the same for the firefox.

@ai
Copy link
Member

ai commented Dec 23, 2022

The minimum is just to have a single version of and_chr and and_ff

@alex-polunochev
Copy link

I see.

In my case to fix the problem I had to increment the versions in the browserlist_stats.json:

  "and_chr": {
    "108": 24.41946549886685
  },
  "and_ff": {
    "107": 0.13197484608919838
  },

(107 -> 108 and 106 -> 107 correspondingly).

That's due that the below output is the content of the generated supported browsers, so I had to match these signatures:

[
 "and_chr 108",
 "and_ff 107",
 "and_uc 13.4",
...
]

For additional context - I used to download CSV files from GA and then generate the browserlist_stats.json with browserslist-ga-export

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

4 participants