Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

RequireEnsureDependenciesBlock.js 864B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
  7. const RequireEnsureDependency = require("./RequireEnsureDependency");
  8. module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
  9. constructor(
  10. expr,
  11. successExpression,
  12. errorExpression,
  13. chunkName,
  14. chunkNameRange,
  15. module,
  16. loc
  17. ) {
  18. super(chunkName, module, loc, null);
  19. this.expr = expr;
  20. const successBodyRange =
  21. successExpression &&
  22. successExpression.body &&
  23. successExpression.body.range;
  24. if (successBodyRange) {
  25. this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
  26. }
  27. this.chunkNameRange = chunkNameRange;
  28. const dep = new RequireEnsureDependency(this);
  29. dep.loc = loc;
  30. this.addDependency(dep);
  31. }
  32. };