function transformAst(ast, { elideComments = false } = {}) {
  const transformComment = elideComments ? elideComment : evadeComment;
  traverse(ast, {
    enter(p) {
      const { leadingComments, innerComments, trailingComments, type } = p.node;
      // discriminated union
      if ('comments' in p.node) {
        (p.node.comments || []).forEach(node => transformComment(node));
      }
      // Rewrite all comments.
      (leadingComments || []).forEach(node => transformComment(node));
      // XXX: there is no such Node having type matching /^Comment.+/ in
      // @babel/types
      if (type.startsWith('Comment')) {
        // @ts-expect-error - see above XXX
        transformComment(p.node);
      }
      (innerComments || []).forEach(node => transformComment(node));
      (trailingComments || []).forEach(node => transformComment(node));
    },
  });
}
Performs transformations on the given AST

This function mutates `ast`.

@internal
@param {import('@babel/types').File} ast - AST, as generated by Babel
@param {TransformAstOptions} [opts]
@returns {void}