UI for Zipcoin Blue

HarmonyCompatibilityDependency.js 824B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const NullDependency = require("./NullDependency");
  7. class HarmonyCompatibilityDependency extends NullDependency {
  8. constructor(originModule) {
  9. super();
  10. this.originModule = originModule;
  11. }
  12. get type() {
  13. return "harmony export header";
  14. }
  15. }
  16. HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate {
  17. apply(dep, source) {
  18. const usedExports = dep.originModule.usedExports;
  19. if(usedExports && !Array.isArray(usedExports)) {
  20. const exportName = dep.originModule.exportsArgument || "exports";
  21. const content = `Object.defineProperty(${exportName}, "__esModule", { value: true });\n`;
  22. source.insert(-10, content);
  23. }
  24. }
  25. };
  26. module.exports = HarmonyCompatibilityDependency;