module Kernel

def require(path)

@sig (String) -> true | false
def require(path)
  if loader = Zeitwerk::Registry.loader_for(path)
    if path.end_with?(".rb")
      required = zeitwerk_original_require(path)
      loader.__on_file_autoloaded(path) if required
      required
    else
      loader.__on_dir_autoloaded(path)
      true
    end
  else
    required = zeitwerk_original_require(path)
    if required
      abspath = $LOADED_FEATURES.last
      if loader = Zeitwerk::Registry.loader_for(abspath)
        loader.__on_file_autoloaded(abspath)
      end
    end
    required
  end
end