Merge pull request #12638 from Homebrew/dependabot/bundler/Library/Homebrew/zeitwerk-2.5.2

build(deps): bump zeitwerk from 2.5.1 to 2.5.2 in /Library/Homebrew
This commit is contained in:
Bo Anderson 2021-12-27 19:53:28 +00:00 committed by GitHub
commit 57c42b5d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 24 additions and 26 deletions

View File

@ -195,7 +195,7 @@ GEM
yard-sorbet (0.6.1) yard-sorbet (0.6.1)
sorbet-runtime (>= 0.5) sorbet-runtime (>= 0.5)
yard (>= 0.9) yard (>= 0.9)
zeitwerk (2.5.1) zeitwerk (2.5.2)
PLATFORMS PLATFORMS
ruby ruby

View File

@ -1,9 +1,9 @@
# typed: true
# DO NOT EDIT MANUALLY # DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `zeitwerk` gem. # This is an autogenerated file for types exported from the `zeitwerk` gem.
# Please instead update this file by running `bin/tapioca gem zeitwerk`. # Please instead update this file by running `bin/tapioca gem zeitwerk`.
# typed: true
module Kernel module Kernel
extend ::Forwardable extend ::Forwardable

View File

@ -7,7 +7,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.9
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.11/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.11/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.15.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.15.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.4.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.4.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-4.0.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-4.0.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib"

View File

@ -24,22 +24,23 @@ module Kernel
def require(path) def require(path)
if loader = Zeitwerk::Registry.loader_for(path) if loader = Zeitwerk::Registry.loader_for(path)
if path.end_with?(".rb") if path.end_with?(".rb")
zeitwerk_original_require(path).tap do |required| required = zeitwerk_original_require(path)
loader.on_file_autoloaded(path) if required loader.on_file_autoloaded(path) if required
end required
else else
loader.on_dir_autoloaded(path) loader.on_dir_autoloaded(path)
$LOADED_FEATURES << path
true true
end end
else else
zeitwerk_original_require(path).tap do |required| required = zeitwerk_original_require(path)
if required if required
abspath = $LOADED_FEATURES.last abspath = $LOADED_FEATURES.last
if loader = Zeitwerk::Registry.loader_for(abspath) if loader = Zeitwerk::Registry.loader_for(abspath)
loader.on_file_autoloaded(abspath) loader.on_file_autoloaded(abspath)
end
end end
end end
required
end end
end end

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "set" require "set"
require "securerandom"
module Zeitwerk module Zeitwerk
class Loader class Loader
@ -124,13 +123,7 @@ module Zeitwerk
# @sig () -> void # @sig () -> void
def unload def unload
mutex.synchronize do mutex.synchronize do
# We are going to keep track of the files that were required by our abspaths_of_unloaded_crefs = Set.new
# autoloads to later remove them from $LOADED_FEATURES, thus making them
# loadable by Kernel#require again.
#
# Directories are not stored in $LOADED_FEATURES, keeping track of files
# is enough.
unloaded_files = Set.new
autoloads.each do |abspath, (parent, cname)| autoloads.each do |abspath, (parent, cname)|
if parent.autoload?(cname) if parent.autoload?(cname)
@ -140,7 +133,7 @@ module Zeitwerk
# and the constant path would escape unloadable_cpath? This is just # and the constant path would escape unloadable_cpath? This is just
# defensive code to clean things up as much as we are able to. # defensive code to clean things up as much as we are able to.
unload_cref(parent, cname) unload_cref(parent, cname)
unloaded_files.add(abspath) if ruby?(abspath) abspaths_of_unloaded_crefs.add(abspath)
end end
end end
@ -151,10 +144,14 @@ module Zeitwerk
end end
unload_cref(parent, cname) unload_cref(parent, cname)
unloaded_files.add(abspath) if ruby?(abspath) abspaths_of_unloaded_crefs.add(abspath)
end end
unless unloaded_files.empty? unless abspaths_of_unloaded_crefs.empty?
# We remove these abspaths from $LOADED_FEATURES because, otherwise,
# `require`'s idempotence would prevent newly defined autoloads from
# loading them again.
#
# Bootsnap decorates Kernel#require to speed it up using a cache and # Bootsnap decorates Kernel#require to speed it up using a cache and
# this optimization does not check if $LOADED_FEATURES has the file. # this optimization does not check if $LOADED_FEATURES has the file.
# #
@ -166,7 +163,7 @@ module Zeitwerk
# Rails applications may depend on bootsnap, so for unloading to work # Rails applications may depend on bootsnap, so for unloading to work
# in that setting it is preferable that we restrict our API choice to # in that setting it is preferable that we restrict our API choice to
# one of those methods. # one of those methods.
$LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) } $LOADED_FEATURES.reject! { |file| abspaths_of_unloaded_crefs.member?(file) }
end end
autoloads.clear autoloads.clear

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module Zeitwerk module Zeitwerk
VERSION = "2.5.1" VERSION = "2.5.2"
end end