# typed: true

# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `require-hooks` gem.
# Please instead update this file by running `bin/tapioca gem require-hooks`.


# source://require-hooks//lib/require-hooks/api.rb#3
module RequireHooks
  class << self
    # Define a block to wrap the code loading.
    # The return value MUST be a result of calling the passed block.
    # For example, you can use such hooks for instrumentation, debugging purposes.
    #
    #    RequireHooks.around_load do |path, &block|
    #      puts "Loading #{path}"
    #      block.call.tap { puts "Loaded #{path}" }
    #    end
    #
    # source://require-hooks//lib/require-hooks/api.rb#71
    def around_load(patterns: T.unsafe(nil), exclude_patterns: T.unsafe(nil), &block); end

    # source://require-hooks//lib/require-hooks/api.rb#107
    def context_for(path); end

    # This hook should be used to manually compile byte code to be loaded by the VM.
    # The arguments are (path, source = nil), where source is only defined if transformations took place.
    # Otherwise, you MUST read the source code from the file yourself.
    #
    # The return value MUST be either nil (continue to the next hook or default behavior) or a platform-specific bytecode object (e.g., RubyVM::InstructionSequence).
    #
    #   RequireHooks.hijack_load do |path, source|
    #     source ||= File.read(path)
    #     if defined?(RubyVM::InstructionSequence)
    #       RubyVM::InstructionSequence.compile(source)
    #     elsif defined?(JRUBY_VERSION)
    #       JRuby.compile(source)
    #     end
    #   end
    #
    # source://require-hooks//lib/require-hooks/api.rb#103
    def hijack_load(patterns: T.unsafe(nil), exclude_patterns: T.unsafe(nil), &block); end

    # Returns the value of attribute print_warnings.
    #
    # source://require-hooks//lib/require-hooks/api.rb#61
    def print_warnings; end

    # Sets the attribute print_warnings
    #
    # @param value the value to set the attribute print_warnings to.
    #
    # source://require-hooks//lib/require-hooks/api.rb#61
    def print_warnings=(_arg0); end

    # Define hooks to perform source-to-source transformations.
    # The return value MUST be either String (new source code) or nil (indicating that no transformations were performed).
    #
    # NOTE: The second argument (`source`) MAY be nil, indicating that no transformer tried to transform the source code.
    #
    #
    #    RequireHooks.source_transform do |path, source|
    #    end
    #
    # source://require-hooks//lib/require-hooks/api.rb#85
    def source_transform(patterns: T.unsafe(nil), exclude_patterns: T.unsafe(nil), &block); end
  end
end

# source://require-hooks//lib/require-hooks/api.rb#8
class RequireHooks::Context
  # @return [Context] a new instance of Context
  #
  # source://require-hooks//lib/require-hooks/api.rb#9
  def initialize(around_load, source_transform, hijack_load); end

  # @return [Boolean]
  #
  # source://require-hooks//lib/require-hooks/api.rb#15
  def empty?; end

  # @return [Boolean]
  #
  # source://require-hooks//lib/require-hooks/api.rb#23
  def hijack?; end

  # source://require-hooks//lib/require-hooks/api.rb#37
  def perform_source_transform(path); end

  # source://require-hooks//lib/require-hooks/api.rb#27
  def run_around_load_callbacks(path); end

  # @return [Boolean]
  #
  # source://require-hooks//lib/require-hooks/api.rb#19
  def source_transform?; end

  # source://require-hooks//lib/require-hooks/api.rb#49
  def try_hijack_load(path, source); end
end

# source://require-hooks//lib/require-hooks/mode/load_iseq.rb#4
module RequireHooks::LoadIseq
  # source://require-hooks//lib/require-hooks/mode/load_iseq.rb#5
  def load_iseq(path); end
end

# source://require-hooks//lib/require-hooks/version.rb#4
RequireHooks::VERSION = T.let(T.unsafe(nil), String)

class RubyVM::InstructionSequence
  extend ::RequireHooks::LoadIseq
end
