react-manifest-rails 0.2.30 → 0.2.31
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 +9 -0
- data/lib/react_manifest/generator.rb +11 -5
- data/lib/react_manifest/version.rb +1 -1
- data/lib/react_manifest/view_helpers.rb +0 -14
- data/lib/react_manifest.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc0a4a583ea6c0b488c1fc9e4c0af46dec90e4ecdd6b93cd7eae48267ffdbfaa
|
|
4
|
+
data.tar.gz: 1a00e3b56139db55d5c473e22bc35cd43e2fc1dcb3ee50700602344c09d0c4db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6db17954b9a91e080c0074ce203d322af67ba58d887be9ae4a1ada51add9fe3d36f7fc256b1587c274c2315c9324caa7576421c19740a6aeab40fa85f3f5606
|
|
7
|
+
data.tar.gz: 49dc6ae440709098ace838c583f492a516fa5abd0b1b332525cd3803ed3787ed656cd23871b53ad8cb91908a4c0d62e0f9d96b8394180fe950da8ee405068d6c
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.31] - 2026-07-01
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Controller manifests no longer pull in an unrelated bundle's files just because a component name collides (e.g. a generic `Show` component defined in two different `ux/app/*` dirs). A bundle now always satisfies a symbol from its own files first, instead of attributing it to whichever bundle happened to define that name first.
|
|
14
|
+
- `react_component` no longer silently stops auto-injecting a component's bundle for the rest of the request after `react_bundle_tag` has rendered once. Previously, calling `react_component` for a component in an unrelated bundle (not the current controller's own bundle, e.g. from a haml/erb view mixing controller-based and component-based rendering) would render with no script tag at all if `react_bundle_tag` had already run earlier in the same request.
|
|
15
|
+
|
|
16
|
+
### Removed
|
|
17
|
+
- The gem version is no longer embedded in the `AUTO-GENERATED` manifest header. Previously every manifest's content digest changed on every gem upgrade, forcing a full regeneration of all `ux_*.js` files for no functional reason.
|
|
18
|
+
|
|
10
19
|
## [0.2.28] - 2026-05-11
|
|
11
20
|
|
|
12
21
|
### Fixed
|
|
@@ -30,7 +30,6 @@ module ReactManifest
|
|
|
30
30
|
|
|
31
31
|
HEADER = <<~JS.freeze
|
|
32
32
|
// AUTO-GENERATED — DO NOT EDIT
|
|
33
|
-
// react-manifest-rails %<version>s
|
|
34
33
|
// Run `rails react_manifest:generate` to regenerate.
|
|
35
34
|
JS
|
|
36
35
|
|
|
@@ -130,6 +129,7 @@ module ReactManifest
|
|
|
130
129
|
def build_controller_context(controller_dirs)
|
|
131
130
|
bundle_files = {}
|
|
132
131
|
symbol_to_bundle = {}
|
|
132
|
+
bundle_own_symbols = Hash.new { |h, k| h[k] = Set.new }
|
|
133
133
|
external_symbol_to_require = {}
|
|
134
134
|
dependencies = Hash.new { |h, k| h[k] = Set.new }
|
|
135
135
|
external_requires = Hash.new { |h, k| h[k] = Set.new }
|
|
@@ -145,6 +145,7 @@ module ReactManifest
|
|
|
145
145
|
next unless sym.match?(/\A[A-Z][A-Za-z0-9_]*\z/)
|
|
146
146
|
|
|
147
147
|
symbol_to_bundle[sym] ||= bundle_name
|
|
148
|
+
bundle_own_symbols[bundle_name] << sym
|
|
148
149
|
end
|
|
149
150
|
end
|
|
150
151
|
end
|
|
@@ -170,8 +171,16 @@ module ReactManifest
|
|
|
170
171
|
|
|
171
172
|
# Compute per-bundle cross-app and external dependencies
|
|
172
173
|
bundle_files.each do |bundle_name, files|
|
|
174
|
+
own_symbols = bundle_own_symbols[bundle_name]
|
|
175
|
+
|
|
173
176
|
files.each do |file_path|
|
|
174
177
|
extract_used_component_symbols(file_path).each do |sym|
|
|
178
|
+
# A symbol the bundle defines itself (in any of its own files) is
|
|
179
|
+
# always satisfied locally — never attribute it to another bundle
|
|
180
|
+
# or an external provider just because that symbol name happens
|
|
181
|
+
# to collide with something defined elsewhere.
|
|
182
|
+
next if own_symbols.include?(sym)
|
|
183
|
+
|
|
175
184
|
dep_bundle = symbol_to_bundle[sym]
|
|
176
185
|
dependencies[bundle_name] << dep_bundle if dep_bundle && dep_bundle != bundle_name
|
|
177
186
|
|
|
@@ -316,10 +325,7 @@ module ReactManifest
|
|
|
316
325
|
# ----------------------------------------------------------- helpers
|
|
317
326
|
|
|
318
327
|
def header_lines
|
|
319
|
-
[
|
|
320
|
-
format(HEADER, version: ReactManifest::VERSION),
|
|
321
|
-
""
|
|
322
|
-
].flatten
|
|
328
|
+
[HEADER, ""]
|
|
323
329
|
end
|
|
324
330
|
|
|
325
331
|
def js_files_in(dir)
|
|
@@ -26,7 +26,6 @@ module ReactManifest
|
|
|
26
26
|
return "".html_safe if fresh_bundles.empty?
|
|
27
27
|
|
|
28
28
|
fresh_bundles.each { |b| emitted << b }
|
|
29
|
-
mark_bundle_tag_rendered
|
|
30
29
|
|
|
31
30
|
asset_names = fresh_bundles.map { |bundle| "#{bundle}.js" }
|
|
32
31
|
javascript_include_tag(*asset_names, extname: false, **html_options)
|
|
@@ -38,7 +37,6 @@ module ReactManifest
|
|
|
38
37
|
# This avoids strict dependence on controller_path -> bundle naming alignment.
|
|
39
38
|
def react_component(*args, **kwargs, &block)
|
|
40
39
|
html = super
|
|
41
|
-
return html if bundle_tag_rendered?
|
|
42
40
|
|
|
43
41
|
component_name = args.first
|
|
44
42
|
bundles = ReactManifest.resolve_bundles_for_component_direct(component_name)
|
|
@@ -78,17 +76,5 @@ module ReactManifest
|
|
|
78
76
|
@emitted_bundles ||= []
|
|
79
77
|
end
|
|
80
78
|
end
|
|
81
|
-
|
|
82
|
-
def mark_bundle_tag_rendered
|
|
83
|
-
return unless respond_to?(:request, true) && request
|
|
84
|
-
|
|
85
|
-
request.env["react_manifest.bundle_tag_rendered"] = true
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def bundle_tag_rendered?
|
|
89
|
-
return false unless respond_to?(:request, true) && request
|
|
90
|
-
|
|
91
|
-
request.env["react_manifest.bundle_tag_rendered"] == true
|
|
92
|
-
end
|
|
93
79
|
end
|
|
94
80
|
end
|
data/lib/react_manifest.rb
CHANGED
|
@@ -146,6 +146,7 @@ module ReactManifest
|
|
|
146
146
|
|
|
147
147
|
controller_dirs = TreeClassifier.new(config).classify.controller_dirs
|
|
148
148
|
symbol_to_bundle = {}
|
|
149
|
+
bundle_own_symbols = Hash.new { |h, k| h[k] = Set.new }
|
|
149
150
|
bundle_files = Hash.new { |h, k| h[k] = [] }
|
|
150
151
|
bundle_dependencies = Hash.new { |h, k| h[k] = Set.new }
|
|
151
152
|
|
|
@@ -160,13 +161,21 @@ module ReactManifest
|
|
|
160
161
|
|
|
161
162
|
# Keep first writer to ensure deterministic behavior if a symbol is duplicated.
|
|
162
163
|
symbol_to_bundle[symbol] ||= bundle_name
|
|
164
|
+
bundle_own_symbols[bundle_name] << symbol
|
|
163
165
|
end
|
|
164
166
|
end
|
|
165
167
|
end
|
|
166
168
|
|
|
167
169
|
bundle_files.each do |bundle_name, files|
|
|
170
|
+
own_symbols = bundle_own_symbols[bundle_name]
|
|
171
|
+
|
|
168
172
|
files.each do |file_path|
|
|
169
173
|
extract_used_component_symbols(file_path).each do |symbol|
|
|
174
|
+
# A symbol the bundle defines itself is always satisfied locally —
|
|
175
|
+
# never attribute it to another bundle just because that symbol
|
|
176
|
+
# name happens to collide with something defined elsewhere.
|
|
177
|
+
next if own_symbols.include?(symbol)
|
|
178
|
+
|
|
170
179
|
dep_bundle = symbol_to_bundle[symbol]
|
|
171
180
|
next unless dep_bundle && dep_bundle != bundle_name
|
|
172
181
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: react-manifest-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.31
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oliver Noonan
|
|
@@ -160,7 +160,7 @@ licenses:
|
|
|
160
160
|
metadata:
|
|
161
161
|
homepage_uri: https://github.com/olivernoonan/react-manifest-rails
|
|
162
162
|
source_code_uri: https://github.com/olivernoonan/react-manifest-rails
|
|
163
|
-
changelog_uri: https://github.com/olivernoonan/react-manifest-rails/blob/
|
|
163
|
+
changelog_uri: https://github.com/olivernoonan/react-manifest-rails/blob/master/CHANGELOG.md
|
|
164
164
|
bug_tracker_uri: https://github.com/olivernoonan/react-manifest-rails/issues
|
|
165
165
|
rubygems_mfa_required: 'true'
|
|
166
166
|
rdoc_options: []
|