44 Commits

Author SHA1 Message Date
Nicolò Ribaudo
10978bb65a
[babel 8] Use the JSX automatic runtime by default (#12630)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Arun Kumar Mohan <arunmohandm@gmail.com>
2021-01-19 01:41:07 +01:00
Huáng Jùnliàng
eda4130d5e
Tweak helper compilation targets (#12615)
* refactor: simply browserslists defaults overwriting

When `hasTargets` is `false`,  `targets` is always an empty object by definition, `objectToBrowserslist({})` always return `[]` therefore we can remove `objectToBrowserslist`.

* test: apply external-helpers on preset-env test fixtures

* test: add ie 6 to force all transforms in corejs 3, debug, corejs 2 fixtures

* Add ie 6 as targets for test fixtures
2021-01-12 13:09:45 -05:00
Nicolò Ribaudo
d23f0ae0ec
Add regression tests for regenerator (#10223)
* Add regression tests for regenerator

* Update tests
2020-03-23 20:49:59 +01:00
Nicolò Ribaudo
f3912ac08f
Mark transpiled JSX elements as pure (#11126)
* Mark transpiled JSX elements as pure

* Avoid duble annotation

* Add "pure" option to the React preset

* Fix generator indentation

* Update tests

* Add tests for the "pure" option

* Update windows fixtures
2020-03-19 15:43:54 +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
2884bac44b Use async-to-generator even when regenerator is enabled (#10839)
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
2019-12-09 16:54:25 -05: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
861844761f
[preset-env] Don't use async-to-generator when already using re… (#9481)
* [preset-env] Don't use async-to-generator when already using regenerator

* Add tests

* Update fixtures
2019-11-04 22:53:53 +01:00
Nicolò Ribaudo
1969e6b6aa Update regenerator-transform (#9941) 2019-05-07 15:42:12 -04:00
Denis Pushkarev
ae9b25ac69 Add to preset-env ES3 transforms for ES3 targets (#9781)
* add to preset-env ES3 transforms for ES3 targets

* add `transform-reserved-words`

* fix `transform-reserved-words` plugin in `@babel/standalone`
2019-03-30 23:25:12 +01:00
Nicolò Ribaudo
b8d045f5cf
Update regenerator-transform (#9558) 2019-02-21 23:24:31 +01:00
Logan Smyth
79b2af5997
Format fixture JSON with Prettier. (#8658) 2018-09-09 17:57:52 -07:00
Logan Smyth
3210a7a873 Default to non-corejs helpers. 2018-08-02 19:24:41 -07:00
Henry Zhu
10910a10f5
Remove yearly presets from repo, inline in standalone (#8274)
These were already deprecated in v6, just didn't remove the folders?
2018-07-09 14:23:25 -04:00
Brian Ng
9add6d88f5 Update regenerator version and test retain lines fixture (#8072) 2018-05-29 10:46:05 -07:00
Deven Bansod
b09c729675 Use expect's instanceOf and toHaveProperty methods 2018-03-27 22:34:25 +05:30
Deven Bansod
c8d82d6483 Migrate all remaining fixtures to jest expect 2018-03-24 16:22:20 +05:30
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
2b88e079ef Only transform this/use strict if a module. 2017-09-20 10:19:35 -07:00
Logan Smyth
1e750a945c Convert CommonJS to use new shared implementation. 2017-09-12 17:17:41 -07:00
Daniel Tschinder
0189b38702
Merge branch '6.x' into 7.0
# Conflicts:
#	CONTRIBUTING.md
#	Makefile
#	README.md
#	lerna.json
#	lib/types.js
#	package.json
#	packages/babel-cli/package.json
#	packages/babel-code-frame/package.json
#	packages/babel-core/package.json
#	packages/babel-core/test/fixtures/transformation/misc/regression-2892/expected.js
#	packages/babel-generator/package.json
#	packages/babel-generator/src/generators/flow.js
#	packages/babel-generator/src/index.js
#	packages/babel-generator/test/fixtures/flow/declare-statements/expected.js
#	packages/babel-generator/test/fixtures/flow/object-literal-types/expected.js
#	packages/babel-generator/test/fixtures/flow/opaque-type-alias/expected.js
#	packages/babel-helper-bindify-decorators/package.json
#	packages/babel-helper-builder-binary-assignment-operator-visitor/package.json
#	packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json
#	packages/babel-helper-builder-react-jsx/package.json
#	packages/babel-helper-call-delegate/package.json
#	packages/babel-helper-define-map/package.json
#	packages/babel-helper-explode-assignable-expression/package.json
#	packages/babel-helper-explode-class/package.json
#	packages/babel-helper-fixtures/package.json
#	packages/babel-helper-function-name/package.json
#	packages/babel-helper-get-function-arity/package.json
#	packages/babel-helper-hoist-variables/package.json
#	packages/babel-helper-optimise-call-expression/package.json
#	packages/babel-helper-plugin-test-runner/package.json
#	packages/babel-helper-regex/package.json
#	packages/babel-helper-remap-async-to-generator/package.json
#	packages/babel-helper-replace-supers/package.json
#	packages/babel-helper-transform-fixture-test-runner/package.json
#	packages/babel-helpers/package.json
#	packages/babel-plugin-transform-async-generator-functions/package.json
#	packages/babel-plugin-transform-async-to-generator/package.json
#	packages/babel-plugin-transform-async-to-module-method/package.json
#	packages/babel-plugin-transform-class-constructor-call/package.json
#	packages/babel-plugin-transform-class-properties/package.json
#	packages/babel-plugin-transform-decorators/package.json
#	packages/babel-plugin-transform-es2015-block-scoping/package.json
#	packages/babel-plugin-transform-es2015-classes/package.json
#	packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6755/expected.js
#	packages/babel-plugin-transform-es2015-computed-properties/package.json
#	packages/babel-plugin-transform-es2015-duplicate-keys/package.json
#	packages/babel-plugin-transform-es2015-function-name/package.json
#	packages/babel-plugin-transform-es2015-modules-amd/package.json
#	packages/babel-plugin-transform-es2015-modules-commonjs/package.json
#	packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-destructured/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-default-params/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-rest/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/options.json
#	packages/babel-plugin-transform-es2015-modules-systemjs/package.json
#	packages/babel-plugin-transform-es2015-modules-umd/package.json
#	packages/babel-plugin-transform-es2015-object-super/package.json
#	packages/babel-plugin-transform-es2015-parameters/package.json
#	packages/babel-plugin-transform-es2015-shorthand-properties/package.json
#	packages/babel-plugin-transform-es2015-sticky-regex/package.json
#	packages/babel-plugin-transform-es2015-unicode-regex/package.json
#	packages/babel-plugin-transform-es5-property-mutators/package.json
#	packages/babel-plugin-transform-exponentiation-operator/package.json
#	packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/opaque-type-alias/expected.js
#	packages/babel-plugin-transform-object-rest-spread/package.json
#	packages/babel-plugin-transform-object-rest-spread/src/index.js
#	packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested-2/expected.js
#	packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested/expected.js
#	packages/babel-plugin-transform-proto-to-assign/package.json
#	packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/expected.js
#	packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/expected.js
#	packages/babel-plugin-transform-react-display-name/package.json
#	packages/babel-plugin-transform-react-display-name/src/index.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/assignment-expression/expected.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/nested/expected.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/object-property/expected.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/variable-declarator/expected.js
#	packages/babel-plugin-transform-react-jsx-compat/package.json
#	packages/babel-plugin-transform-react-jsx/package.json
#	packages/babel-plugin-transform-regenerator/package.json
#	packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/expected.js
#	packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/expected.js
#	packages/babel-plugin-transform-regenerator/test/fixtures/variable-renaming/retain-lines/expected.js
#	packages/babel-plugin-transform-runtime/README.md
#	packages/babel-plugin-transform-runtime/test/fixtures/runtime/custom-runtime/expected.js
#	packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/expected.js
#	packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/expected.js
#	packages/babel-plugin-transform-strict-mode/package.json
#	packages/babel-polyfill/package.json
#	packages/babel-preset-es2015/package.json
#	packages/babel-preset-es2016/package.json
#	packages/babel-preset-es2017/package.json
#	packages/babel-preset-latest/package.json
#	packages/babel-preset-react/package.json
#	packages/babel-preset-stage-0/package.json
#	packages/babel-preset-stage-1/package.json
#	packages/babel-preset-stage-2/package.json
#	packages/babel-preset-stage-3/package.json
#	packages/babel-register/README.md
#	packages/babel-register/package.json
#	packages/babel-runtime/package.json
#	packages/babel-template/package.json
#	packages/babel-traverse/package.json
#	packages/babel-traverse/src/scope/lib/renamer.js
#	packages/babel-traverse/test/evaluation.js
#	packages/babel-traverse/test/replacement.js
#	packages/babel-types/README.md
#	packages/babel-types/package.json
#	packages/babel-types/src/converters.js
#	packages/babel-types/src/definitions/core.js
#	packages/babel-types/src/definitions/es2015.js
#	packages/babel-types/src/definitions/flow.js
#	packages/babel-types/test/converters.js
#	packages/babel-types/test/validators.js
#	scripts/generate-interfaces.js
#	yarn.lock
2017-08-31 17:44:17 +02:00
Henry Zhu
7b30f77954 Merge pull request #6111 from modosc/update-regenerator
Update regenerator
2017-08-16 10:17:59 -04:00
Mateusz Burzyński
fffa604023 Fixed regenerator related fixtures 2017-08-16 10:02:33 +02:00
Henry Zhu
0f823beeb1 Newlines in fixtures (#6044)
* write newlines for fixtures

* rerun fixtures
2017-08-02 15:35:29 -04:00
Henry Zhu
123dce5fcd Hardcode to double quotes, indent to 2 spaces (#5824) 2017-06-05 22:14:37 -05:00
Artem Yavorsky
3146b245ed Test arrow function inside generator. (#5605) 2017-04-12 11:13:58 -07:00
Daniel Tschinder
66f8546107
Add test for regression 4219 2017-04-06 15:51:17 +02:00
Sasha Aickin
60df9f3cad Updating regenerator-transform and adding a test for the issue in facebook/regenerator#267 2017-03-30 22:10:02 -07:00
Sergey Rubanov
292c3ca206 Refactor test packages to use ES modules instead of CJS (#5138) 2017-01-16 11:25:04 -05:00
Logan Smyth
ea426baa07 Avoid duplicated identifier sharing location - fixes T7436 2016-07-18 20:49:14 -07:00
Logan Smyth
96a6d9f92e Queue regeneratorRuntime so it is transformed before Program#exit - fixes T7041 2016-02-13 22:56:03 -08:00
Jason
35463a46b6 Use exec style test in transform-regenerator 2016-01-23 23:30:52 +08:00
Jason
bbdd4aaf21 Ignore isolated paths when traversing 2016-01-23 18:39:14 +08:00
Logan Smyth
ee6f470d77 Requeue generators for re-traversal so we pick up regeneratorRuntime - fixes T6676 2015-12-13 16:15:02 -08:00
Logan Smyth
a675234526 Ensure that generator functions always have an identifier - fixes T6733 2015-11-30 23:14:10 -08:00
Sebastian McKenzie
983ca5c71f add function.sent 2015-11-17 23:02:21 -08:00