You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
800 B

4 years ago
  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, runtime) {
  18. const usedExports = dep.originModule.usedExports;
  19. if (usedExports !== false && !Array.isArray(usedExports)) {
  20. const content = runtime.defineEsModuleFlagStatement({
  21. exportsArgument: dep.originModule.exportsArgument
  22. });
  23. source.insert(-10, content);
  24. }
  25. }
  26. };
  27. module.exports = HarmonyCompatibilityDependency;