Skip to content

Commit

Permalink
Pass basedir to Babel (#264)
Browse files Browse the repository at this point in the history
* Upgrade Babel to beta.46 & upgrade tap to fix SIGPROF warnings.

* Pass basedir to Babel for correct relative paths in source maps.

* Fix error test regex.

* Upgrade to Babel beta.47

* ci: Drop Node 4; add Node 10
  • Loading branch information
goto-bus-stop authored and loganfsmyth committed May 15, 2018
1 parent c5e4d40 commit 3c10e0c
Show file tree
Hide file tree
Showing 5 changed files with 3,664 additions and 3,252 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
@@ -1,9 +1,6 @@
sudo: false
language: node_js
node_js:
- "10"
- "8"
- "6"
- "4"

before_install:
- npm install -g npm@5
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -62,7 +62,7 @@ Babelify.configure = function (opts) {
if (opts.plugins && opts.plugins._) opts.plugins = opts.plugins._;
if (opts.presets && opts.presets._) opts.presets = opts.presets._;

return function (filename) {
return function (filename, topts) {
var extname = path.extname(filename);
if (extensions.indexOf(extname) === -1) {
return stream.PassThrough();
Expand All @@ -72,6 +72,8 @@ Babelify.configure = function (opts) {
? Object.assign({sourceFileName: filename}, opts)
: opts;

if (topts && topts._flags && topts._flags.basedir) _opts.cwd = topts._flags.basedir;

return new Babelify(filename, _opts);
};
};

0 comments on commit 3c10e0c

Please sign in to comment.