async function getReaddirReplacement(node, filepath) {
  assertEqualString(node.callee.type, 'MemberExpression');
  assertEqualString(node.callee.property.type, 'Identifier');
  assert.equal(node.callee.property.name, 'readdirSync');

  // If there's no second argument, fs.readdirSync defaults to 'utf8'.
  if (node.arguments.length === 2) {
    if (!isUtf8Options(node.arguments[1])) {
      throw new AstError('only utf8 readdirSync is supported', node.arguments[1]);
    }
  }

  const constructedPath = collapseToStringLiteral(node.arguments[0], filepath);

  try {
    const contents = await fs.promises.readdir(constructedPath, 'utf8');
    return JSON.stringify(contents);
  } catch (err) {
    throw new Error(`could not inline fs.readdirSync contents: ${err.message}`);
  }
}
Attempts to statically determine the target of a `fs.readdirSync()` call and
returns a JSON.stringified array with the contents of the target directory.
@param {SimpleCallExpression} node ESTree node for `fs.readdirSync` call.
@param {string} filepath The path of the file containing this node.
@return {Promise<string>}