PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` /** * @typedef {object} DependencyObject * @property {string} package * @property {(name: string) => boolean} [check] */ /** * @typedef {string | DependencyObject} Dependency */ exports.PackageDependency = class PackageDependency { /** @type {string} */ package; /** @type {string} */ name; /** @type {(name: string) => boolean | Promise} */ checkFn; /** * * @param {Dependency} dep */ static from(dep) { const depObj = typeof dep === 'string' ? { package: dep } : dep; return new PackageDependency(depObj.package, depObj.check); } /** * * @param {string} pkg * @param {(name: string) => boolean} [checkFn] */ constructor(pkg, checkFn) { this.package = pkg; this.name = pkg.replace(/(?!^@)@.+$/, ''); this.checkFn = checkFn || (() => true); } async needsInstallation() { return !(await this.isInstalled()) || !(await this.isValid()); } async isInstalled() { try { require.resolve(this.name); return true; } catch (e) { return false; } } async isValid() { return this.checkFn(this.name); } };