vite_rails 3.0.15 → 3.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0826edafe9697708d9878f604b86a8abccabfcc3dfa0081cd2b0cc63c78bc83
4
- data.tar.gz: 74678206866f8d760ee7e3f3058f32ffa084b3bbfb090c0109ffa0420c225340
3
+ metadata.gz: '09ffd4b097008530d82fda12a78c5c8004f022a65e789eac969698d00110b06a'
4
+ data.tar.gz: 7310a8678f4772e3b9eab6186033705e1c871e44873e62de2de68a6aa26f2bb9
5
5
  SHA512:
6
- metadata.gz: 5c15982cec0cf83a71f481fe4a7c3d3d5b461216c2daa32409f9e3e2b09c20df6ee9f7952b9912aa251c65741c1593d1d98184059bccc3b87a8d42424ca482b7
7
- data.tar.gz: d30bf47565e7fa8d7fd035072fc7315b3f1d668e3cbe3ff072b1de00a47b22885a931b0ad33ef15bf8a2b4c225c290d1cdd8a65e0484a42ccd2d012fe53bda07
6
+ metadata.gz: 7257343e6a237462b31552ef89a72cc77ade0cc639b99ec6d9689fc38ae568e1289882a9e34a092b90d86bfaa0cea03584ee8446f969a32561c62e283533e911
7
+ data.tar.gz: 9edaaf096099ef3ccf762661c4cea9de82ccc2b6a5d02b5abb47c32cc1321f7dd973ca9c0d63b6ce54090507f1a9144cf6855dae2b76300062707cb8523a62e5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [3.0.17](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.16...vite_rails@3.0.17) (2023-10-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * add vite_picture_tag for Rails 7.1 ([#409](https://github.com/ElMassimo/vite_ruby/issues/409)) ([4e3762a](https://github.com/ElMassimo/vite_ruby/commit/4e3762a978b7879206dbc48137ba525d0d0ad971))
7
+
8
+
9
+
10
+ ## [3.0.16](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.15...vite_rails@3.0.16) (2023-09-22)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * emit a single early hint per entrypoint in `vite_preload_tag` ([#402](https://github.com/ElMassimo/vite_ruby/issues/402)) ([3f9a60b](https://github.com/ElMassimo/vite_ruby/commit/3f9a60b4bb28858b8460b5fc302ad352a03ba002))
16
+
17
+
18
+
1
19
  ## [3.0.15](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.14...vite_rails@3.0.15) (2023-06-19)
2
20
 
3
21
 
@@ -79,6 +79,19 @@ module ViteRails::TagHelpers
79
79
  image_tag(vite_asset_path(name), options)
80
80
  end
81
81
 
82
+ # Public: Renders a <picture> tag with one or more Vite asset sources.
83
+ def vite_picture_tag(*sources, &block)
84
+ unless Rails.gem_version >= Gem::Version.new('7.1.0')
85
+ raise NotImplementedError, '`vite_picture_tag` is only available for Rails 7.1 or above.'
86
+ end
87
+
88
+ sources.flatten!
89
+ options = sources.extract_options!
90
+
91
+ vite_sources = sources.map { |src| vite_asset_path(src) }
92
+ picture_tag(*vite_sources, options, &block)
93
+ end
94
+
82
95
  private
83
96
 
84
97
  # Internal: Returns the current manifest loaded by Vite Ruby.
@@ -88,9 +101,14 @@ private
88
101
 
89
102
  # Internal: Renders a modulepreload link tag.
90
103
  def vite_preload_tag(*sources, crossorigin:, **options)
91
- sources.map { |source|
92
- href = path_to_asset(source)
93
- try(:request).try(:send_early_hints, 'Link' => %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin }))
104
+ asset_paths = sources.map { |source| path_to_asset(source) }
105
+ try(:request).try(
106
+ :send_early_hints,
107
+ 'Link' => asset_paths.map { |href|
108
+ %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin })
109
+ }.join("\n"),
110
+ )
111
+ asset_paths.map { |href|
94
112
  tag.link(rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin, **options)
95
113
  }.join("\n").html_safe
96
114
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRails
4
- VERSION = '3.0.15'
4
+ VERSION = '3.0.17'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.15
4
+ version: 3.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -88,8 +88,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
88
88
  licenses:
89
89
  - MIT
90
90
  metadata:
91
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@3.0.15/vite_rails
92
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@3.0.15/vite_rails/CHANGELOG.md
91
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@3.0.17/vite_rails
92
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@3.0.17/vite_rails/CHANGELOG.md
93
93
  post_install_message:
94
94
  rdoc_options: []
95
95
  require_paths: