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.

ImportEagerDependency.js 799B

1234567891011121314151617181920212223242526272829303132
  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 ImportEagerDependency extends ModuleDependency {
  8. constructor(request, originModule, range) {
  9. super(request);
  10. this.originModule = originModule;
  11. this.range = range;
  12. }
  13. get type() {
  14. return "import() eager";
  15. }
  16. }
  17. ImportEagerDependency.Template = class ImportEagerDependencyTemplate {
  18. apply(dep, source, runtime) {
  19. const content = runtime.moduleNamespacePromise({
  20. module: dep.module,
  21. request: dep.request,
  22. strict: dep.originModule.buildMeta.strictHarmonyModule,
  23. message: "import() eager"
  24. });
  25. source.replace(dep.range[0], dep.range[1] - 1, content);
  26. }
  27. };
  28. module.exports = ImportEagerDependency;