WXL
3 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/CssModule.js
@@ -13,6 +13,7 @@
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("../declarations/WebpackOptions").CssParserExportType} CssParserExportType */
/** @typedef {string | undefined} CssLayer */
/** @typedef {string | undefined} Supports */
@@ -20,10 +21,11 @@
/** @typedef {[CssLayer, Supports, Media]} InheritanceItem */
/** @typedef {InheritanceItem[]} Inheritance */
/** @typedef {NormalModuleCreateData & { cssLayer: CssLayer, supports: Supports, media: Media, inheritance?: Inheritance }} CSSModuleCreateData */
/** @typedef {NormalModuleCreateData & { cssLayer: CssLayer, supports: Supports, media: Media, inheritance?: Inheritance, exportType?: CssParserExportType }} CSSModuleCreateData */
class CssModule extends NormalModule {
   /**
    * Creates an instance of CssModule.
    * @param {CSSModuleCreateData} options options object
    */
   constructor(options) {
@@ -38,9 +40,12 @@
      this.media = options.media;
      /** @type {CSSModuleCreateData['inheritance']} */
      this.inheritance = options.inheritance;
      /** @type {CSSModuleCreateData['exportType']} */
      this.exportType = options.exportType;
   }
   /**
    * Returns the unique identifier used to reference this module.
    * @returns {string} a unique identifier of the module
    */
   identifier() {
@@ -69,6 +74,10 @@
         identifier += `|${inheritance.join("|")}`;
      }
      if (this.exportType) {
         identifier += `|${this.exportType}`;
      }
      // We generate extra code for HMR, so we need to invalidate the module
      if (this.hot) {
         identifier += `|${this.hot}`;
@@ -78,6 +87,7 @@
   }
   /**
    * Returns a human-readable identifier for this module.
    * @param {RequestShortener} requestShortener the request shortener
    * @returns {string} a user readable identifier of the module
    */
@@ -98,6 +108,10 @@
         identifier += ` (media: ${this.media})`;
      }
      if (this.exportType) {
         identifier += ` (exportType: ${this.exportType})`;
      }
      return identifier;
   }
@@ -115,9 +129,11 @@
      this.supports = m.supports;
      this.media = m.media;
      this.inheritance = m.inheritance;
      this.exportType = m.exportType;
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize(context) {
@@ -126,10 +142,12 @@
      write(this.supports);
      write(this.media);
      write(this.inheritance);
      write(this.exportType);
      super.serialize(context);
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    * @returns {CssModule} the deserialized object
    */
@@ -155,13 +173,15 @@
         supports: /** @type {EXPECTED_ANY} */ (null),
         media: /** @type {EXPECTED_ANY} */ (null),
         inheritance: /** @type {EXPECTED_ANY} */ (null),
         extractSourceMap: /** @type {EXPECTED_ANY} */ (null)
         extractSourceMap: /** @type {EXPECTED_ANY} */ (null),
         exportType: /** @type {EXPECTED_ANY} */ (null)
      });
      obj.deserialize(context);
      return obj;
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize(context) {
@@ -170,6 +190,7 @@
      this.supports = read();
      this.media = read();
      this.inheritance = read();
      this.exportType = read();
      super.deserialize(context);
   }
}