1
0

helpers.js 768 B

123456789101112131415161718192021222324252627
  1. function nodeWrapper() {
  2. return {
  3. start: "(function(define, require){\n" +
  4. "define('__wrap__', function (requirejs) {\n" +
  5. "var module = null; // Bad UMDs workaround\n" +
  6. "requirejs.resolve = require.resolve;\n" +
  7. "require = requirejs;\n",
  8. end: "});\n" +
  9. "define.require('__wrap__');\n" +
  10. "}((" +
  11. require("amdefine") +
  12. "(module)), require));"
  13. };
  14. }
  15. var SHEBANG = "#!/usr/bin/env node",
  16. WRAPPER = nodeWrapper(),
  17. WRAPPER_WITH_SHEBANG = nodeWrapper();
  18. WRAPPER_WITH_SHEBANG.start = SHEBANG + "\n" + WRAPPER_WITH_SHEBANG.start;
  19. module.exports = {
  20. libPath: __dirname,
  21. nodeShebang: SHEBANG,
  22. nodeWrapper: WRAPPER,
  23. nodeWrapperWithShebang: WRAPPER_WITH_SHEBANG
  24. };