diff options
author | Johannes <johannes.ewald@roomieplanet.de> | 2012-07-03 05:10:53 +0400 |
---|---|---|
committer | Johannes <johannes.ewald@roomieplanet.de> | 2012-07-03 05:10:53 +0400 |
commit | 8b9539e037e344e1c079f5231e61759377b7ecae (patch) | |
tree | e670e70d002a6b6c55d8a75c431cbd74b8f2ef7e | |
parent | dfe9ba7d197263641ac1d0247993bd7fa938b2c5 (diff) |
updated comments
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | lib/browserify/browserifyRewire.js | 2 | ||||
-rw-r--r-- | lib/browserify/getRewireRequires.js | 6 |
3 files changed, 10 insertions, 5 deletions
@@ -12,8 +12,7 @@ rewire does **not** load the file and eval the contents to emulate node's requir **Debugging is fully supported.**
-Furthermore rewire comes also with support for [browserify](https://github.com/substack/node-browserify). Thus you can mock your modules in the browser as well.
-**Update:** *rewire seems to be [broken with browserify >= 1.13.4](https://github.com/jhnns/rewire/issues/5). I'm working on that.*
+Furthermore rewire comes also with support for [browserify](https://github.com/substack/node-browserify).
[![Build Status](https://secure.travis-ci.org/jhnns/rewire.png?branch=master)](http://travis-ci.org/jhnns/rewire)
@@ -25,12 +24,12 @@ Installation `npm install rewire`
**For older node versions:**<br />
-rewire is tested with node 0.6.x - 0.8.x. I recommend to run the unit tests via `mocha` in the rewire-folder before using rewire with older node versions.
+rewire is tested with node 0.6.x - 0.8.x. I recommend to run the unit tests via `mocha` in the rewire-folder before
+using rewire with other node versions.
**Use with [browserify](https://github.com/substack/node-browserify):**<br />
```javascript
-// debug=true splits the source in seperate files in chrome's developer tools
var b = require("browserify")({debug: true});
b.use(require("rewire").browserify);
diff --git a/lib/browserify/browserifyRewire.js b/lib/browserify/browserifyRewire.js index f5d8f90..e21c0db 100644 --- a/lib/browserify/browserifyRewire.js +++ b/lib/browserify/browserifyRewire.js @@ -176,7 +176,7 @@ browserifyRewire.getProxy = function (internalRequire, dirname) { };
/**
- * Scans for global vars an returns an evalable string that declares all globals as a var.
+ * Scans for global vars and returns an evalable string that declares all globals as a var.
* This way a global variable can be overridden by __set__ without changing the global instance.
* It is executed each time again to include global variables that have been added later.
*
diff --git a/lib/browserify/getRewireRequires.js b/lib/browserify/getRewireRequires.js index c8b0f01..896729e 100644 --- a/lib/browserify/getRewireRequires.js +++ b/lib/browserify/getRewireRequires.js @@ -1,3 +1,9 @@ +/***
+ * Searches for rewire(); statements and returns all strings that are between the brackets.
+ *
+ * @param {!String} src
+ * @return {Array}
+ */
function getRewireRequires(src) {
var result = [],
regExp = /[^a-zA-Z0-9_]rewire\(["'](.+?)["']\)/g,
|