feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -16,6 +16,7 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */
/** @typedef {import("../util/Hash")} Hash */
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
@@ -46,9 +47,7 @@ class ModernModuleLibraryPlugin extends AbstractLibraryPlugin {
compiler.hooks.compilation.tap("ModernModuleLibraryPlugin", compilation => {
const { exportsDefinitions } =
ConcatenatedModule.getCompilationHooks(compilation);
exportsDefinitions.tap("ModernModuleLibraryPlugin", () => {
return true;
});
exportsDefinitions.tap("ModernModuleLibraryPlugin", () => true);
});
}
@@ -73,8 +72,9 @@ class ModernModuleLibraryPlugin extends AbstractLibraryPlugin {
`Library name must be unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}`
);
}
const _name = /** @type {string} */ (name);
return {
name: /** @type {string} */ (name)
name: _name
};
}
@@ -93,7 +93,9 @@ class ModernModuleLibraryPlugin extends AbstractLibraryPlugin {
) {
const result = new ConcatSource(source);
const exportsInfo = moduleGraph.getExportsInfo(module);
const definitions = module.buildMeta.exportsFinalName;
const definitions =
/** @type {BuildMeta} */
(module.buildMeta).exportsFinalName;
const exports = [];
for (const exportInfo of exportsInfo.orderedExports) {
@@ -106,7 +108,7 @@ class ModernModuleLibraryPlugin extends AbstractLibraryPlugin {
for (const reexportInfo of exp.orderedExports) {
if (
!reexportInfo.provided &&
reexportInfo.name === reexport.export[0]
reexportInfo.name === /** @type {string[]} */ (reexport.export)[0]
) {
shouldContinue = true;
}