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

@@ -207,21 +207,13 @@ class ConstPlugin {
// NOTE: When code runs in strict mode, `var` declarations
// are hoisted but `function` declarations don't.
//
let declarations;
if (parser.scope.isStrict) {
// If the code runs in strict mode, variable declarations
// using `var` must be hoisted.
declarations = getHoistedDeclarations(branchToRemove, false);
} else {
// Otherwise, collect all hoisted declaration.
declarations = getHoistedDeclarations(branchToRemove, true);
}
let replacement;
if (declarations.length > 0) {
replacement = `{ var ${declarations.join(", ")}; }`;
} else {
replacement = "{}";
}
const declarations = parser.scope.isStrict
? getHoistedDeclarations(branchToRemove, false)
: getHoistedDeclarations(branchToRemove, true);
const replacement =
declarations.length > 0
? `{ var ${declarations.join(", ")}; }`
: "{}";
const dep = new ConstDependency(
replacement,
/** @type {Range} */ (branchToRemove.range)