/** * Resolve the upstream `holesail` class for bare-holesail / managed tunnels. * * This follows the same pattern as `bare-openssh` / `bare-ssh2`: keep `holesail` * as a booter-owned dependency and import it directly so Pear stages the package. * Upstream is AGPL-3.0. */ import Holesail from 'holesail' /** ESM import so Pear stages `holesail` and its traced package deps. */ let holesailCache = null /** * @param {Record} ctx * @returns {Promise { ready: () => Promise, close: () => Promise, pause?: () => Promise, resume?: () => Promise, info?: unknown }>} */ export async function loadHolesailConstructor(ctx) { void ctx if (!holesailCache) { const Ho = Holesail && Holesail.default ? Holesail.default : Holesail if (typeof Ho !== 'function') { throw new Error('holesail: expected default export to be a constructor') } holesailCache = Ho } return holesailCache }