From 05ee30c9f74a374072e26a8c889ee89bf15137cc Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Wed, 15 Mar 2017 22:40:49 -0700 Subject: [PATCH] Use the standard option parser to load the internal plugins. --- packages/babel-core/src/transformation/file/index.js | 9 +++++---- .../src/transformation/internal-plugins/block-hoist.js | 5 ++--- .../transformation/internal-plugins/shadow-functions.js | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 9d5af49ff0..6268f2aa45 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -16,16 +16,17 @@ import path from "path"; import * as t from "babel-types"; import resolve from "../../helpers/resolve"; +import OptionManager from "./options/option-manager"; import blockHoistPlugin from "../internal-plugins/block-hoist"; import shadowFunctionsPlugin from "../internal-plugins/shadow-functions"; const shebangRegex = /^#!.*/; -const INTERNAL_PLUGINS = [ - [blockHoistPlugin], - [shadowFunctionsPlugin], -]; +const INTERNAL_PLUGINS = new OptionManager().init({ + babelrc: false, + plugins: [ blockHoistPlugin, shadowFunctionsPlugin ], +}).plugins; const errorVisitor = { enter(path, state) { diff --git a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js index 35dee65312..4813b18d22 100644 --- a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js +++ b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js @@ -1,7 +1,6 @@ -import Plugin from "../plugin"; import sortBy from "lodash/sortBy"; -export default new Plugin({ +export default { /** * [Please add a description.] * @@ -39,4 +38,4 @@ export default new Plugin({ }, }, }, -}); +}; diff --git a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js index ce50d21c01..45122a0a3f 100644 --- a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js +++ b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js @@ -1,4 +1,3 @@ -import Plugin from "../plugin"; import * as t from "babel-types"; const SUPER_THIS_BOUND = Symbol("super this bound"); @@ -15,7 +14,7 @@ const superVisitor = { }, }; -export default new Plugin({ +export default { name: "internal.shadowFunctions", visitor: { @@ -29,7 +28,7 @@ export default new Plugin({ } }, }, -}); +}; function shouldShadow(path, shadowPath) { if (path.is("_forceShadow")) {