module Bootsnap::CompileCache::YAML::Psych4::SafeLoad

def input_to_output(data, kwargs)

def input_to_output(data, kwargs)
  ::YAML.load(data, **(kwargs || {}))
end

def input_to_storage(contents, _)

def input_to_storage(contents, _)
  obj = ::YAML.load(contents)
  packer = CompileCache::YAML.msgpack_factory.packer
  packer.pack(true) # safe loaded
  packer.pack(obj)
  packer.to_s
rescue NoMethodError, RangeError, Psych::DisallowedClass, Psych::BadAlias
  UNCOMPILABLE # The object included things that we can't serialize
end

def storage_to_output(data, kwargs)

def storage_to_output(data, kwargs)
  if kwargs&.key?(:symbolize_names)
    kwargs[:symbolize_keys] = kwargs.delete(:symbolize_names)
  end
  unpacker = CompileCache::YAML.msgpack_factory.unpacker(kwargs)
  unpacker.feed(data)
  safe_loaded = unpacker.unpack
  if safe_loaded
    unpacker.unpack
  else
    UNCOMPILABLE
  end
end