hunk.code_window:   if (!pkg.bin) return
     const bins = binify(pkg)
     const binDir = path.join(modules, '.bin')
     await mkdirp(binDir)
     await Promise.all(Object.keys(bins).map(async function (bin) {
       const externalBinPath = path.join(binDir, bin)
       const actualBin = bins[bin]
  
hunk.labels: keep keep keep replace keep keep keep keep keep
hunk.file_path: src/install/linkBins.ts
hunk.type: replace
file: import path = require('path')
  import pnpmPkgJson from '../pnpmPkgJson'
  import {
    read as readYaml,
    write as writeYaml
  } from './yamlfs'
  import {PackageSpec, Resolution, TarballResolution, GitRepositoryResolution, DirectoryResolution} from '../resolve'
  
  const shrinkwrapFilename = 'shrinkwrap.yaml'
  
  export type Shrinkwrap = {
    [dependency: string]: Resolution
  }
  
  export function lookupResolution(shrinkwrap: Shrinkwrap, dependency: string): Resolution | null {
    let item = shrinkwrap[dependency]
    if (item) {
      item = item as any as TarballResolution // tslint:disable-line
      if (item.tarball != null) {
        return Object.assign({}, item, {type: 'tarball'}) as Resolution
      }
      item = item as any as GitRepositoryResolution // tslint:disable-line
      if (item.repo != null && item.commitId != null) {
        return Object.assign({}, item, {type: 'git-repo'}) as Resolution
      }
      item = item as any as DirectoryResolution // tslint:disable-line
      if (item.root != null) {
        return Object.assign({}, item, {type: 'directory'}) as Resolution
      }
    }
    return null
  }
  
  export function putResolution(shrinkwrap: Shrinkwrap, dependency: string, resolution: Resolution) {
    shrinkwrap[dependency] = Object.assign({}, resolution)
    delete shrinkwrap[dependency].type
  }
  
  export async function read (pkgPath: string): Promise<Shrinkwrap | null> {
    const shrinkwrapPath = path.join(pkgPath, shrinkwrapFilename)
    try {
      return await readYaml<Shrinkwrap>(shrinkwrapPath)
    } catch (err) {
      if ((<NodeJS.ErrnoException>err).code !== 'ENOENT') {
        throw err
      }
      return null
    }
  }
  
  export function save (pkgPath: string, shrinkwrap: Shrinkwrap) {
    const shrinkwrapPath = path.join(pkgPath, shrinkwrapFilename)
    return writeYaml(shrinkwrapPath, shrinkwrap)
  }
  