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

@@ -144,6 +144,7 @@ class APIPlugin {
constructor(options = {}) {
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
@@ -213,7 +214,7 @@ class APIPlugin {
* @param {JavascriptParser} parser the parser
*/
const handler = parser => {
Object.keys(REPLACEMENTS).forEach(key => {
for (const key of Object.keys(REPLACEMENTS)) {
const info = REPLACEMENTS[key];
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expression => {
const dep = toConstantDependency(parser, info.expr, info.req);
@@ -237,7 +238,7 @@ class APIPlugin {
.for(key)
.tap(PLUGIN_NAME, evaluateToString(info.type));
}
});
}
parser.hooks.expression
.for("__webpack_layer__")
@@ -277,7 +278,7 @@ class APIPlugin {
(parser.state.module.buildInfo).moduleConcatenationBailout =
"__webpack_module__.id";
const dep = new ConstDependency(
parser.state.module.moduleArgument + ".id",
`${parser.state.module.moduleArgument}.id`,
/** @type {Range} */ (expr.range),
[RuntimeGlobals.moduleId]
);