* Allow rest/spread on polyfilled or builtin iterables when `Symbol` unsupported
Currently, when `Symbol` is not supported, we allow using rest/spread with:
- arrays
- strings
- arguments
With this PR, it will be also possible to use it with
- maps
- sets
- binary arrays
While in old browsers es6 builtins would still need to be polyfilled, it's way
easier to polyfill them because `Symbol` cannot be reliably polyfilled.
I didn't use `instanceof` becase:
- it doesn't work with polyfills not attatched to the global scope
- when using Babel to load polyfills, it would force the inclusion of `Map` and `Set` polyfills even if they are not used
Downside: the current approach of relying on `toString || construcor.name` doesn't work with subclasses.
* Don't use Array.from for array-like objects
* Extract for-of iterator handling to a helper
Dis greatly recudes the code size when for-of is used multiple times across the
codebase. Also, makes it easier to read what's happening in a compiled loop.
* Unify spec and loose code
* Legacy implementation fallback
* Update tmp var name
* Updates from review and after rebase
* Prepare preset-env and compat-data for preset-modules
* Add transform-edge-default-parameters from preset-modules
* AUtomatically generate data from compat-table
* Add compat data for other plugins
* Updates after rebase
* Add more bugfixes to preset-env
* Update tests
* Add bugfix/transform-safari-for-shadowing
* Fix build script
* bugfix/transform-safari-block-shadowing
* Fix flow
* Include changes from 7127330f02b423d9cb0555b3d2a24dbccbc149b5
* Fix check-compat-data
* add plugins
* add plugin description
* run build-data
* set shipped proposals true
* update test fixtures
* corejs.proposals should not imply shipped proposals
* fix eslint errors
Please enter the commit message for your changes. Lines starting
* create new object in packages/babel-compat-data/scripts/data/plugin-features.js
* Use ~ for preset-env's @babel/compat-data dependency
* Revert "Use ~ for preset-env's @babel/compat-data dependency"
This reverts commit e7d57c7894095d381670cddfbbce06bd2a480a32.
* Allow using `preset-env` with newer versions of `compat-data`
* chore: rename test folder
* chore: add test case
* fix: use chrome support data when android is absent
* chore: add type annotation
* chore: add testcases last 2 versions not ie
* chore: bump browerslist to v4.8.2
* chore: update test fixtures
* chore: update test fixtures
While it isn't technically needed because regenerator already handles
async functions, it doesn't play well with the Promise detection logic
used by @babel/preset-env's useBuiltIns and @babel/transform-runtime.
The plugin exclusion logic isn't removed, because
1) it will be useful when merging @babel/preset-modules
into @babel/preset-env
2) if/when regenerator will support injecting a custom promise,
we can enable this optimization again
* Node modules compatibility: add ".js" extension to imported polyfills
* Update fixtures
* add extensions on calling `addDefaultImport()`, not in the function.
* feat: implement create-regexp-features-plugin
* fix: test input is not effective
* refactor: leverage create-regexp-features-plugin
* test: add more test cases
* test: update test fixture
* chore: add type annotation to features
* test: add regression test for issue 9892
* add regression test for issue 9199
* address review comments from Nicolò
* address review comments from Brian
* small tweaks
* Enable dotAllFlag when flags includes u
* Changes UMD callsite to be more likely to pass in the intended object.
Fixes#10476
Note: This PR should be considered pseudocode and used as an illustration of the proposed fix. I do not know nearly enough about this project to know if this is an appropriate solution to the problem, nor do I have the confidence to update the tests appropriately.
* Update tests
* fix: [#10561] _interopRequireWildcard should cache object only
* fix: narrow down cache restriction to object/function type
* test: add interop require null module case
* Inject corejs3 imports in Program:exit instead of post
This allows them to be requeued and transformed by other plugins.
* Also entry
* Rebase
* Update packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js [skip ci]
Co-Authored-By: Brian Ng <bng412@gmail.com>
* Don't use args rest/spread to hoist super method calls
* Hoist this in hoisted super method calls
* Make the code more readable
Review by edoardocavazza