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.

RequireResolveHeaderDependency.js 722B

1234567891011121314151617181920212223242526
  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 RequireResolveHeaderDependency extends NullDependency {
  8. constructor(range) {
  9. super();
  10. if (!Array.isArray(range)) throw new Error("range must be valid");
  11. this.range = range;
  12. }
  13. }
  14. RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate {
  15. apply(dep, source) {
  16. source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
  17. }
  18. applyAsTemplateArgument(name, dep, source) {
  19. source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
  20. }
  21. };
  22. module.exports = RequireResolveHeaderDependency;