SystemRuntimeModule.js 705 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Florent Cailhol @ooflorent
  4. */
  5. "use strict";
  6. const RuntimeGlobals = require("../RuntimeGlobals");
  7. const RuntimeModule = require("../RuntimeModule");
  8. const Template = require("../Template");
  9. class SystemRuntimeModule extends RuntimeModule {
  10. constructor() {
  11. super("system");
  12. }
  13. /**
  14. * @returns {string | null} runtime code
  15. */
  16. generate() {
  17. return Template.asString([
  18. `${RuntimeGlobals.system} = {`,
  19. Template.indent([
  20. "import: function () {",
  21. Template.indent(
  22. "throw new Error('System.import cannot be used indirectly');"
  23. ),
  24. "}"
  25. ]),
  26. "};"
  27. ]);
  28. }
  29. }
  30. module.exports = SystemRuntimeModule;