From 7a25c2bfd9db656918ff8b86d08307a2eac1fea8 Mon Sep 17 00:00:00 2001 From: Christopher Karper Date: Sun, 15 Feb 2015 15:02:58 -0500 Subject: [PATCH] This handles embedding 'bin' scripts with shebang interpreter directives at the start --- lib/bundle.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bundle.js b/lib/bundle.js index b45a885..476b9b8 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -96,6 +96,10 @@ function bundle (input, complete) { //this is the result of require("someFile.json"), so we need to export it from the function req += "module.exports = " } + if ((/^\#\!/).test(dep.source)) { + dep.source = '//' + dep.source; + } + req += dep.source + "}"; dbuffer.push(JSON.stringify(dep.id) + ": ["+req+", "+!!dep.entry+", "+JSON.stringify(dep.deps)+"]")