onload 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/onload/core_ext/kernel_zeitwerk.rb +6 -1
- data/lib/onload/ext/bootsnap/autoload.rb +1 -1
- data/lib/onload/ext/zeitwerk/loader.rb +29 -17
- data/lib/onload/version.rb +1 -1
- data/spec/rails/dummy/log/test.log +419 -68051
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9da25e881992956871df8379241638cc78561b87d09b9040390b9e7e1331b47
|
4
|
+
data.tar.gz: bd7eed8c12d1557af7cfa02c29f3e99e3c60d803980f5f5342ee226f98491fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cd23e59b466a20c66c7cc2bfcffe0f43363ff677d282adc31b5b897edb41b47af83322cfaa821e965d39a3ed563b0a9923acda00525771a763d725137b39a88
|
7
|
+
data.tar.gz: 5fa4b2f9e471429675ad855c9e945aeae6fa516e5c1abfd3295e298b3c6929baed89b0e66f8e2b61ad07af05e97ff78ea542195ff7dcdb2adc1e323c3feebe58
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.0.4
|
2
|
+
* Fix issues with Zeitwerk v2.6.13 and later.
|
3
|
+
- Zeitwerk introduced the `Cref` class, which encapsulates a `mod` and `cname`. A number of internal methods used to return both of these things individually; now they are wrapped in `Cref`s.
|
4
|
+
|
5
|
+
## 1.0.3
|
6
|
+
* Fix Bootsnap issue causing `NoMethodError`.
|
7
|
+
- Onload started out using `alias_method` to override certain Zeitwerk and Bootsnap methods. When it was extracted into a gem, I chose to use `Module#prepend` instead. I forgot to convert one of the method calls to `super`, hence the error.
|
8
|
+
|
1
9
|
## 1.0.2
|
2
10
|
* Add support for Rails 7.1.
|
3
11
|
* Add support for Zeitwerk 2.6.12.
|
@@ -17,7 +17,12 @@ module Kernel
|
|
17
17
|
# uninitialized, that's why I'm loading this file. Whatevs.
|
18
18
|
loader = Zeitwerk::Registry.loader_for(file)
|
19
19
|
parent, cname = loader.send(:autoloads)[file]
|
20
|
-
|
20
|
+
|
21
|
+
if defined?(Zeitwerk::Cref) && parent.is_a?(Zeitwerk::Cref)
|
22
|
+
parent.remove
|
23
|
+
else
|
24
|
+
parent.send(:remove_const, cname)
|
25
|
+
end
|
21
26
|
|
22
27
|
return onload_orig_load(f.outfile, *args)
|
23
28
|
end
|
@@ -15,7 +15,7 @@ module Onload
|
|
15
15
|
cached_path = Bootsnap::LoadPathCache.load_path_cache.find(path)
|
16
16
|
|
17
17
|
if (unprocessed_path = Onload.unprocessed_file_for(cached_path))
|
18
|
-
return
|
18
|
+
return super(const, unprocessed_path)
|
19
19
|
end
|
20
20
|
|
21
21
|
super
|
@@ -11,26 +11,38 @@ module Onload
|
|
11
11
|
super || Onload.process?(path)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# and remove the entire extension for newer versions. Although cname
|
21
|
-
# means "constant name," we use Onload.basename to remove all residual
|
22
|
-
# file extensions that were left over from the conversion from a file
|
23
|
-
# name to a cname.
|
24
|
-
cname = Onload.basename(cname.to_s).to_sym
|
25
|
-
else
|
26
|
-
# if there is a corresponding unprocessed file, autoload it instead of
|
27
|
-
# the .rb file
|
28
|
-
if (unprocessed_file = Onload.unprocessed_file_for(file))
|
29
|
-
file = unprocessed_file
|
14
|
+
if Zeitwerk::Loader.instance_method(:autoload_file).arity == 2
|
15
|
+
def autoload_file(cref, file)
|
16
|
+
if !Onload.process?(file)
|
17
|
+
if (unprocessed_file = Onload.unprocessed_file_for(file))
|
18
|
+
file = unprocessed_file
|
19
|
+
end
|
30
20
|
end
|
21
|
+
|
22
|
+
super
|
31
23
|
end
|
24
|
+
else
|
25
|
+
def autoload_file(parent, cname, file)
|
26
|
+
if Onload.process?(file)
|
27
|
+
# Some older versions of Zeitwerk very naïvely try to remove only the
|
28
|
+
# last 3 characters in an attempt to strip off the .rb file extension,
|
29
|
+
# while newer ones only remove it if it's actually there. This line is
|
30
|
+
# necessary to remove the trailing leftover period for older versions,
|
31
|
+
# and remove the entire extension for newer versions. Although cname
|
32
|
+
# means "constant name," we use Onload.basename to remove all residual
|
33
|
+
# file extensions that were left over from the conversion from a file
|
34
|
+
# name to a cname.
|
35
|
+
cname = Onload.basename(cname.to_s).to_sym
|
36
|
+
else
|
37
|
+
# if there is a corresponding unprocessed file, autoload it instead of
|
38
|
+
# the .rb file
|
39
|
+
if (unprocessed_file = Onload.unprocessed_file_for(file))
|
40
|
+
file = unprocessed_file
|
41
|
+
end
|
42
|
+
end
|
32
43
|
|
33
|
-
|
44
|
+
super
|
45
|
+
end
|
34
46
|
end
|
35
47
|
|
36
48
|
# introduced in Zeitwerk v2.6.10
|
data/lib/onload/version.rb
CHANGED