From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送
---
node_modules/webpack/lib/esm/ModuleChunkFormatPlugin.js | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/node_modules/webpack/lib/esm/ModuleChunkFormatPlugin.js b/node_modules/webpack/lib/esm/ModuleChunkFormatPlugin.js
index 4092e1c..04daf91 100644
--- a/node_modules/webpack/lib/esm/ModuleChunkFormatPlugin.js
+++ b/node_modules/webpack/lib/esm/ModuleChunkFormatPlugin.js
@@ -7,6 +7,7 @@
const { ConcatSource } = require("webpack-sources");
const { HotUpdateChunk, RuntimeGlobals } = require("..");
+const { JAVASCRIPT_TYPE } = require("../ModuleSourceTypeConstants");
const Template = require("../Template");
const {
createChunkHashHandler,
@@ -28,6 +29,7 @@
/** @typedef {import("../Entrypoint")} Entrypoint */
/**
+ * Gets relative path.
* @param {Compilation} compilation the compilation instance
* @param {Chunk} chunk the chunk
* @param {Chunk} runtimeChunk the runtime chunk
@@ -68,6 +70,7 @@
};
/**
+ * Renders chunk import.
* @param {Compilation} compilation the compilation instance
* @param {Chunk} chunk the chunk to render the import for
* @param {string=} namedImport the named import to use for the import
@@ -81,6 +84,7 @@
}
/**
+ * Gets chunk named import.
* @param {number} index the index of the chunk
* @returns {string} the named import to use for the import
*/
@@ -92,7 +96,7 @@
class ModuleChunkFormatPlugin {
/**
- * Apply the plugin
+ * Applies the plugin by registering its hooks on the compiler.
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
@@ -110,10 +114,11 @@
);
const hooks = getCompilationHooks(compilation);
/**
- * @param {Set<Chunk>} chunks the chunks to render
+ * With dependent chunks.
+ * @param {Iterable<Chunk>} chunks the chunks to render
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {Chunk=} runtimeChunk the runtime chunk
- * @returns {Source|undefined} the source
+ * @returns {Source | undefined} the source
*/
const withDependentChunks = (chunks, chunkGraph, runtimeChunk) => {
if (/** @type {Set<Chunk>} */ (chunks).size > 0) {
@@ -153,7 +158,7 @@
const entryDependentChunks =
chunkGraph.getChunkEntryDependentChunksIterable(chunk);
const sourceWithDependentChunks = withDependentChunks(
- /** @type {Set<Chunk>} */ (entryDependentChunks),
+ entryDependentChunks,
chunkGraph,
chunk
);
@@ -211,10 +216,11 @@
)}\n`
);
+ /** @type {Set<Chunk>} */
const loadedChunks = new Set();
for (let i = 0; i < entries.length; i++) {
const [module, entrypoint] = entries[i];
- if (!chunkGraph.getModuleSourceTypes(module).has("javascript")) {
+ if (!chunkGraph.getModuleSourceTypes(module).has(JAVASCRIPT_TYPE)) {
continue;
}
const final = i + 1 === entries.length;
@@ -224,13 +230,14 @@
/** @type {Chunk} */ (runtimeChunk),
undefined
);
+ /** @type {Set<Chunk>} */
const processChunks = new Set();
- for (const _chunk of chunks) {
- if (loadedChunks.has(_chunk)) {
+ for (const chunk of chunks) {
+ if (loadedChunks.has(chunk)) {
continue;
}
- loadedChunks.add(_chunk);
- processChunks.add(_chunk);
+ loadedChunks.add(chunk);
+ processChunks.add(chunk);
}
const sourceWithDependentChunks = withDependentChunks(
processChunks,
@@ -252,10 +259,7 @@
hooks.renderStartup.call(
startupSource,
entries[entries.length - 1][0],
- {
- ...renderContext,
- inlined: false
- }
+ renderContext
)
);
return entrySource;
--
Gitblit v1.9.3