class Importmap::Packager

def import(*packages, env: "production", from: "jspm")

def import(*packages, env: "production", from: "jspm")
  response = post_json({
    "install"      => Array(packages), 
    "flattenScope" => true,
    "env"          => [ "browser", "module", env ],
    "provider"     => from.to_s,
  })
  case response.code
  when "200"        then extract_parsed_imports(response)
  when "404", "401" then nil
  else                   handle_failure_response(response)
  end
end