60 Commits

Author SHA1 Message Date
Nicolò Ribaudo
208acb1d6c
Use require.resolve instead of the resolve package (#12439) 2020-12-04 08:57:09 +01:00
Niklas Mischkulnig
a080c82777
[cjs] Skip duplicate reexported bindings in namespace reexports (#11739) 2020-09-28 16:22:13 +02:00
Huáng Jùnliàng
3fad7eab9b
Use Yarn 2 (#11962)
* chore: use yarn 2

* chore: remove redundant yarn locks

* chore: remove publishEslintPkg

* chore: remove redundant make bootstrap

* Update .yarnrc.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* chore: use workspace protocol for eslint packages in the root

Co-Authored-By: merceyz <merceyz@users.noreply.github.com>

* chore: pin caniuse-lite versions

Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.

* chore: resolve yarn install warnings

* chore: update yarn cache path on circle/travis

* chore: add yarn deduplicate plugin

* chore: deduplicate lock files

* chore: move devDependencies to leaf packages

* chore: remove @yarnpkg/plugin-constraints

* chore: remove unused dedupe options

* test: fix unwanted self reference

* chore: remove output-file-sync dependency

* chore: update browserify to 16.5.2

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-08-25 14:37:30 -04:00
SZ-Coder
4ce1b70ade
Fix incorrect module path when absoluteRuntime is specified (#11893)
* - Added failing tests for issue #11885.

* - Fix issue #11885: absoluteRuntime does not work as expected with corejs3.

* - Removed helper code from test output files (tests for issue #11885).

* chore: add @babel/runtime-corejs3 to dev deps

* chore: update test fixtures

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-07-30 10:35:37 -04:00
Huáng Jùnliàng
b8a6145e50
fix: skip transform delete something.includes (#11530) 2020-05-07 06:50:59 -04:00
Christoph Nakazawa
2bb2933dea
[helpers] Add a private function name within createSuper (#11514) 2020-05-04 23:30:53 +02:00
Justin Ridgewell
070ec201bb
Speed up the createSuper helper (#11401) 2020-04-10 16:00:20 +02:00
johannes
fbcb251d61
fix: replace backslashes with forward slashes from resolved pa… (#11366)
* fix: replace backslashes with forward slashes from resolved path for windows environments

* add test for resolveAbsoluteRuntime under windows
2020-04-08 15:36:55 +02:00
Nicolò Ribaudo
67609a1232
Don't call createSuper in loose mode (it was unused) (#11358)
* Don't call `createSuper` in loose mode (it was unused)

* Update fixtures
2020-04-01 23:08:21 +02:00
Nicolò Ribaudo
59976680df
Extract for-of iterator handling to a helper (#11262)
* 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
2020-03-17 00:45:34 +01:00
Nicolò Ribaudo
f6c7bf36ce
Allow extending untranspiled classes (#8656) 2020-03-16 23:59:15 +01:00
Nicolò Ribaudo
d21e2217d5
Skip newlines around inline #__PURE__ annotations (#11133)
* Skip newlines around #__PURE__ annotations

* Update tests
2020-02-13 19:16:33 +01:00
Nicolò Ribaudo
4636321f06
Make @babel/transform-runtime's absoluteRuntime/relative test meaningful (#10963) 2020-01-05 17:28:44 +01:00
Huáng Jùnliàng
4436ffd604 Revert "Add ".js" extension to injected polyfill imports (#10549)" (#10835)
This reverts commit d3a37b5d08074c007268eb15a11ae432165bad5d.
2019-12-07 23:05:35 +01:00
shimataro
d3a37b5d08 Add ".js" extension to injected polyfill imports (#10549)
* Node modules compatibility: add ".js" extension to imported polyfills

* Update fixtures

* add extensions on calling `addDefaultImport()`, not in the function.
2019-12-06 13:30:23 +01:00
Nicolò Ribaudo
b459f6a0a4
Add windows to travis (#10249)
* Add windows to travis

* Update

* Do not use sh file on windows

* Fix whitespace

* Unify command

* ./ doesn't work on windows

* Remove all ./ usages

* Run windows test before others

* fix: normalize filename when generating sources

sources should be URL.

* fix: replace normalized path to cwd

* chore: add nodePlatform task options

* fix: normalize preset-env filename output

* chore: replace normalized path to CWD on win32 platform

* limit transform-react-source to run on linux and darwin

* test: escapeRegExp on testcases

* test: add test for babel --filename on windows

* test: double babel-node/cli test timeout

* chore: workaround windows build does not stop

* chore: remove redundant condition

* refactor: rename `nodePlatform` to `os`
2019-09-26 20:59:17 +02:00
Bin Xin
8769903284 Add supports for polyfill computed methods (#10398) 2019-09-06 01:35:03 +02:00
Bin Xin
29734b924a Don't allow instance properties transformation on namespace (#10372) 2019-09-05 10:32:57 -05:00
Daniel Tschinder
4f0840ab88
Update dev dependencies and fix linting errors (#10228)
* chore: Uppate dev dependencies

* chore: Fix lint errors

* chore: Format options.json files

* chore: Fix stupid flow errors

* Update test262 whitelist

Seems test262-stream was updated and now these tests work.
2019-07-27 15:09:30 +02:00
Sagiv ben giat
a9660cf559 resolve #10205 (#10207) 2019-07-12 11:00:25 -05:00
Nicolò Ribaudo
e03eb17c08
[runtime-corejs3] Only polyfill instance methods when it might be needed (#9754) 2019-04-02 21:18:59 +02:00
Denis Pushkarev
3303b079c5 Update to core-js@3 (#7646)
### `@babel/runtime`
- Added `@babel/runtime-corejs3` package and `corejs: 3` options to `@babel/plugin-transform-runtime`.
- Added support of instance methods, fixes #8928.
- Added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for support all proposals polyfills from `core-js`.
- Used separate directories in runtime for `core-js` entry points with proposals and without.
- Used `get-iterator-method` helper for getting iterators, fixes #2500.
- As a cheap bonus, added support of IE8- (except some cases of `regenerator`).

### `@babel/polyfill`
- Should be deprecated in favor of separate usage required features from `core-js` and `regenerator-runtime` with an informative message.

### `@babel/preset-env`
- Uses for built-ins data from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) instead of `compat-table` since information from `compat-table` [is not enough](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat).
- `useBuilIns` now requires direct setting of `corejs` version option, without it will be used `2` by default and shown deprecation warning.
- Added support of minor `core-js` versions for simplify updating in the future.
- For preventing some order-related problems, polyfills in the both `core-js@3` plugins added on `post` stage in the order of `core-js-compat` data.
- Divided plugins and polyfills parts of `preset-env`, instead of 2 internal plugins for adding polyfills, we have 6: usage and entry versions of plugins for `core-js@2`, ### Current state:
`core-js@3`, `regenerator-runtime`.
- Added support `samsung` target (for Samsung Internet) since `core-js-compat` and `compat-table` now contains mapping for this, fixes #6602.

#### `useBuilIns: entry` with `corejs: 3`
- No longer transforms `@babel/polyfill`.
- Transforms **all possible** `core-js` entry points to import of related modules (based on data from [`core-js-compat`](https://unpkg.com/core-js-compat@3.0.0-beta.15/entries.json)).
- Since of this, we no longer need `shippedProposals` / `proposals` flags with `useBuilIns: entry`.
- Removes `regenerator-runtime/runtime` import where it's not required.

#### `useBuilIns: usage` with `corejs: 3`
- In addition to `shippedProposals`, added flag `proposals`  (in `corejs: { version: 3, proposals: true }` format) for polyfill all proposals from `core-js`.
- Fixed list of dependencies in built-in definitions.
- Improved the way of determination method / built-in name and source of this method.
- Adds import of required polyfills on `MemberExpression`, `ObjectPattern`, `in` operator.
- Adds import of required polyfills on access to global object properties.
- Adds import of all required common iterators on all syntax features which use iterators protocol (`for-of`, destructuring, spread, `yield` delegation, etc.).
- Adds import of promises on syntax features which use promises (async functions/generators, dynamic import, etc.), fixes #9250, #7402, etc.

### `core-js@2` stuff
I didn't want to tough `core-js@2`-related stuff, however
- Fixed some serious errors in definitions which breaks `Object.getOwnPropertySymbols`, `Symbol.toStringTag` logic, `Promise#finally`, `Array#forEach`, etc.
- `Array#flatMap` and trim methods moved to stable features as a part of ES2019 and loaded by deprecated `@babel/polyfill` and `@babel/preset-env` with `corejs: 2` option.
2019-03-19 21:07:45 +01:00
Nicolò Ribaudo
b8d045f5cf
Update regenerator-transform (#9558) 2019-02-21 23:24:31 +01:00
Nicolò Ribaudo
aac8118b7f
Update helpers version fro 7.0.1 to 7.0.2 (#8703) 2018-09-14 22:55:27 +02:00
Logan Smyth
13798feefb
Fix prerelease checks in .availableHelper and transform-runtime definitions. (#8659) 2018-09-10 18:25:21 -07:00
Sven SAULEAU
53c6c98bdb
chore: fix-json new options 2018-09-10 08:04:32 +02:00
Siddharth Parmar
e372129d00 Add tests for static math methods (#8626) 2018-09-09 18:08:34 -07:00
Logan Smyth
79b2af5997
Format fixture JSON with Prettier. (#8658) 2018-09-09 17:57:52 -07:00
Logan Smyth
39fa102ee8
Use supportsStaticESM to toggle runtime module usage. (#8520) 2018-08-24 10:48:47 -07:00
Logan Smyth
023044c1d4
Reference the CommonJS helpers when a file is not explicitly a module. (#8518) 2018-08-23 15:09:14 -07:00
Logan Smyth
1e0b649485
Allow transform-runtime to insert runtime references with absolute paths. (#8435) 2018-08-14 16:11:19 -07:00
Logan Smyth
a8224d40e2 Split @babel/runtime into two separate runtime modules. 2018-08-02 19:25:07 -07:00
Logan Smyth
3210a7a873 Default to non-corejs helpers. 2018-08-02 19:24:41 -07:00
Logan Smyth
b6eba87daa
Rename some test fixtures so they run properly. (#8265) 2018-07-04 18:33:26 -07:00
Justin Ridgewell
2af7a33c4e Fix class inheritance in IE10 (#7969)
* Revert "Move subclass inheritance to end (#7772)"

This reverts commit f8ab9466d331871a90f458af40b14e8d831e0c29.

* Only use getPrototypeOf if setPrototypeOf is implemented

* Update fixtures

* Helpers updates

* Update fixtures

* Fall back to getPrototypeOf

* Update fixtures
2018-05-23 16:21:21 -04:00
Justin Ridgewell
f8ab9466d3
Move subclass inheritance to end (#7772)
We were using `Object.create` to setup the prototype chain at the start of the class definition, which lead to #7771.

I was a bit worried about a speed hit, but it seems everyone optimizes the two patterns the same way.
https://jsbench.github.io/#f9fca52407643d96458a35763b201215

Fixes #7771.
2018-04-21 17:31:44 -04:00
Markus Török
6597a472b3 Add "use strict" directive (#7411)
* #7349
- Add "use strict" directive to transformed class bodies

* Update tests (#7349)

* Add test for program with use strict directive (#7349)

* Update tests (#7349)

* Update source mapping (#7349)

* Add test for parent blockStatement with use strict directive (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Add test for constructor-only class (#7349)

* Constructor only classes are strict, too

But constructor only that use non-simple parameters must use a strict function wrapper.

* Fix test

* Wrapper not needed if class is already strict

* Revert change to lerna.json
2018-04-10 17:33:38 -04:00
Justin Ridgewell
450a1678f2
Use getProto and setProto helpers (#7675)
Depends on #7674.
2018-04-06 02:54:08 +01:00
Logan Smyth
7cc00cce0d Require output fixture extension to match sourceType output. 2018-03-04 13:31:33 -08:00
Logan Smyth
beb99dfda1 Rename test fixtures using module syntax to .mjs files. 2018-03-04 13:31:32 -08:00
Nicolò Ribaudo
8659e1a88c Remove old expected.{js,json} files (#7187) 2018-01-09 13:10:30 -06:00
Raja Sekar
0f42accb87 Renamed files 2018-01-09 15:36:42 +01:00
Henry Zhu
9ac326b075
remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04:00
Mateusz Burzyński
47fa189053 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
691f90a774 Scoped: change test imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Logan Smyth
ed6e6fd7dd Export babel-runtime helpers as standard CommonJS. 2017-09-26 11:28:57 -07:00
Logan Smyth
ed3603ef44 Use the imports helper in transform-runtime. 2017-09-26 11:28:57 -07:00
Logan Smyth
84184e2ddd Add failing test for babel-runtime import issue. 2017-09-26 11:02:36 -07:00
Logan Smyth
1e750a945c Convert CommonJS to use new shared implementation. 2017-09-12 17:17:41 -07:00
Mateusz Burzyński
c47258d68c Annotating transformed classes with #__PURE__ comment (#6209) 2017-09-11 11:18:37 -04:00