require: add missing blacklistTests, implement opts.whitelist and opts.only - closes #125

This commit is contained in:
Sebastian McKenzie
2014-11-07 12:25:42 +11:00
parent 9bb8a16d93
commit 26428cde41
2 changed files with 37 additions and 21 deletions

View File

@@ -192,21 +192,26 @@ require("6to5/register");
```
**NOTE:** By default all requires to `node_modules` will be ignored. You can
override this by passing an ignore regex via:
override this by passing an ignore regex with`.
```javascript
require("6to5/register")(/regex/);
```
You can also customise the file extensions that the require hook will use via:
##### Options
```javascript
require("6to5/register")({
// optional ignore regex
ignoreRegex: /regex/,
// Optional ignore regex - if any filenames **do** match this regex then they
// aren't compiled
ignore: /regex/,
// this will remove the currently hooked extensions of .es6 and .js so you'll
// have to add them back if you want them to be used again
// Optional only regex - if any filenames **don't** match this regex then they
// aren't compiled
only: /my_es6_folder/,
// See options above for usage
whitelist: [],
blacklist: [],
// This will remove the currently hooked extensions of .es6 and .js so you'll
// have to add them back if you want them to be used again.
extensions: [".js", ".es6"]
});
```