hunk.code_window: #!/usr/bin/env node
   // NOTE: This should be done as soon as possible because the debug
   // package reads the env variable only once
   if (~process.argv.indexOf('--debug')) {
     process.env.DEBUG = 'pnpm:*'
     process.argv.push('--quiet')
   }
   import loudRejection = require('loud-rejection')
  
hunk.labels: keep keep keep keep keep replace keep keep keep
hunk.after_edit:   process.argv.push('--silent')
  
hunk.file_path: src/bin/pnpm.ts
hunk.type: replace
file: import path = require('path')
  import fs = require('fs')
  import {Package} from '../types'
  
  type PackagesCache = {
    [path: string]: Package
  }
  
  export type RequireJsonOptions = {
    ignoreCache: boolean
  }
  
  const cache: PackagesCache = {}
  
  /**
   * Works identically to require('/path/to/file.json'), but safer.
   */
  export default function requireJson (pkgJsonPath: string, opts?: RequireJsonOptions): Package {
    opts = opts || {ignoreCache: false}
    pkgJsonPath = path.resolve(pkgJsonPath)
    if (!opts.ignoreCache && cache[pkgJsonPath]) return cache[pkgJsonPath]
    cache[pkgJsonPath] = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'))
    return cache[pkgJsonPath]
  }
  