Provide data about necessity of core-js
modules for target engines.
#466
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.
caniuse
,mdn
andcompat-table
are good educational resources but are bad data sources for providing only required polyfills for target engines. Onlycompat-table
from this list contains at least some useful data and at this moment it's used inbabel-preset-env
, however, it's limited:compat-table
contains data only about ECMAScript features and proposals, not about web platform features. So, for example,babel-preset-env
adds all web platform features fromcore-js
even in environments where they are supported.core-js
contains also fixes for broken implementations, butcompat-table
does not contain any information even about serious bugs in engines (for example,Array#reverse
broken in Safari 12).compat-table
contains only some basic and naive tests, they do not show that features work even basically as should. For example, old Safari have broken iterators without.next
method, butcompat-table
shows them as supported because just check thattypeof
of methods which should return iterators isfunction
. Some features like typed arrays are almost completely not covered.compat-table
is not designed for providing data for tools, some of the restcompat-table
maintainers against of maintaining this functionality.So let's provide data about the necessity of
core-js
modules for target engines.This PR contains:
core-js-compat
package with data about the necessity ofcore-js
modules and API for getting a list of requiredcore-js
modules bybrowserslist
query.core-js
feature detection - we can't add the fullcore-js
test case to runtime, but those tests overlap the rest - for eachcore-js
module.core-js-builder
package for allowingtargets
option withbrowserslist
query.Feel free to test and provide data / mapping for missed engines.