Move plugin processing to top of plugins (#6381)

* centralize plugin options

* Centralize plugins options

- move more options to the top
- move validations that depend on options to the top

* use isLoose option

* Move more validations to the top

* Move ref parameter for rewriteModuleStatementsAndPrepareHeader() to the top

* fix eslint errors

* remove unused parameter

* set default systemGlobal value

* Revert "Move ref parameter for rewriteModuleStatementsAndPrepareHeader() to the top"

This reverts commit b3855302d17fa19d8acb4c8accab3680c8d2710e.

* Revert "Move more validations to the top"

This reverts commit e5861d8a034ff8f553391f55654f753bcf428a5d.

* fix allowMutablePropsOnTags option usage

* improve naming

* change Contructor definition for sake of consistency

* move allowMutablePropsOnTags validation to the top

* add missing !
This commit is contained in:
Anton Rusinov
2017-10-10 07:51:34 +03:00
committed by Logan Smyth
parent d89063bb32
commit fcdfc61bdb
17 changed files with 135 additions and 130 deletions

View File

@@ -1,11 +1,11 @@
import type NodePath from "babel-traverse";
export default function() {
export default function(babel, options) {
const { spec } = options;
return {
visitor: {
ArrowFunctionExpression(
path: NodePath<BabelNodeArrowFunctionExpression>,
state: Object,
) {
// In some conversion cases, it may have already been converted to a function while this callback
// was queued up.
@@ -15,7 +15,7 @@ export default function() {
// While other utils may be fine inserting other arrows to make more transforms possible,
// the arrow transform itself absolutely cannot insert new arrow functions.
allowInsertArrow: false,
specCompliant: !!state.opts.spec,
specCompliant: !!spec,
});
},
},