Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cff9519e1 | ||
|
|
f9c2c6e988 | ||
|
|
5ae3dc01f1 | ||
|
|
af4fd69dd0 | ||
|
|
4d4493f325 | ||
|
|
e70d474b39 |
@@ -13,12 +13,17 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 5.4.2
|
||||
|
||||
* **Polish**
|
||||
* `ignore` and `only` patterns are now **very** liberal. The pattern can now exist anywhere in the path.
|
||||
|
||||
## 5.4.1
|
||||
|
||||
* **Bug Fix**
|
||||
* Add missing `slash` dependency. Thanks [@browncolyn](https://github.com/browncolyn)!
|
||||
* **Polish**
|
||||
* Clean up `shouldIgnore` algorithm to work how you'd expect rather than being a hacky piece of shit.
|
||||
* Clean up `shouldIgnore` algorithm to work how you'd expect rather than being a hacky piece of shit. It now crawls the entire path, checking each section of it against the input ignore/only patterns. This means that the pattern `foo` will ignore the paths `foo/bar.js`, `bar/foo` etc.
|
||||
|
||||
## 5.4.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.4.1",
|
||||
"version": "5.4.2",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.4.0",
|
||||
"version": "5.4.1",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"babel-core": "^5.4.0",
|
||||
"babel-core": "^5.4.1",
|
||||
"chokidar": "^1.0.0",
|
||||
"commander": "^2.6.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
@@ -25,4 +25,4 @@
|
||||
"babel-node": "./bin/babel-node",
|
||||
"babel-external-helpers": "./bin/babel-external-helpers"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.4.0",
|
||||
"version": "5.4.1",
|
||||
"license": "MIT",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "./patch";
|
||||
|
||||
import escapeRegExp from "lodash/string/escapeRegExp";
|
||||
|
||||
import startsWith from "lodash/string/startsWith";
|
||||
import cloneDeep from "lodash/lang/cloneDeep";
|
||||
import isBoolean from "lodash/lang/isBoolean";
|
||||
import * as messages from "./messages";
|
||||
@@ -69,9 +69,22 @@ export function list(val: string): Array<string> {
|
||||
|
||||
export function regexify(val: any): RegExp {
|
||||
if (!val) return new RegExp(/.^/);
|
||||
|
||||
if (Array.isArray(val)) val = new RegExp(val.map(escapeRegExp).join("|"), "i");
|
||||
if (isString(val)) return minimatch.makeRe(val, { nocase: true });
|
||||
|
||||
if (isString(val)) {
|
||||
// normalise path separators
|
||||
val = slash(val);
|
||||
|
||||
// remove relative separator if present
|
||||
if (startsWith(val, "./")) val = val.slice(2);
|
||||
|
||||
var regex = minimatch.makeRe(val, { nocase: true });
|
||||
return new RegExp(regex.source.slice(1, -1), "i");
|
||||
}
|
||||
|
||||
if (isRegExp(val)) return val;
|
||||
|
||||
throw new TypeError("illegal type for regexify");
|
||||
}
|
||||
|
||||
@@ -95,40 +108,16 @@ export function booleanify(val: any): boolean {
|
||||
}
|
||||
|
||||
export function shouldIgnore(filename, ignore, only) {
|
||||
if (!ignore.length && !only.length) return false;
|
||||
|
||||
filename = slash(filename);
|
||||
|
||||
var filenames = [];
|
||||
|
||||
// try and match each section of the path
|
||||
var parts = filename.split("/");
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var part = parts[i];
|
||||
if (!part) continue;
|
||||
|
||||
filenames.push(part);
|
||||
filenames.push(parts.slice(0, i + 1).join("/"));
|
||||
}
|
||||
|
||||
if (only.length) {
|
||||
var matches = false;
|
||||
|
||||
for (let filename of (filenames: Array)) {
|
||||
for (var pattern of (only: Array)) {
|
||||
if (pattern.test(filename)) {
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var pattern of (only: Array)) {
|
||||
if (pattern.test(filename)) return false;
|
||||
}
|
||||
|
||||
return !matches;
|
||||
return true;
|
||||
} else if (ignore.length) {
|
||||
for (let filename of (filenames: Array)) {
|
||||
for (var pattern of (ignore: Array)) {
|
||||
if (pattern.test(filename)) return true;
|
||||
}
|
||||
for (var pattern of (ignore: Array)) {
|
||||
if (pattern.test(filename)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,9 +80,16 @@ suite("util", function () {
|
||||
assert.deepEqual(util.regexify(null), /.^/);
|
||||
assert.deepEqual(util.regexify(""), /.^/);
|
||||
assert.deepEqual(util.regexify(["foo", "bar"]), /foo|bar/i);
|
||||
assert.deepEqual(util.regexify("foobar"), /^(?:(?=.)foobar)$/i);
|
||||
assert.deepEqual(util.regexify("foobar"), /(?:(?=.)foobar)/i);
|
||||
assert.deepEqual(util.regexify(/foobar/), /foobar/);
|
||||
|
||||
assert.ok(util.regexify("foo/bar").test("bar/foo/bar"));
|
||||
assert.ok(util.regexify("foo/*").test("foo/bar.js"));
|
||||
assert.ok(util.regexify("*.js").test("bar.js"));
|
||||
assert.ok(util.regexify("./foo").test("foo"));
|
||||
assert.ok(util.regexify("./foo/bar.js").test("foo/bar.js"));
|
||||
assert.ok(util.regexify("foobar").test("foobar"));
|
||||
|
||||
assert.throws(function () {
|
||||
util.regexify({});
|
||||
}, /illegal type for regexify/);
|
||||
|
||||
Reference in New Issue
Block a user