Use the standard option parser to load the internal plugins.

This commit is contained in:
Logan Smyth 2017-03-15 22:40:49 -07:00
parent 38720ae309
commit 05ee30c9f7
3 changed files with 9 additions and 10 deletions

View File

@ -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) {

View File

@ -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({
},
},
},
});
};

View File

@ -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")) {