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

@@ -12,15 +12,19 @@ const WebpackError = require("./WebpackError");
/** @typedef {import("./DefinePlugin").CodeValue} CodeValue */
class EnvironmentPlugin {
/**
* @param {(string | string[] | Record<string, any>)[]} keys keys
*/
constructor(...keys) {
if (keys.length === 1 && Array.isArray(keys[0])) {
/** @type {string[]} */
this.keys = keys[0];
this.defaultValues = {};
} else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") {
this.keys = Object.keys(keys[0]);
this.defaultValues = keys[0];
this.defaultValues = /** @type {Record<string, any>} */ (keys[0]);
} else {
this.keys = keys;
this.keys = /** @type {string[]} */ (keys);
this.defaultValues = {};
}
}