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
Add opera mobile compat data #15727
Add opera mobile compat data #15727
Conversation
package.json
Outdated
"glob-watcher/chokidar": "npm:^3.4.0", | ||
"@types/babel__core": "link:./nope", | ||
"@types/babel__traverse": "link:./nope", | ||
"@babel/helper-define-polyfill-provider/@babel/helper-compilation-targets": "workspace:*", |
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.
This is kind of deadlock: If we don't map compilation targets to the workspace one, the one used by @babel/helper-define-polyfill-provider
will throw on unrecognized targets opera_mobile
on tests. If we map the library, the build dependency @babel/preset-env@npm
will be affected.
One solution is to move babel-polyfills
to the monorepo. I am investigating how to specify the resolutions so that the build deps are not affected.
c4be578
to
90e94a1
Compare
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54755/ |
eae3bec
to
19ddaf6
Compare
@@ -37,6 +37,7 @@ Object { | |||
"ios": "10.3.0", | |||
"node": "13.2.0", | |||
"opera": "48.0.0", | |||
"opera_mobile": "73.0.0", |
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.
Although op_mob
is set to 45, op_mob 45
is still an unknown browser for browserslist
, so it is resolved to opera_mobile 73.0.0
. This probably won't affect end users unless they use esmodules: "intersect"
with opera_mobile
only queries.
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.
It's unfortunate, but it's probably the best we can do.
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.
This probably won't affect end users unless they use esmodules:
This statement is a bit concerning to me, but I don't really understand the restriction. Could you explain further? Is there a tweak to browserslist
that could alleviate it?
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.
If you are using esmodules: true
, the "opera_mobile": "73.0.0"
here is no op because Opera mobile 73 should cover every features implemented by other old browsers listed here such as Firefox 60 and Chrome 61.
If you want to fix this in browerslist
, the upstream library https://github.com/browserslist/caniuse-lite should contain every opera mobile versions, so browserslist
can actually resolve op_mob 45
to opera mobile 45. Currently it throws unknown version.
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.
Is my understanding that this is not a regression introduced by this PR correct? And the old babel behavior was to just map opera mobile to opera desktop, which also had wrong results since the mapping was wrong.
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.
It's a bug fix with no regression IMO:
- With current Babel and
browserslist
< 4.20.9, Babel and browserslist essentially had the same incorrect assumption of equating the two. The net effect was sort of just ignoring Opera Mobile as an independent target. - With current Babel and 4.20.9, Babel is doing some extra transpiling for any target that includes op_mob from browserslist
- With this PR and 4.20.9, the extra transpiling goes away
I cannot think of a query at the moment that would result in any sort of regression or breakage.
b958bb3
to
b4a87a9
Compare
@@ -0,0 +1,27 @@ | |||
diff --git a/lib/options.js b/lib/options.js |
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.
We can remove this patch once @babel/helper-compilation-targets
is published and @babel/helper-define-polyfill-provider
updates its dependency.
b4a87a9
to
72ecd77
Compare
@@ -37,6 +37,7 @@ Object { | |||
"ios": "10.3.0", | |||
"node": "13.2.0", | |||
"opera": "48.0.0", | |||
"opera_mobile": "73.0.0", |
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.
It's unfortunate, but it's probably the best we can do.
This reverts commit 19ddaf6.
e211122
to
f0622bf
Compare
This PR contains commits from #15726, please review that one first.In browserslist/browserslist#768, browserslist no longer returns
op_mob
version as if it were the one of Opera Desktop, it does return the correct opera mobile versions. However,@babel/helper-compilation-targets
still mapsop_mob
as Opera. This significantly lowered the support matrix of queries likelast 2 versions
ordefaults
because although Opera Mobile 73 is modern, Opera Desktop 73 (Chrome 87) is 2 years old.In this PR we maps
op_mob
asopera_mobile
and add compat data foropera_mobile
. While it is technically a new feature for@babel/compat-data
, this PR fixes the regression that thedefaults
browserslist query is misintepreted by@babel/preset-env
when usingbrowserslist@4.21.9
. Therefore I mark it as a bug fix.