Comparing version 5.0.3 to 5.0.4
11
index.js
@@ -14,9 +14,7 @@ var through = require("through"); | ||
if (opts.extensions) opts.extensions = babel._util.arrayify(opts.extensions); | ||
if (opts.ignore) opts.ignore = babel._util.regexify(opts.ignore); | ||
opts.ignore = babel._util.regexify(opts.ignore); | ||
if (opts.only) opts.only = babel._util.regexify(opts.only); | ||
return function (filename) { | ||
if ((opts.ignore && opts.ignore.test(filename)) || | ||
(opts.only && !opts.only.test(filename)) || | ||
!babel.canCompile(filename, opts.extensions)) { | ||
if (opts.ignore.test(filename) || (opts.only && !opts.only.test(filename)) || !babel.canCompile(filename, opts.extensions)) { | ||
return through(); | ||
@@ -28,3 +26,3 @@ } | ||
} | ||
var data = ""; | ||
@@ -42,2 +40,3 @@ | ||
delete opts2.extensions; | ||
delete opts2.global; | ||
opts2.filename = filename; | ||
@@ -52,3 +51,3 @@ | ||
} | ||
stream.queue(out); | ||
@@ -55,0 +54,0 @@ stream.queue(null); |
{ | ||
"name": "babelify", | ||
"description": "Babel browserify plugin", | ||
"version": "5.0.3", | ||
"description": "Babel browserify transform", | ||
"version": "5.0.4", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/babel/babelify", |
# babelify | ||
[Babel](https://github.com/babel/babel) [browserify](https://github.com/substack/node-browserify) plugin | ||
[Babel](https://github.com/babel/babel) [browserify](https://github.com/substack/node-browserify) transform | ||
@@ -33,3 +33,3 @@ ## Installation | ||
browserify().transform(babelify.configure({ | ||
blacklist: ["generators"] | ||
blacklist: ["regenerator"] | ||
})) | ||
@@ -39,3 +39,3 @@ ``` | ||
```sh | ||
$ browserify -d -e script.js -t [ babelify --blacklist generators ] | ||
$ browserify -d -e script.js -t [ babelify --blacklist regenerator ] | ||
``` | ||
@@ -45,3 +45,3 @@ | ||
By default 6to5's [experimental transforms](http://6to5.org/docs/usage/transformers/#es7-experimental-) | ||
By default Babel's [experimental transforms](http://babeljs.io/docs/usage/transformers/#es7-experimental-) | ||
are disabled. You can turn them on by passing `experimental` as a configuration option. | ||
@@ -61,3 +61,3 @@ | ||
By default all files with the extensions `.js`, `.es`, '`.es6` and `.jsx` are compiled. | ||
By default all files with the extensions `.js`, `.es`, `.es6` and `.jsx` are compiled. | ||
You can change this by passing an array of extensions. | ||
@@ -70,3 +70,3 @@ | ||
browserify().transform(babelify.configure({ | ||
extensions: [".6to5"] | ||
extensions: [".babel"] | ||
})) | ||
@@ -76,3 +76,3 @@ ``` | ||
```sh | ||
$ browserify -d -e script.js -t [ babelify --extensions .6to5 ] | ||
$ browserify -d -e script.js -t [ babelify --extensions .babel ] | ||
``` | ||
@@ -124,1 +124,26 @@ | ||
``` | ||
## FAQ | ||
### Why aren't files in `node_modules` being transformed? | ||
This is default browserify behaviour and **can not** be overriden. A possible solution is to add: | ||
```json | ||
{ | ||
"browserify": { | ||
"transform": ["babelify"] | ||
} | ||
} | ||
``` | ||
to the root of all your modules `package.json` that you want to be transformed. If you'd like to | ||
specify options then you can use: | ||
```json | ||
{ | ||
"browserify": { | ||
"transform": [["babelify", { "experimental": true }]] | ||
} | ||
} | ||
``` |
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
6384
143
47