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.

ImportDependency.js 801B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const ModuleDependency = require("./ModuleDependency");
  7. class ImportDependency extends ModuleDependency {
  8. constructor(request, originModule, block) {
  9. super(request);
  10. this.originModule = originModule;
  11. this.block = block;
  12. }
  13. get type() {
  14. return "import()";
  15. }
  16. }
  17. ImportDependency.Template = class ImportDependencyTemplate {
  18. apply(dep, source, runtime) {
  19. const content = runtime.moduleNamespacePromise({
  20. block: dep.block,
  21. module: dep.module,
  22. request: dep.request,
  23. strict: dep.originModule.buildMeta.strictHarmonyModule,
  24. message: "import()"
  25. });
  26. source.replace(dep.block.range[0], dep.block.range[1] - 1, content);
  27. }
  28. };
  29. module.exports = ImportDependency;