hunk.code_window:   statsLogger.debug({ removed: 0, prefix: '/home/jane/repo/loooooooooooooooooooooooooooooooooong/pkg-3' })
     statsLogger.debug({ added: 1, prefix: '/home/jane/repo/loooooooooooooooooooooooooooooooooong/pkg-3' })
     statsLogger.debug({ removed: 1, prefix: '/home/jane/repo/loooooooooooooooooooooooooooooooooong-pkg-4' })
     statsLogger.debug({ added: 0, prefix: '/home/jane/repo/loooooooooooooooooooooooooooooooooong-pkg-4' })
     t.plan(1)
  
hunk.labels: keep keep keep add keep keep keep
hunk.after_edit:   deprecationLogger.debug({
       pkgName: 'foo',
       pkgVersion: '1.0.0',
       pkgId: 'registry.npmjs.org/foo/1.0.0',
       deprecated: 'This package was deprecated because bla bla bla',
       depth: 0,
       prefix: rootPrefix,
     })
  
hunk.file_path: packages/default-reporter/test/index.ts
hunk.type: add
file: import logger, {streamParser} from '@pnpm/logger'
  import {PackageJson} from '@pnpm/types'
  import {removeOrphanPackages as removeOrphanPkgs} from '@pnpm/utils'
  import {
    prune as pruneShrinkwrap,
  } from 'pnpm-shrinkwrap'
  import extendOptions, {
    PruneOptions,
  } from './extendPruneOptions'
  import getContext from './getContext'
  import {installPkgs} from './install'
  
  export async function prune (
    maybeOpts: PruneOptions,
  ): Promise<void> {
    const reporter = maybeOpts && maybeOpts.reporter
    if (reporter) {
      streamParser.on('data', reporter)
    }
  
    const opts = await extendOptions(maybeOpts)
  
    const ctx = await getContext(opts)
  
    if (!ctx.pkg) {
      throw new Error('No package.json found - cannot prune')
    }
  
    const pkg = {
      dependencies: opts.production ? ctx.pkg.dependencies : {},
      devDependencies: opts.development ? ctx.pkg.devDependencies : {},
      optionalDependencies: opts.optional ? ctx.pkg.optionalDependencies : {},
    } as PackageJson
  
    const warn = (message: string) => logger.warn({message, prefix: opts.prefix})
    const prunedShr = pruneShrinkwrap(ctx.wantedShrinkwrap, pkg, warn)
  
    await removeOrphanPkgs({
      bin: opts.bin,
      hoistedAliases: ctx.hoistedAliases,
      newShrinkwrap: prunedShr,
      oldShrinkwrap: ctx.currentShrinkwrap,
      prefix: ctx.prefix,
      pruneStore: true,
      shamefullyFlatten: opts.shamefullyFlatten,
      storeController: opts.storeController,
    })
  
    if (opts.shamefullyFlatten) {
      await installPkgs(prunedShr.specifiers, {...opts, lock: false, reinstallForFlatten: true, update: false})
    }
  
    if (reporter) {
      streamParser.removeListener('data', reporter)
    }
  }
  