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

@@ -18,11 +18,34 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
})) {
return spread.argument;
} else {
return scope.toArray(spread.argument, true, arrayLikeIsIterable);
const node = spread.argument;
if (_core.types.isIdentifier(node)) {
const binding = scope.getBinding(node.name);
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
return node;
}
}
if (_core.types.isArrayExpression(node)) {
return node;
}
if (_core.types.isIdentifier(node, {
name: "arguments"
})) {
return _core.template.expression.ast`
Array.prototype.slice.call(${node})
`;
}
const args = [node];
let helperName = "toConsumableArray";
if (arrayLikeIsIterable) {
args.unshift(scope.path.hub.addHelper(helperName));
helperName = "maybeArrayLike";
}
return _core.types.callExpression(scope.path.hub.addHelper(helperName), args);
}
}
function hasHole(spread) {
return spread.elements.some(el => el === null);
return spread.elements.includes(null);
}
function hasSpread(nodes) {
for (let i = 0; i < nodes.length; i++) {

File diff suppressed because one or more lines are too long