helpers.js 824 B

123456789101112131415161718192021222324252627
  1. function nodeWrapper() {
  2. return {
  3. start: "var globalThis = typeof globalThis === \"undefined\" ? global : globalThis || global;\n" +
  4. "(function(define, require){\n" +
  5. "define(function (requirejs) {\n" +
  6. "var module = void 0; // Bad UMDs workaround\n" +
  7. "requirejs.resolve = require.resolve;\n" +
  8. "require = requirejs;\n",
  9. end: "});\n" +
  10. "}((" +
  11. require("@ambers/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. };