code: protected function getPackageBasePath(PackageInterface $package)
      {
          $installPath = $this->getInstallPath($package);
          $targetDir = $package->getTargetDir();
  
          if ($targetDir) {
              return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
          }
  
          return $installPath;
      }
docs: Returns the base path of the package without target-dir path
  
  It is used for BC as getInstallPath tends to be overridden by
  installer plugins but not getPackageBasePath
  
  @param  PackageInterface $package
  @return string