Comparing version 6.3.0 to 6.4.0
@@ -17,2 +17,3 @@ var assign = require("object-assign"); | ||
this._data = ""; | ||
this._filename = filename; | ||
this._opts = assign({filename: filename}, opts); | ||
@@ -28,3 +29,5 @@ } | ||
try { | ||
var code = babel.transform(this._data, this._opts).code; | ||
var result = babel.transform(this._data, this._opts); | ||
this.emit("babelify", result, this._filename); | ||
var code = result.code; | ||
this.push(code); | ||
@@ -31,0 +34,0 @@ } catch(err) { |
{ | ||
"name": "babelify", | ||
"description": "Babel browserify transform", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"babel-core": "^5.0.0", | ||
"object-assign": "^3.0.0" | ||
"object-assign": "^4.0.0" | ||
}, | ||
@@ -23,3 +23,3 @@ "devDependencies": { | ||
"convert-source-map": "^1.1.0", | ||
"tap": "^1.0.2" | ||
"tap": "^2.1.1" | ||
}, | ||
@@ -26,0 +26,0 @@ "scripts": { |
@@ -136,2 +136,21 @@ # babelify | ||
#### Babel result: metadata and others | ||
Babelify emits a `babelify` event with Babel's full result object as the first | ||
argument, and the filename as the second. Browserify doesn't pass-through the | ||
events emitted by a transform, so it's necessary to get a reference to the | ||
transform instance before you can attach a listener for the event: | ||
```js | ||
var b = browserify().transform(babelify); | ||
b.on('transform', function(tr) { | ||
if (tr instanceof babelify) { | ||
tr.once('babelify', function(result, filename) { | ||
result; // => { code, map, ast, metadata } | ||
}); | ||
} | ||
}); | ||
``` | ||
## FAQ | ||
@@ -138,0 +157,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8287
56
179
- Removedobject-assign@3.0.0(transitive)
Updatedobject-assign@^4.0.0