(pkgWithVersion: string, prefix: string)
| 111 | } |
| 112 | |
| 113 | private async wipeCacheAndRetry(pkgWithVersion: string, prefix: string): Promise<Runnable> { |
| 114 | // Wipe cache and retry if import fails |
| 115 | rmSync(prefix, { recursive: true }) |
| 116 | const modulePath = await this.installPackage(pkgWithVersion, prefix) |
| 117 | try { |
| 118 | return await import(modulePath) |
| 119 | } catch (e) { |
| 120 | throw new ImportError(e) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | private async installPackage(pkgWithVersion: string, prefix: string) { |
| 125 | const npmCachedModulePath = pathToFileURL(join(prefix, 'node_modules', this.pkg, 'dist', 'index.js')).toString() |
no test coverage detected