CssDependency.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _webpack = _interopRequireDefault(require("webpack"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. class CssDependency extends _webpack.default.Dependency {
  9. constructor({
  10. identifier,
  11. content,
  12. media,
  13. sourceMap
  14. }, context, identifierIndex) {
  15. super();
  16. this.identifier = identifier;
  17. this.identifierIndex = identifierIndex;
  18. this.content = content;
  19. this.media = media;
  20. this.sourceMap = sourceMap;
  21. this.context = context;
  22. }
  23. getResourceIdentifier() {
  24. return `css-module-${this.identifier}-${this.identifierIndex}`;
  25. }
  26. serialize(context) {
  27. const {
  28. write
  29. } = context;
  30. write(this.identifier);
  31. write(this.content);
  32. write(this.media);
  33. write(this.sourceMap);
  34. write(this.context);
  35. write(this.identifierIndex);
  36. super.serialize(context);
  37. }
  38. deserialize(context) {
  39. super.deserialize(context);
  40. }
  41. }
  42. if (_webpack.default.util && _webpack.default.util.serialization) {
  43. _webpack.default.util.serialization.register(CssDependency, 'mini-css-extract-plugin/dist/CssDependency', null, {
  44. serialize(instance, context) {
  45. instance.serialize(context);
  46. },
  47. deserialize(context) {
  48. const {
  49. read
  50. } = context;
  51. const dep = new CssDependency({
  52. identifier: read(),
  53. content: read(),
  54. media: read(),
  55. sourceMap: read()
  56. }, read(), read());
  57. dep.deserialize(context);
  58. return dep;
  59. }
  60. });
  61. }
  62. var _default = CssDependency;
  63. exports.default = _default;