phlex-reactive 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25876f4b6f97e3cd517a4b5a575e3156ac7cadd4025e9f5cdf5f10b0bb001346
4
- data.tar.gz: f5ea2f6cee8e7b17f66725549e98f2bc9d1cc3c29cf90acfb2d1b88c1176e2ea
3
+ metadata.gz: 458474fb8c8cdba105626b01860a196a32ebd144cbc79fd9140dc5fce937924f
4
+ data.tar.gz: 214a174853a11f054ed246a9cd5fa16c96133aaaf65c1eaa07716f9c61db1eb3
5
5
  SHA512:
6
- metadata.gz: ec2bc617e5a888e268e6e746f85a225e92d88145114687be55b825c9659b2d9ef75b35d25d67d6dc950070acadf3f387b2d2608108f4b91d2a0dfcd8982495e1
7
- data.tar.gz: c2249b5dd3783ec5f9d4881290e15030ca4de9e6e4e1af238f239feb55c63df76a5c5f4d1098e9bb1022547766752a03825b63d7dac60830dcc6cd5526d929ca
6
+ metadata.gz: d4d6d052aa218e41555dc1d94ff4966e93dff8420dda1402974b470bff49050d4864c1d003c7ef6a2e27d33bbf1ef69bf3e384a8e9ac554d163ab59bdfa2a6e8
7
+ data.tar.gz: 713f21d6a6155e6dd11923ac756428868aac85074e82c969a1133863f68328a83547a5177d27b1b656a162d2363b352d7aaeaf5af79cdd5768ac86c043fe97d9
data/CHANGELOG.md CHANGED
@@ -6,6 +6,21 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.1]
10
+
11
+ ### Fixed
12
+
13
+ - **Zeitwerk eager-load crash in host apps.** A host app with
14
+ `config.eager_load = true` (the production default) runs
15
+ `Zeitwerk::Loader.eager_load_all`, which walked this gem's loader and raised
16
+ `Zeitwerk::NameError` on two files that don't follow Zeitwerk's
17
+ file→constant rule: `version.rb` (defines `VERSION`, not `Version`) and the
18
+ Rails generators under `lib/generators` (whose path/constant scheme is
19
+ intentionally non-Zeitwerk). The loader now requires `version.rb` up front and
20
+ ignores it, and ignores `lib/generators` (Rails loads generators itself), so
21
+ the gem eager-loads cleanly. Added a regression spec that calls
22
+ `eager_load_all`. No API changes.
23
+
9
24
  ## [0.2.0]
10
25
 
11
26
  ### Added
@@ -49,6 +64,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
49
64
  scaffolds a reactive component (and an RSpec spec when the app uses RSpec),
50
65
  state-backed by default or record-backed with `--record`.
51
66
 
52
- [Unreleased]: https://github.com/mhenrixon/phlex-reactive/compare/v0.2.0...HEAD
67
+ [Unreleased]: https://github.com/mhenrixon/phlex-reactive/compare/v0.2.1...HEAD
68
+ [0.2.1]: https://github.com/mhenrixon/phlex-reactive/compare/v0.2.0...v0.2.1
53
69
  [0.2.0]: https://github.com/mhenrixon/phlex-reactive/compare/v0.1.0...v0.2.0
54
70
  [0.1.0]: https://github.com/mhenrixon/phlex-reactive/releases/tag/v0.1.0
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Reactive
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
@@ -3,6 +3,12 @@
3
3
  require "zeitwerk"
4
4
  require "globalid"
5
5
 
6
+ # VERSION is a plain constant, not a Zeitwerk-managed file (it defines VERSION,
7
+ # not Version). Require it up front and ignore the file below so the loader
8
+ # never tries to load it — otherwise eager_load_all (host app with
9
+ # config.eager_load = true) raises Zeitwerk::NameError.
10
+ require_relative "reactive/version"
11
+
6
12
  module Phlex
7
13
  # phlex-reactive: reactive Phlex components for Rails.
8
14
  #
@@ -125,8 +131,23 @@ end
125
131
 
126
132
  loader = Zeitwerk::Loader.new
127
133
  loader.tag = "phlex-reactive"
128
- loader.push_dir(File.expand_path("..", __dir__))
129
- loader.ignore("#{__dir__}/../phlex-reactive.rb")
134
+ # Root is lib/ so files map to the Phlex::Reactive namespace
135
+ # (lib/phlex/reactive/foo.rb -> Phlex::Reactive::Foo).
136
+ lib = File.expand_path("..", __dir__)
137
+ loader.push_dir(lib)
138
+ # The gem-name shim (`require "phlex-reactive"`) is a plain require, not a
139
+ # managed file.
140
+ loader.ignore("#{lib}/phlex-reactive.rb")
141
+ # version.rb defines VERSION (a constant, not a `Version` class) and is required
142
+ # above — Zeitwerk must not try to load it.
143
+ loader.ignore("#{lib}/phlex/reactive/version.rb")
144
+ # Rails generators are discovered and loaded by Rails' own generator system,
145
+ # not the app autoloader. Their path/constant scheme
146
+ # (generators/phlex/reactive/... defining Phlex::Reactive::Generators::...)
147
+ # deliberately doesn't follow Zeitwerk's rules, so the loader must ignore them.
148
+ loader.ignore("#{lib}/generators")
149
+ # The engine is required explicitly below (only when Rails is present) and must
150
+ # not be eager-loaded before that.
130
151
  loader.do_not_eager_load("#{__dir__}/reactive/engine.rb")
131
152
  loader.setup
132
153
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-reactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson