You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: package_manager.rb
    path of file: ./repos/dependabot-core/npm_and_yarn/lib/dependabot/npm_and_yarn
    
    the code of the file until where you have to start completion: # typed: true
# frozen_string_literal: true

require "dependabot/shared_helpers"

module Dependabot
  module NpmAndYarn
    class PackageManager
      def initialize(package_json, lockfiles:)
        @package_json = package_json
        @lockfiles = lock
    
      def setup(name)
        return unless @package_manager.nil? || @package_manager.start_with?("#{name}@")

        version = requested_version(name)

        if version
          raise_if_unsupported!(name, version)

          install(name, version)
        else
          version = guessed_version(name)

          if version
            raise_if_unsupported!(name, version.to_s)

            install(name, version) if name == "pnpm"
          end