pruneOfflineMirror(lockfile) {
    var _this10 = this;

    return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
      const mirror = _this10.config.getOfflineMirrorPath();
      if (!mirror) {
        return;
      }

      const requiredTarballs = new Set();
      for (const dependency in lockfile) {
        const resolved = lockfile[dependency].resolved;
        if (resolved) {
          const basename = path.basename(resolved.split('#')[0]);
          if (dependency[0] === '@' && basename[0] !== '@') {
            requiredTarballs.add(`${dependency.split('/')[0]}-${basename}`);
          }
          requiredTarballs.add(basename);
        }
      }

      const mirrorFiles = yield (_fs || _load_fs()).walk(mirror);
      for (var _iterator14 = mirrorFiles, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) {
        var _ref27;

        if (_isArray14) {
          if (_i14 >= _iterator14.length) break;
          _ref27 = _iterator14[_i14++];
        } else {
          _i14 = _iterator14.next();
          if (_i14.done) break;
          _ref27 = _i14.value;
        }

        const file = _ref27;

        const isTarball = path.extname(file.basename) === '.tgz';
        // if using experimental-pack-script-packages-in-mirror flag, don't unlink prebuilt packages
        const hasPrebuiltPackage = file.relative.startsWith('prebuilt/');
        if (isTarball && !hasPrebuiltPackage && !requiredTarballs.has(file.basename)) {
          yield (_fs || _load_fs()).unlink(file.absolute);
        }
      }
    })();
  }
Remove offline tarballs that are no longer required