From ea03f67505d17b54811eb6c1ba2b976150b6fb4c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 30 Apr 2015 18:13:17 +0100 Subject: [PATCH] use a strict regex when splitting string plugins - fixes #1361 --- src/babel/transformation/file/plugin-manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/babel/transformation/file/plugin-manager.js b/src/babel/transformation/file/plugin-manager.js index 61c580748e..e05f7a27b0 100644 --- a/src/babel/transformation/file/plugin-manager.js +++ b/src/babel/transformation/file/plugin-manager.js @@ -29,7 +29,8 @@ export default class PluginManager { // this is a plugin in the form of "foobar" or "foobar:after" // where the optional colon is the delimiter for plugin position in the transformer stack - var [name, position = _position] = key.split(":"); + var match = key.match(/^(.*?):(after|before)$/); + if (match) [, name, position] = match; var loc = util.resolveRelative(name) || util.resolveRelative(`babel-plugin-${name}`); if (loc) {