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 * as t from "babel-types";
import resolve from "../../helpers/resolve"; import resolve from "../../helpers/resolve";
import OptionManager from "./options/option-manager";
import blockHoistPlugin from "../internal-plugins/block-hoist"; import blockHoistPlugin from "../internal-plugins/block-hoist";
import shadowFunctionsPlugin from "../internal-plugins/shadow-functions"; import shadowFunctionsPlugin from "../internal-plugins/shadow-functions";
const shebangRegex = /^#!.*/; const shebangRegex = /^#!.*/;
const INTERNAL_PLUGINS = [ const INTERNAL_PLUGINS = new OptionManager().init({
[blockHoistPlugin], babelrc: false,
[shadowFunctionsPlugin], plugins: [ blockHoistPlugin, shadowFunctionsPlugin ],
]; }).plugins;
const errorVisitor = { const errorVisitor = {
enter(path, state) { enter(path, state) {

View File

@ -1,7 +1,6 @@
import Plugin from "../plugin";
import sortBy from "lodash/sortBy"; import sortBy from "lodash/sortBy";
export default new Plugin({ export default {
/** /**
* [Please add a description.] * [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"; import * as t from "babel-types";
const SUPER_THIS_BOUND = Symbol("super this bound"); const SUPER_THIS_BOUND = Symbol("super this bound");
@ -15,7 +14,7 @@ const superVisitor = {
}, },
}; };
export default new Plugin({ export default {
name: "internal.shadowFunctions", name: "internal.shadowFunctions",
visitor: { visitor: {
@ -29,7 +28,7 @@ export default new Plugin({
} }
}, },
}, },
}); };
function shouldShadow(path, shadowPath) { function shouldShadow(path, shadowPath) {
if (path.is("_forceShadow")) { if (path.is("_forceShadow")) {