LocalModule.js 743 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const makeSerializable = require("../util/makeSerializable");
  7. class LocalModule {
  8. constructor(name, idx) {
  9. this.name = name;
  10. this.idx = idx;
  11. this.used = false;
  12. }
  13. flagUsed() {
  14. this.used = true;
  15. }
  16. variableName() {
  17. return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__";
  18. }
  19. serialize(context) {
  20. const { write } = context;
  21. write(this.name);
  22. write(this.idx);
  23. write(this.used);
  24. }
  25. deserialize(context) {
  26. const { read } = context;
  27. this.name = read();
  28. this.idx = read();
  29. this.used = read();
  30. }
  31. }
  32. makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule");
  33. module.exports = LocalModule;