Add support for glob in babel-worker ignored paths

* Also fixes an issue with handling paths on Windows
This commit is contained in:
Tom Najdek 2017-06-03 16:50:10 +01:00 committed by Dan Stillman
parent f98ccdee46
commit c335099465
2 changed files with 3 additions and 1 deletions

View file

@ -4,6 +4,7 @@
const fs = require('fs');
const path = require('path');
const babel = require('babel-core');
const minimatch = require('minimatch')
const mkdirp = require('mkdirp');
const options = JSON.parse(fs.readFileSync('.babelrc'));
@ -18,7 +19,7 @@ onmessage = (ev) => {
var transformed;
if(sourcefile === 'resource/react-dom.js') {
transformed = data.replace(/ownerDocument\.createElement\((.*?)\)/gi, 'ownerDocument.createElementNS(DOMNamespaces.html, $1)');
} else if('ignore' in options && options.ignore.includes(sourcefile)) {
} else if('ignore' in options && options.ignore.some(ignoreGlob => minimatch(sourcefile, ignoreGlob))) {
transformed = data;
isSkipped = true;
} else {

View file

@ -43,6 +43,7 @@
"gulp-tap": "^1.0.1",
"gulp-util": "^3.0.7",
"merge-stream": "^1.0.1",
"minimatch": "^3.0.4",
"mocha": "^3.4.2",
"sinon": "^2.3.1",
"through2": "^2.0.1",