import { Effects, ExpectedExports } from "../types" import { Utils, utils } from "../util/utils" export type UninstallFn = (opts: { effects: Effects utils: Utils }) => Promise export class Uninstall { private constructor(readonly fn: UninstallFn) {} static of(fn: UninstallFn) { return new Uninstall(fn) } async uninit({ effects, nextVersion, }: Parameters[0]) { if (!nextVersion) await this.fn({ effects, utils: utils(effects), }) } } export function setupUninstall(fn: UninstallFn) { return Uninstall.of(fn) }