2
0

helpers.js 712 B

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