react-manifest-rails 0.2.17 → 0.2.19
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/lib/react_manifest/version.rb +1 -1
- data/lib/react_manifest/view_helpers.rb +4 -0
- data/lib/react_manifest.rb +8 -2
- 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: d392f2b6bf13451773d9e12b51a3b1cf1048c407058cb60cbdb2db48cfa79acc
|
|
4
|
+
data.tar.gz: ff2acfbd5ddc4b0b1e048fea664211ed62d04890fcdbcb555324f4ce3bbfa0bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2df51348498e3778af7048c4a7d3090d1223ab0683e4bac4a0443dff6ad2b4ec47eca9bb50a492b35a012cb5ce126521839540a58171cddd67651c0da50e56e8
|
|
7
|
+
data.tar.gz: b7f9300e03f28a274b33f62c3500add16249aa0e4d52607d6c359527ca36c3f53ba00d69d840021c954ec87bcf7b6aa36682122349ada050f0f74e7d11a481a0
|
|
@@ -21,6 +21,10 @@ module ReactManifest
|
|
|
21
21
|
bundles = ReactManifest.resolve_bundles(ctrl)
|
|
22
22
|
return "".html_safe if bundles.empty?
|
|
23
23
|
|
|
24
|
+
# Record emitted bundles so react_component doesn't re-emit them.
|
|
25
|
+
emitted = (@_react_manifest_emitted_bundles ||= [])
|
|
26
|
+
bundles.each { |b| emitted << b unless emitted.include?(b) }
|
|
27
|
+
|
|
24
28
|
asset_names = bundles.map { |bundle| "#{bundle}.js" }
|
|
25
29
|
javascript_include_tag(*asset_names, extname: false, **html_options)
|
|
26
30
|
end
|
data/lib/react_manifest.rb
CHANGED
|
@@ -186,10 +186,16 @@ module ReactManifest
|
|
|
186
186
|
end
|
|
187
187
|
|
|
188
188
|
def resolve_bundle_reference(config, bundle_name)
|
|
189
|
+
subdir = config.normalized_manifest_subdir
|
|
189
190
|
manifest_path = File.join(config.abs_manifest_dir, "#{bundle_name}.js")
|
|
190
|
-
|
|
191
|
+
if File.exist?(manifest_path)
|
|
192
|
+
# Return the full Sprockets logical path so javascript_include_tag resolves
|
|
193
|
+
# correctly: files in ux_manifests/ have logical path ux_manifests/<name>.
|
|
194
|
+
return subdir.empty? ? bundle_name : "#{subdir}/#{bundle_name}"
|
|
195
|
+
end
|
|
191
196
|
|
|
192
|
-
# Backward compatibility
|
|
197
|
+
# Backward compatibility: apps that wrote manifests directly to output_dir root
|
|
198
|
+
# before manifest_subdir was introduced keep working with bare bundle names.
|
|
193
199
|
legacy_path = File.join(config.abs_output_dir, "#{bundle_name}.js")
|
|
194
200
|
return bundle_name if File.exist?(legacy_path)
|
|
195
201
|
|