From ff63d8f60c4b91bac36d60e804fa8eb7d47abe37 Mon Sep 17 00:00:00 2001 From: Joe McBride Date: Thu, 23 Apr 2015 09:29:19 -0700 Subject: [PATCH 1/4] Bump convert-source-map version. Relates to #1014 --- package.json | 2 +- packages/babel-cli/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d85aa1027f..8377c4783a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "dependencies": { "ast-types": "~0.7.0", "chalk": "^1.0.0", - "convert-source-map": "^1.0.0", + "convert-source-map": "^1.1.0", "core-js": "^0.8.3", "debug": "^2.1.1", "detect-indent": "^3.0.0", diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 74fa87b384..c2ab249828 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -13,7 +13,7 @@ "fs-readdir-recursive": "^0.1.0", "output-file-sync": "^1.1.0", "lodash": "^3.2.0", - "convert-source-map": "^0.5.0", + "convert-source-map": "^1.1.0", "source-map": "^0.4.0", "path-is-absolute": "^1.0.0" }, @@ -22,4 +22,4 @@ "babel-node": "./bin/babel-node", "babel-external-helpers": "./bin/babel-external-helpers" } -} \ No newline at end of file +} From b760daca21795cb7a0004a3d94bf072732967f83 Mon Sep 17 00:00:00 2001 From: George Stagas Date: Thu, 23 Apr 2015 21:27:14 +0300 Subject: [PATCH 2/4] fix test tmp dir cleanup --- test/core/bin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/core/bin.js b/test/core/bin.js index 6819a711d3..a925716bea 100644 --- a/test/core/bin.js +++ b/test/core/bin.js @@ -111,6 +111,7 @@ var buildTest = function (binName, testName, opts) { }; var clear = function () { + process.chdir(__dirname); if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); fs.mkdirSync(tmpLoc); process.chdir(tmpLoc); From 2bd35fac6e6c8a18ee6a4815d63f02a51d0ac11f Mon Sep 17 00:00:00 2001 From: George Stagas Date: Fri, 24 Apr 2015 16:58:52 +0300 Subject: [PATCH 3/4] normalize filename slashes for shouldIgnore --- src/babel/api/register/node.js | 2 ++ src/babel/util.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/babel/api/register/node.js b/src/babel/api/register/node.js index b3175aa8fc..b601dd880f 100644 --- a/src/babel/api/register/node.js +++ b/src/babel/api/register/node.js @@ -7,6 +7,7 @@ import * as babel from "../node"; import each from "lodash/collection/each"; import * as util from "../../util"; import fs from "fs"; +import slash from "slash"; sourceMapSupport.install({ handleUncaughtExceptions: false, @@ -76,6 +77,7 @@ var compile = function (filename) { }; var shouldIgnore = function (filename) { + filename = slash(filename); return (ignoreRegex && ignoreRegex.test(filename)) || (onlyRegex && !onlyRegex.test(filename)); }; diff --git a/src/babel/util.js b/src/babel/util.js index 298267bf59..eb117b459a 100644 --- a/src/babel/util.js +++ b/src/babel/util.js @@ -18,6 +18,7 @@ import each from "lodash/collection/each"; import has from "lodash/object/has"; import fs from "fs"; import * as t from "./types"; +import slash from "slash"; export { inherits, inspect } from "util"; @@ -94,6 +95,7 @@ export function booleanify(val: any): boolean { } export function shouldIgnore(filename, ignore, only) { + filename = slash(filename); if (only.length) { for (var i = 0; i < only.length; i++) { if (only[i].test(filename)) return false; From 03dbaa3e0efa245d16eb3f251a5cc5e4cf683db2 Mon Sep 17 00:00:00 2001 From: Luke Scott Date: Thu, 23 Apr 2015 12:14:02 -0700 Subject: [PATCH 4/4] fix resolve-rc loading options twice - fixes #1329 --- src/babel/tools/resolve-rc.js | 20 ++++++++++++++++++-- src/babel/transformation/file/options.json | 5 +++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/babel/tools/resolve-rc.js b/src/babel/tools/resolve-rc.js index 29a14fbab1..78fe34e14e 100644 --- a/src/babel/tools/resolve-rc.js +++ b/src/babel/tools/resolve-rc.js @@ -17,9 +17,17 @@ function exists(filename) { export default function (loc, opts = {}) { var rel = ".babelrc"; + if (!opts.babelrc) { + opts.babelrc = []; + } + function find(start, rel) { var file = path.join(start, rel); + if (opts.babelrc.indexOf(file) >= 0) { + return; + } + if (exists(file)) { var content = fs.readFileSync(file, "utf8"); var json; @@ -31,10 +39,18 @@ export default function (loc, opts = {}) { throw err; } + opts.babelrc.push(file); + if (json.breakConfig) return; merge(opts, json, function(a, b) { if (Array.isArray(a)) { - return a.concat(b); + var c = a.slice(0); + for (var v of b) { + if (a.indexOf(v) < 0) { + c.push(v); + } + } + return c; } }); } @@ -45,7 +61,7 @@ export default function (loc, opts = {}) { } } - if (opts.breakConfig !== true) { + if (opts.babelrc.indexOf(loc) < 0 && opts.breakConfig !== true) { find(loc, rel); } diff --git a/src/babel/transformation/file/options.json b/src/babel/transformation/file/options.json index 09051eba52..d3bccddd34 100644 --- a/src/babel/transformation/file/options.json +++ b/src/babel/transformation/file/options.json @@ -206,6 +206,11 @@ "default": false, "hidden": true, "description": "stop trying to load .babelrc files" + }, + + "babelrc": { + "hidden": true, + "description": "do not load the same .babelrc file twice" } }