hunk.code_window:   } catch (err) {
       if (wantedDependency.optional) {
         skippedOptionalDependencyLogger.debug({
           details: err,
           package: {
             name: wantedDependency.alias,
             pref: wantedDependency.pref,
             version: wantedDependency.alias ? wantedDependency.pref : undefined,
  
hunk.labels: keep keep keep replace keep keep keep keep
hunk.after_edit:         details: err.toString(),
  
hunk.file_path: src/resolveDependencies.ts
hunk.type: replace
file: import {Resolution} from '@pnpm/resolver-base'
  import encodeRegistry = require('encode-registry')
  
  export function absolutePathToRef (
    absolutePath: string,
    opts: {
      alias: string,
      realName: string,
      resolution: Resolution,
      standardRegistry: string,
    },
  ) {
    if (opts.resolution.type) return absolutePath
  
    const registryName = encodeRegistry(opts.standardRegistry)
    if (absolutePath.startsWith(`${registryName}/`)) {
      if (opts.alias === opts.realName) {
        const ref = absolutePath.replace(`${registryName}/${opts.realName}/`, '')
        if (ref.indexOf('/') === -1) return ref
      }
      return absolutePath.replace(`${registryName}/`, '/')
    }
    return absolutePath
  }
  