@babel/plugin-transform-jscript
Version:
Babel plugin to fix buggy JScript named function expressions
24 lines (21 loc) • 644 B
JavaScript
import { declare } from '@babel/helper-plugin-utils';
import { types } from '@babel/core';
const index = declare(api => {
api.assertVersion("^7.0.0-0 || ^8.0.0");
return {
name: "transform-jscript",
visitor: {
FunctionExpression: {
exit(path) {
const {
node
} = path;
if (!node.id) return;
path.replaceWith(types.callExpression(types.functionExpression(null, [], types.blockStatement([types.toStatement(node), types.returnStatement(types.cloneNode(node.id))])), []));
}
}
}
};
});
export { index as default };
//# sourceMappingURL=index.js.map