Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Remove '*' as a plugin option #301

Merged
merged 1 commit into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@ import { getOptions } from "../options";
import Tokenizer from "../tokenizer";

export const plugins = {};
const frozenDeprecatedWildcardPluginList = [
"jsx",
"doExpressions",
"objectRestSpread",
"decorators",
"classProperties",
"exportExtensions",
"asyncGenerators",
"functionBind",
"functionSent",
"dynamicImport",
"flow"
];

export default class Parser extends Tokenizer {
constructor(options: Object, input: string) {
Expand Down Expand Up @@ -43,36 +30,14 @@ export default class Parser extends Tokenizer {
}

hasPlugin(name: string): boolean {
if (this.plugins["*"] && frozenDeprecatedWildcardPluginList.indexOf(name) > -1) {
return true;
}

return !!this.plugins[name];
}

extend(name: string, f: Function) {
this[name] = f(this[name]);
}

loadAllPlugins() {
// ensure flow plugin loads last
const pluginNames = Object.keys(plugins).filter((name) => name !== "flow");
pluginNames.push("flow");

pluginNames.forEach((name) => {
const plugin = plugins[name];
if (plugin) plugin(this);
});
}

loadPlugins(pluginList: Array<string>): { [key: string]: boolean } {
// TODO: Deprecate "*" option in next major version of Babylon
if (pluginList.indexOf("*") >= 0) {
this.loadAllPlugins();

return { "*": true };
}

const pluginMap = {};

if (pluginList.indexOf("flow") >= 0) {
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/jsx/regression/test-star-option/actual.js

This file was deleted.

277 changes: 0 additions & 277 deletions test/fixtures/jsx/regression/test-star-option/expected.json

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/jsx/regression/test-star-option/options.json

This file was deleted.