generate = (ast, options) => {
  // TODO Use options?.sourceUrl when resolved:
  // https://github.com/Agoric/agoric-sdk/issues/8671
  const sourceUrl = options ? options.sourceUrl : undefined;
  const inputSourceMap =
    options && 'sourceMap' in options ? options.sourceMap : undefined;
  const source = options ? options.source : undefined;
  const result = generator(
    ast,
    {
      sourceFileName: sourceUrl,
      sourceMaps: Boolean(sourceUrl),
      // @ts-expect-error Property missing on versioned types
      inputSourceMap,
      retainLines: true,
      ...(source === undefined ? {} : { experimental_preserveFormat: true }),
    },
    source,
  );

  if (sourceUrl) {
    return {
      code: result.code,
      map: result.map,
    };
  }
  return {
    code: result.code,
  };
}
Generates new code from a Babel AST; returns code only

@param {import('@babel/types').File} ast - Babel "File" AST
@param {GenerateAstOptions} [options] - Options for the transform
@internal