From 8b9539e037e344e1c079f5231e61759377b7ecae Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 3 Jul 2012 03:10:53 +0200 Subject: updated comments --- README.md | 7 +++---- lib/browserify/browserifyRewire.js | 2 +- lib/browserify/getRewireRequires.js | 6 ++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4b4d15a..adaad18 100644 --- a/README.md +++ b/README.md @@ -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:**
-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):**
```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, -- cgit v1.2.3