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.

HarmonyImportSideEffectDependency.js 915B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const HarmonyImportDependency = require("./HarmonyImportDependency");
  7. class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
  8. constructor(request, originModule, sourceOrder, parserScope) {
  9. super(request, originModule, sourceOrder, parserScope);
  10. }
  11. getReference() {
  12. if (this._module && this._module.factoryMeta.sideEffectFree) return null;
  13. return super.getReference();
  14. }
  15. get type() {
  16. return "harmony side effect evaluation";
  17. }
  18. }
  19. HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends HarmonyImportDependency.Template {
  20. getHarmonyInitOrder(dep) {
  21. if (dep._module && dep._module.factoryMeta.sideEffectFree) return NaN;
  22. return super.getHarmonyInitOrder(dep);
  23. }
  24. };
  25. module.exports = HarmonyImportSideEffectDependency;