function wrappedResolveSync(resolve, depName, basedir) {
  const depRelativePackageJsonPath = path.join(depName, 'package.json')
  try {
    return resolve.sync(depRelativePackageJsonPath, {
      basedir,
    })
  } catch (e) {
    const err = /** @type {Error} */ (e)
    if (
      err &&
      typeof err === 'object' &&
      (('code' in err && err.code === 'MODULE_NOT_FOUND') ||
        err.message?.startsWith('Cannot find module'))
    ) {
      return
    }
    throw err
  }
}
Resolves `package.json` of a dependency relative to `basedir`

@param {Resolver} resolve - Resolver function
@param {string} depName - Dependency name
@param {string} basedir - Dir to resolve from
@returns {string | undefined}