WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/runtime/GetChunkFilenameRuntimeModule.js
@@ -13,6 +13,7 @@
/** @typedef {import("../Chunk").ChunkId} ChunkId */
/** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Compilation")} Compilation */
/** @typedef {import("../Compilation").HashWithLengthFunction} HashWithLengthFunction */
/** @typedef {import("../TemplatedPathPlugin").TemplatePath} TemplatePath */
class GetChunkFilenameRuntimeModule extends RuntimeModule {
@@ -25,14 +26,20 @@
    */
   constructor(contentType, name, global, getFilenameForChunk, allChunks) {
      super(`get ${name} chunk filename`);
      /** @type {string} */
      this.contentType = contentType;
      /** @type {string} */
      this.global = global;
      /** @type {(chunk: Chunk) => TemplatePath | false} */
      this.getFilenameForChunk = getFilenameForChunk;
      /** @type {boolean} */
      this.allChunks = allChunks;
      /** @type {boolean} */
      this.dependentHash = true;
   }
   /**
    * Generates runtime code for this runtime module.
    * @returns {string | null} runtime code
    */
   generate() {
@@ -138,7 +145,7 @@
         };
         /**
          * @param {string} value string
          * @returns {(length: number) => string} string to put in quotes with length
          * @returns {HashWithLengthFunction} string to put in quotes with length
          */
         const unquotedStringifyWithLength = (value) => (length) =>
            unquotedStringify(`${value}`.slice(0, length));
@@ -230,7 +237,7 @@
      /**
       * @param {(chunk: Chunk) => string | number} fn function from chunk to value
       * @returns {(length: number) => string} function which generates code with static mapping of results of fn for including in quoted string for specific length
       * @returns {HashWithLengthFunction} function which generates code with static mapping of results of fn for including in quoted string for specific length
       */
      const mapExprWithLength = (fn) => (length) =>
         `" + ${createMap((c) => `${fn(c)}`.slice(0, length))} + "`;