Permalink
Browse files

Allow pattern matching bundleDependencies

If bundleDependencies is a string, use it as a minimatch pattern
against the folders in node_modules/
  • Loading branch information...
1 parent 146fdd0 commit f114c867b6c3895a22201ececea50600247f0af6 @grncdr committed Mar 31, 2012
Showing with 5 additions and 4 deletions.
  1. +4 −4 fstream-npm.js
  2. +1 −0 package.json
View
@@ -1,4 +1,5 @@
var Ignore = require("fstream-ignore")
+, minimatch = require("minimatch")
, inherits = require("inherits")
, path = require("path")
, fs = require("fs")
@@ -139,10 +140,9 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) {
// only include it at this point if it's a bundleDependency
var bd = this.package && this.package.bundleDependencies
- var shouldBundle = bd && bd.indexOf(entry) !== -1
- // if we're not going to bundle it, then it doesn't count as a bundleLink
- // if (this.bundleLinks && !shouldBundle) delete this.bundleLinks[entry]
- return shouldBundle
+ if (!bd) return false
+ if (typeof bd === 'string') return minimatch(entry, bd)
+ return bd.indexOf(entry) !== -1
}
// if (this.bundled) return true
View
@@ -10,6 +10,7 @@
"main": "./fstream-npm.js",
"dependencies": {
"fstream-ignore": "~0.0.5",
+ "minimatch": "~0.2.4",
"inherits": ""
}
}

0 comments on commit f114c86

Please sign in to comment.