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)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
zeitwerk (2.5.1)
zeitwerk (2.5.2)
PLATFORMS
ruby

View File

@ -1,9 +1,9 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `zeitwerk` gem.
# Please instead update this file by running `bin/tapioca gem zeitwerk`.
# typed: true
module Kernel
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/minitest-5.15.0/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/public_suffix-4.0.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib"

View File

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

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true
require "set"
require "securerandom"
module Zeitwerk
class Loader
@ -124,13 +123,7 @@ module Zeitwerk
# @sig () -> void
def unload
mutex.synchronize do
# We are going to keep track of the files that were required by our
# 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
abspaths_of_unloaded_crefs = Set.new
autoloads.each do |abspath, (parent, cname)|
if parent.autoload?(cname)
@ -140,7 +133,7 @@ module Zeitwerk
# and the constant path would escape unloadable_cpath? This is just
# defensive code to clean things up as much as we are able to.
unload_cref(parent, cname)
unloaded_files.add(abspath) if ruby?(abspath)
abspaths_of_unloaded_crefs.add(abspath)
end
end
@ -151,10 +144,14 @@ module Zeitwerk
end
unload_cref(parent, cname)
unloaded_files.add(abspath) if ruby?(abspath)
abspaths_of_unloaded_crefs.add(abspath)
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
# 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
# in that setting it is preferable that we restrict our API choice to
# one of those methods.
$LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) }
$LOADED_FEATURES.reject! { |file| abspaths_of_unloaded_crefs.member?(file) }
end
autoloads.clear

View File

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