async function addPreset(name) {
  /** @type {{default: Preset}} */
  const presetModule = await import(
    new URL(name + '/index.js', packagesUrl).href
  )
  const plugins = presetModule.default.plugins
  assert(plugins, 'expected plugins in preset')
  /** @type {PresetInfo} */
  const presetInfo = {name, plugins: []}

  let index = -1

  while (++index < plugins.length) {
    const plugin = plugins[index]
    /** @type {Plugin<[unknown]>} */
    let pluginFunction
    /** @type {unknown} */
    let option

    if (Array.isArray(plugin)) {
      ;[pluginFunction, option] = /** @type {PluginTuple<[unknown]>} */ (plugin)
    } else {
      assert(typeof plugin === 'function')
      pluginFunction = plugin
    }

    const name = /** @type {string} */ (
      // @ts-expect-error: `displayName`s are fine.
      pluginFunction.displayName || pluginFunction.name
    )

    const pluginName = name
      .replace(
        /[:-](\w)/g,
        function (/** @type {string} */ _, /** @type {string} */ $1) {
          return $1.toUpperCase()
        }
      )
      .replace(/[A-Z]/g, function (/** @type {string} */ $0) {
        return '-' + $0.toLowerCase()
      })

    presetInfo.plugins.push([pluginName, option])
  }

  presets.push(presetInfo)
}
@param {string} name
  Preset name.
@returns {Promise<undefined>}
  Nothing.