astro-ghostcms/.pnpm-store/v3/files/b1/5ed463b08e22f029a59eabe10ac...

16 lines
532 B
Plaintext

import { t, visit } from "./babel.js";
function wrapDefaultExport(ast, functionIdentifier) {
visit(ast, {
ExportDefaultDeclaration(path) {
if (!t.isExpression(path.node.declaration))
return;
if (t.isCallExpression(path.node.declaration) && t.isIdentifier(path.node.declaration.callee) && path.node.declaration.callee.name === functionIdentifier.name)
return;
path.node.declaration = t.callExpression(functionIdentifier, [path.node.declaration]);
}
});
}
export {
wrapDefaultExport
};