Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fixes + Move babel-core config processing from transformation/file/options into top-level folder #5489

Merged
merged 16 commits into from Mar 21, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Use the standard option parser to load the internal plugins.

  • Loading branch information
loganfsmyth committed Mar 16, 2017
commit 05ee30c9f74a374072e26a8c889ee89bf15137cc
@@ -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) {
@@ -1,7 +1,6 @@
import Plugin from "../plugin";
import sortBy from "lodash/sortBy";

export default new Plugin({

This comment has been minimized.

This comment has been minimized.

Copy link
@loganfsmyth

loganfsmyth Mar 17, 2017

Author Member

They still need to be Plugin instances eventually, but now I'm just relying on the standard plugin initialization interface via https://github.com/babel/babel/pull/5489/files#diff-d6903991e1c21aaacc4d615157f587e5R30 instead of manually calling new Plugin.

export default {
/**
* [Please add a description.]
*
@@ -39,4 +38,4 @@ export default new Plugin({
},
},
},
});
};
@@ -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")) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.