(cachePath, basePath, bundleCache)
| 73 | }; |
| 74 | |
| 75 | const saveCache = async (cachePath, basePath, bundleCache) => { |
| 76 | if (!isDisableCache) { |
| 77 | cache = bundleCache; |
| 78 | } |
| 79 | await new Promise((resolve, reject) => { |
| 80 | let str = JSON.stringify(bundleCache); |
| 81 | // Make cache location agnostic by stripping current basePath |
| 82 | str = str.replace(new RegExp(escapeRegExp(basePath), 'g'), '%%basePath%%'); |
| 83 | deflate(str, { level: constants.Z_BEST_SPEED }, (err, buffer) => { |
| 84 | if (err) { |
| 85 | console.error('An error occurred saving rollup cache:', err); |
| 86 | process.exitCode = 1; |
| 87 | reject(err); |
| 88 | return; |
| 89 | } |
| 90 | fs.writeFileSync(cachePath, buffer); |
| 91 | resolve(); |
| 92 | }); |
| 93 | }); |
| 94 | }; |
| 95 | |
| 96 | const logPrettyError = (err, cachePath, basePath) => { |
| 97 | let hasOutput = false; |
no test coverage detected