react-manifest-rails 0.2.18 → 0.2.20
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 +5 -0
- data/lib/react_manifest/version.rb +1 -1
- data/lib/react_manifest/view_helpers.rb +1 -1
- data/lib/react_manifest.rb +36 -3
- 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: 573c8f1d4441a029cdc192ceef3e3e140702e55a17fc367e195243752f3970d6
|
|
4
|
+
data.tar.gz: d02437b64aeee8fb45879b9b5d1f740e4eea85b42023ac8fadb84c3c6c491e97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4aaf9bc43e9cc067c47790eb98061a0af8ad58efaa61c7c9a663749ca1d3e5cb464881987ca9ee31e015c820578780857cf5b15c9fae2a5d2b7bd0e0ce3038c
|
|
7
|
+
data.tar.gz: 34273febe66a2821de77756baad5be6e3193234746db4f0ded7ba80d180ba1ce3d0d7a7c01e67456060ae743d5cab2723914ec5e163f1eaefb885f3504177569
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- `react_component` now emits only `ux_shared` plus the direct owning bundle for the requested component symbol, instead of also emitting transitive controller manifests as separate script tags. This prevents unnecessary network requests for additional `ux_*.js` manifests while preserving dependency loading through generated manifest `require` directives.
|
|
12
|
+
|
|
8
13
|
## [0.2.10] - 2026-04-16
|
|
9
14
|
|
|
10
15
|
### Fixed
|
|
@@ -37,7 +37,7 @@ module ReactManifest
|
|
|
37
37
|
html = super
|
|
38
38
|
|
|
39
39
|
component_name = args.first
|
|
40
|
-
bundles = ReactManifest.
|
|
40
|
+
bundles = ReactManifest.resolve_bundles_for_component_direct(component_name)
|
|
41
41
|
return html if bundles.empty?
|
|
42
42
|
|
|
43
43
|
emitted = (@_react_manifest_emitted_bundles ||= [])
|
data/lib/react_manifest.rb
CHANGED
|
@@ -15,6 +15,7 @@ require "react_manifest/watcher"
|
|
|
15
15
|
require "react_manifest/reporter"
|
|
16
16
|
require "react_manifest/view_helpers"
|
|
17
17
|
|
|
18
|
+
# rubocop:disable Metrics/ModuleLength
|
|
18
19
|
module ReactManifest
|
|
19
20
|
class << self
|
|
20
21
|
def configuration
|
|
@@ -65,7 +66,32 @@ module ReactManifest
|
|
|
65
66
|
# where the requested component name is known and may not align 1:1 with
|
|
66
67
|
# controller_path-derived bundle names.
|
|
67
68
|
def resolve_bundle_for_component(component_name)
|
|
68
|
-
|
|
69
|
+
resolve_bundles_for_component_direct(component_name).last
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Resolve the direct bundle list needed for a React component symbol.
|
|
73
|
+
# Returns shared first (if present), then the component's owning bundle.
|
|
74
|
+
#
|
|
75
|
+
# Unlike resolve_bundles_for_component, this does not include transitive
|
|
76
|
+
# controller dependencies because generated controller manifests already
|
|
77
|
+
# inline those files via Sprockets require directives.
|
|
78
|
+
def resolve_bundles_for_component_direct(component_name)
|
|
79
|
+
name = component_name.to_s
|
|
80
|
+
return [] if name.empty?
|
|
81
|
+
|
|
82
|
+
config = configuration
|
|
83
|
+
maps = component_maps(config)
|
|
84
|
+
root_bundle = maps[:symbol_to_bundle][name]
|
|
85
|
+
return [] unless root_bundle
|
|
86
|
+
|
|
87
|
+
bundles = []
|
|
88
|
+
shared = resolve_bundle_reference(config, config.shared_bundle)
|
|
89
|
+
bundles << shared if shared
|
|
90
|
+
|
|
91
|
+
root = resolve_bundle_reference(config, root_bundle)
|
|
92
|
+
bundles << root if root && !bundles.include?(root)
|
|
93
|
+
|
|
94
|
+
bundles
|
|
69
95
|
end
|
|
70
96
|
|
|
71
97
|
# Resolve all controller bundles needed for a React component symbol.
|
|
@@ -186,10 +212,16 @@ module ReactManifest
|
|
|
186
212
|
end
|
|
187
213
|
|
|
188
214
|
def resolve_bundle_reference(config, bundle_name)
|
|
215
|
+
subdir = config.normalized_manifest_subdir
|
|
189
216
|
manifest_path = File.join(config.abs_manifest_dir, "#{bundle_name}.js")
|
|
190
|
-
|
|
217
|
+
if File.exist?(manifest_path)
|
|
218
|
+
# Return the full Sprockets logical path so javascript_include_tag resolves
|
|
219
|
+
# correctly: files in ux_manifests/ have logical path ux_manifests/<name>.
|
|
220
|
+
return subdir.empty? ? bundle_name : "#{subdir}/#{bundle_name}"
|
|
221
|
+
end
|
|
191
222
|
|
|
192
|
-
# Backward compatibility
|
|
223
|
+
# Backward compatibility: apps that wrote manifests directly to output_dir root
|
|
224
|
+
# before manifest_subdir was introduced keep working with bare bundle names.
|
|
193
225
|
legacy_path = File.join(config.abs_output_dir, "#{bundle_name}.js")
|
|
194
226
|
return bundle_name if File.exist?(legacy_path)
|
|
195
227
|
|
|
@@ -214,3 +246,4 @@ module ReactManifest
|
|
|
214
246
|
end
|
|
215
247
|
end
|
|
216
248
|
end
|
|
249
|
+
# rubocop:enable Metrics/ModuleLength
|