require-hooks 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/require-hooks/mode/bootsnap.rb +14 -12
- data/lib/require-hooks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5179f6010729ac30b40c0040f2d00956164c8f765d41e2d095eeefa9b96da842
|
|
4
|
+
data.tar.gz: f836cd71ec64084e4145ac572a555b7a32b7abdacd7d7d25965766bca2d264bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93559e1cc1b84d23e17b60abb8f92e47c67ea6f66f1dcbc4243b34f3d68345674c96da73aa890ba8c79e226209877a48aa4438343a51ba3ce736160403597abb
|
|
7
|
+
data.tar.gz: 4c36e011286728aee0f43a81411875c38fee956e34105c4dcba87bc4cf52aaee6a2d4e97d332bd2727551c85bc009ddba646b3a9764ca19c3521b7687bf43a1c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -128,7 +128,7 @@ Thus, if you introduce new source transformers or hijackers, you must invalidate
|
|
|
128
128
|
|
|
129
129
|
## Limitations
|
|
130
130
|
|
|
131
|
-
- Coverage tracking is only supported
|
|
131
|
+
- Coverage tracking is only supported in Ruby 4.0.4+ (or 3.4.10+ for 3.4.x series); for older versions in 3.4 and 4.0 series, you can enable `eval` coverage tracking to make it work with Require Hooks (`Coverage.start(eval: true, ...)` or `SimpleCov.enable_coverage :eval`). For Ruby 3.2.x and 3.3.x, only around hooks are supported.
|
|
132
132
|
- `Kernel#load` with a wrap argument (e.g., `load "some_path", true` or `load "some_path", MyModule)`) is not supported (fallbacked to the original implementation). The biggest challenge here is to support constants nesting.
|
|
133
133
|
- Some very edgy symlinking scenarios are not supported (unlikely to affect real-world projects).
|
|
134
134
|
|
|
@@ -69,22 +69,24 @@ module RequireHooks
|
|
|
69
69
|
::Bootsnap::CompileCache::ISeq.cache_dir = File.join(LoadIseqExt.orig_cache_dir, RequireHooks::Bootsnap.version_hash)
|
|
70
70
|
|
|
71
71
|
ctx.run_around_load_callbacks(path) do
|
|
72
|
-
|
|
72
|
+
begin
|
|
73
|
+
iseq = super
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
::Bootsnap::CompileCache::ISeq.cache_dir = LoadIseqExt.orig_cache_dir
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
# Bootsnap returns nil when the coverage is on,
|
|
78
|
+
# we fallback to our custom #compile_with_coverage
|
|
79
|
+
unless iseq
|
|
80
|
+
next unless defined?(Coverage) && Coverage.running?
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
iseq = RequireHooks::Iseq.compile_with_coverage(ctx, path)
|
|
83
|
+
end
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
iseq.eval
|
|
86
|
+
EMPTY_ISEQ
|
|
87
|
+
ensure
|
|
88
|
+
::Bootsnap::CompileCache::ISeq.cache_dir = LoadIseqExt.orig_cache_dir
|
|
89
|
+
end
|
|
88
90
|
end
|
|
89
91
|
end
|
|
90
92
|
end
|