* Lint against CJS globals in modules
* Use `import.meta.url` instead of `__filename` in `src` files
* Prepare fixtures runner for `import.meta.url`
* Use `import.meta.url` instead of `__filename` in `test/index` files
* Remove `__dirname` from remaining test files
dirname
* Avoid using `module` in `src` files
* Avoid using `require` in `src` files
* Avoid using `require` in `test` files
* Update `@types/node`
* Compile dynamic import in `@babel/node`
* Fix windows
* Use `@babel/plugin-proposal-dynamic-import` from npm
* 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
* Fix rewriteThis in helper-module-transforms for computed class elements
* Added test file and corrected the visitor
* Revert .gitignore
* Using skipAllButComputedKey method from plugin-replace-supers
* added tests for class methods
* Added tests for both class properties and methods and fixed skipping computed key for methods
* Fixed condition for class methods
* revised the conditions for class methods
* Added more tests and used else-if in classmethod condition
* Update packages/babel-helper-replace-supers/src/index.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Correctly transpile export bindings for some for-of loops
* Correctly transform non-destructured for of loops to update exported variables
* Add tests
* Don't replace entire for of loop
* Correctly transform destructured for-of/for-in exports
* Update exported variables in array pattern and more fixes
* Refresh test output
* Update tests and rebase on master
* Refactor ForOf|ForIn visitor
* Don't transform re-declared exported vars
* Generate better name for loop id
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Idiomatically generate UidIdentifier
* Update scope after replacing loop declaration
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Node modules compatibility: add ".js" extension to imported polyfills
* Update fixtures
* add extensions on calling `addDefaultImport()`, not in the function.
* fix: [#10561] _interopRequireWildcard should cache object only
* fix: narrow down cache restriction to object/function type
* test: add interop require null module case
* Improves the logic to import objects in helpers
* Modified to work with more cases.
* Modified by considering exception cases
* Fixed not using bundler's polyfill
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
* Updated test output files
* Changes to cache logic
* Modified to use if statement
* Create @babel/plugin-proposal-dynamic-import
* Use airbnb/babel-plugin-dynamic-import-node
Do not duplicate code, which will unavoidably lead
to bugs being fixed in one plugin and not in the other.
* Update error message
* Add error callback to amd interop
* Update babel-plugin-dynamic-import-node
* Lazy load tagged template literal strings
* Update snapshots to reflect lazy loading
* Use pure annotation and remove unnecessary parenthesized expression
* Update snapshots
* Optimize lazy loading by doing assignment within logical expression
* Update snapshots to reflect optimization
* Use re-define function pattern to avoid hitting function size deopts
* Update snapshots to reflect the usage of the redefining function pattern