WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/InitFragment.js
@@ -16,6 +16,7 @@
/** @typedef {string} InitFragmentKey */
/**
 * Defines the maybe mergeable init fragment type used by this module.
 * @template GenerateContext
 * @typedef {object} MaybeMergeableInitFragment
 * @property {InitFragmentKey=} key
@@ -28,6 +29,7 @@
 */
/**
 * Extract fragment index.
 * @template T
 * @param {T} fragment the init fragment
 * @param {number} index index
@@ -36,6 +38,7 @@
const extractFragmentIndex = (fragment, index) => [fragment, index];
/**
 * Sorts fragment with index.
 * @template T
 * @param {[MaybeMergeableInitFragment<T>, number]} a first pair
 * @param {[MaybeMergeableInitFragment<T>, number]} b second pair
@@ -50,11 +53,13 @@
};
/**
 * Represents InitFragment.
 * @template GenerateContext
 * @implements {MaybeMergeableInitFragment<GenerateContext>}
 */
class InitFragment {
   /**
    * Creates an instance of InitFragment.
    * @param {string | Source | undefined} content the source code that will be included as initialization code
    * @param {number} stage category of initialization code (contribute to order)
    * @param {number} position position in the category (contribute to order)
@@ -70,6 +75,7 @@
   }
   /**
    * Returns the source code that will be included as initialization code.
    * @param {GenerateContext} context context
    * @returns {string | Source | undefined} the source code that will be included as initialization code
    */
@@ -78,6 +84,7 @@
   }
   /**
    * Returns the source code that will be included at the end of the module.
    * @param {GenerateContext} context context
    * @returns {string | Source | undefined} the source code that will be included at the end of the module
    */
@@ -86,6 +93,7 @@
   }
   /**
    * Adds the provided source to the init fragment.
    * @template Context
    * @param {Source} source sources
    * @param {MaybeMergeableInitFragment<Context>[]} initFragments init fragments
@@ -133,6 +141,7 @@
         }
         const concatSource = new ConcatSource();
         /** @type {(string | Source)[]} */
         const endContents = [];
         for (let fragment of keyedFragments.values()) {
            if (Array.isArray(fragment)) {
@@ -164,6 +173,7 @@
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize(context) {
@@ -177,6 +187,7 @@
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize(context) {