From 6afcef98051c4e6aa1d50d71d2ab3704143ac17b Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 15 May 2015 01:44:57 +0100 Subject: [PATCH] actually fix shouldIgnore algorithm this time, ugh --- src/babel/util.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/babel/util.js b/src/babel/util.js index 03a58b04b5..d467fd9e3f 100644 --- a/src/babel/util.js +++ b/src/babel/util.js @@ -111,27 +111,32 @@ export function shouldIgnore(filename, ignore, only) { filenames.push(parts.slice(0, i + 1).join("/")); } - for (let filename of (filenames: Array)) { - var should = _shouldIgnore(filename, ignore, only); - if (should != null) return should; + if (only.length) { + for (var pattern of (only: Array)) { + var matches = false; + + for (let filename of (filenames: Array)) { + if (pattern.test(filename)) { + matches = true; + break; + } + } + + if (!matches) return false; + } + + return true; + } else if (ignore.length) { + for (let filename of (filenames: Array)) { + for (var pattern of (ignore: Array)) { + if (pattern.test(filename)) return true; + } + } } return false; } -function _shouldIgnore(filename, ignore, only) { - if (only.length) { - for (var pattern of (only: Array)) { - if (pattern.test(filename)) return false; - } - return true; - } else if (ignore.length) { - for (var pattern of (ignore: Array)) { - if (pattern.test(filename)) return true; - } - } -} - var templateVisitor = { enter(node, parent, scope, nodes) { if (t.isExpressionStatement(node)) {