Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: babel/babelify
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 27282793d1a4819e7e44a33540a84792f1f79dd9
Choose a base ref
...
head repository: babel/babelify
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b06b778117617884cb14890995c8a27450dd3135
Choose a head ref
  • 6 commits
  • 7 files changed
  • 3 contributors

Commits on May 23, 2016

  1. babelify in quotes in example (#198)

    ...to be consistent with rest of doc
    jamesgpearce authored and hzoo committed May 23, 2016

    Verified

    This commit was signed with the committer’s verified signature.
    bagder Daniel Stenberg
    Copy the full SHA
    d9e3029 View commit details

Commits on May 25, 2016

  1. Explain the double negatives a bit better (#197)

    * Explain the double negatives a bit better
    
    The previous version was correct; just needed some clarification I felt.
    
    * typo and ?! explanation
    jamesgpearce authored and zertosh committed May 25, 2016
    Copy the full SHA
    9944a55 View commit details
  2. Copy the full SHA
    6d45fa8 View commit details

Commits on Oct 24, 2017

  1. drop node 0.10/0.12, add peerDep on babel-core instead of dep, drop o…

    …bject-assign, add package-lock
    hzoo authored and zertosh committed Oct 24, 2017
    Copy the full SHA
    02f97ec View commit details
  2. Copy the full SHA
    ea73917 View commit details
  3. 8.0.0

    zertosh committed Oct 24, 2017
    2
    Copy the full SHA
    b06b778 View commit details
Showing with 5,303 additions and 22 deletions.
  1. +5 −4 .travis.yml
  2. +2 −2 README.md
  3. +3 −4 index.js
  4. +5,284 −0 package-lock.json
  5. +4 −5 package.json
  6. +1 −2 test/babel-source-maps.js
  7. +4 −5 test/browser-pack-source-maps.js
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- node
- "8"
- "6"
- "4"

before_install:
- npm install -g npm@^3.3.0
- npm install -g npm@5
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -186,13 +186,13 @@ specify options then you can use:
Another solution (proceed with caution!) is to run babelify as a [global](https://github.com/substack/node-browserify#btransformtr-opts) transform. Use the babel [`ignore` option](http://babeljs.io/docs/usage/options/) to narrow the number of files transformed:

```js
browserify().transform(babelify, {
browserify().transform("babelify", {
global: true,
ignore: /\/node_modules\/(?!app\/)/
});
```

The above example will transform all files except those in the `node_modules` directory that are not in `node_modules/app`.
The above example will result in a transform that also includes the `app` module in `node_modules`: the `global` flag transform all files, and the `ignore` regular expression then excludes all those in the `node_modules` directory *except* those that are in `node_modules/app` (since `?!` will match if the given suffix is absent).

### Why am I not getting source maps?

7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var assign = require("object-assign");
var stream = require("stream");
var babel = require("babel-core");
var util = require("util");
@@ -14,7 +13,7 @@ function Babelify(filename, opts) {
stream.Transform.call(this);
this._data = "";
this._filename = filename;
this._opts = assign({filename: filename}, opts);
this._opts = Object.assign({filename: filename}, opts);
}

Babelify.prototype._transform = function (buf, enc, callback) {
@@ -36,7 +35,7 @@ Babelify.prototype._flush = function (callback) {
};

Babelify.configure = function (opts) {
opts = assign({}, opts);
opts = Object.assign({}, opts);
var extensions = opts.extensions ? babel.util.arrayify(opts.extensions) : null;
var sourceMapsAbsolute = opts.sourceMapsAbsolute;
if (opts.sourceMaps !== false) opts.sourceMaps = "inline";
@@ -68,7 +67,7 @@ Babelify.configure = function (opts) {
}

var _opts = sourceMapsAbsolute
? assign({sourceFileName: filename}, opts)
? Object.assign({sourceFileName: filename}, opts)
: opts;

return new Babelify(filename, _opts);
5,284 changes: 5,284 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "babelify",
"description": "Babel browserify transform",
"version": "7.3.0",
"version": "8.0.0",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"license": "MIT",
"homepage": "https://github.com/babel/babelify",
@@ -12,11 +12,11 @@
"bugs": {
"url": "https://github.com/babel/babelify/issues"
},
"dependencies": {
"babel-core": "^6.0.14",
"object-assign": "^4.0.0"
"peerDependencies": {
"babel-core": "6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc"
},
"devDependencies": {
"babel-core": "^6.0.14",
"babel-plugin-transform-es3-property-literals": "^6.0.14",
"babel-plugin-transform-node-env-inline": "^6.0.14",
"babel-plugin-transform-react-display-name": "^6.0.14",
@@ -26,7 +26,6 @@
"browserify": "^13.0.0",
"convert-source-map": "^1.1.0",
"lodash.zipobject": "^4.1.3",
"path-is-absolute": "^1.0.0",
"tap": "^5.7.1"
},
"scripts": {
3 changes: 1 addition & 2 deletions test/babel-source-maps.js
Original file line number Diff line number Diff line change
@@ -3,13 +3,12 @@ var babel = require('babel-core');
var convert = require('convert-source-map');
var fs = require('fs');
var path = require('path');
var pathIsAbsolute = require('path-is-absolute');
var test = require('tap').test;

// Validate assumptions about babel's source maps.

var sourceFile = path.join(__dirname, 'bundle/index.js');
assert(pathIsAbsolute(sourceFile));
assert(path.isAbsolute(sourceFile));

var sourceSrc = fs.readFileSync(sourceFile, 'utf8');

9 changes: 4 additions & 5 deletions test/browser-pack-source-maps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var browserify = require('browserify');
var convert = require('convert-source-map');
var path = require('path');
var pathIsAbsolute = require('path-is-absolute');
var zipObject = require('lodash.zipobject');
var test = require('tap').test;
var babelify = require('../');
@@ -28,7 +27,7 @@ test('browserify source maps (no basedir)', function(t) {

var deps = {};
b.on('dep', function(dep) {
t.ok(pathIsAbsolute(dep.file));
t.ok(path.isAbsolute(dep.file));
deps[dep.file] = dep.source;
});

@@ -45,7 +44,7 @@ test('browserify source maps (no basedir)', function(t) {

// source paths are relative to the basedir (cwd if not set)
sm.sources.forEach(function(source) {
t.ok(!pathIsAbsolute(source));
t.ok(!path.isAbsolute(source));
var aSource = path.join(__dirname, '..', source);
t.ok(deps.hasOwnProperty(aSource));
});
@@ -78,7 +77,7 @@ test('browserify source maps (with basedir)', function(t) {

var deps = {};
b.on('dep', function(dep) {
t.ok(pathIsAbsolute(dep.file));
t.ok(path.isAbsolute(dep.file));
deps[dep.file] = dep.source;
});

@@ -95,7 +94,7 @@ test('browserify source maps (with basedir)', function(t) {

// source paths are relative to the basedir (cwd if not set)
sm.sources.forEach(function(source) {
t.ok(!pathIsAbsolute(source));
t.ok(!path.isAbsolute(source));
var aSource = path.join(__dirname, source);
t.ok(deps.hasOwnProperty(aSource));
});