Browse Source

devkit: fix shebang, add shebangless wrapping

Herbert Vojčík 9 years ago
parent
commit
80f3a2ed5b
1 changed files with 9 additions and 2 deletions
  1. 9 2
      external/amber-dev/lib/helpers.js

+ 9 - 2
external/amber-dev/lib/helpers.js

@@ -1,11 +1,18 @@
 exports.libPath = __dirname;
 
+exports.nodeShebang = "#!/usr/bin/env node";
+
 exports.nodeWrap = function (id) {
+    var wrap = exports.nodeWrapWithoutShebang(id);
+    wrap.start = exports.nodeShebang + "\n" + wrap.start;
+    return wrap;
+};
+
+exports.nodeWrapWithoutShebang = function (id) {
     var wrapSource = JSON.stringify('_wrap_' + id),
         idSource = JSON.stringify(id);
     return {
-        start: "#!/usr/bin/env/node\n" +
-        "(function(define){\n" +
+        start: "(function(define){\n" +
         "define(" + wrapSource + ", function (require) {\n",
         end: "require(" + idSource + ");\n" +
         "});\n" +