vite_rails 3.0.14 → 3.0.16

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: 359c2358de873924f146f74686bf52baf0a3f5ca1b50482f65ca12909d0e2adf
4
- data.tar.gz: 99043f619d26034d787054fb59e99067aab619fa074b342a608af3ad8899399a
3
+ metadata.gz: bb3f141b086aee8a0b40651b824fc6760d47af516037bca0ae91ef8aa3481c47
4
+ data.tar.gz: c19d6cbb3a4062421691501853f26b4b6c344b0ab9a6502be6ed4504a2b0c33d
5
5
  SHA512:
6
- metadata.gz: d37257a70e038ec7f3dc69970aca2989ab881f75a35a0bf7ef4a5c3261eeadbfb5097d5101ebdf95d9fa42a6e58983380c466aa02bf02fd8b68ac9533b5bef0f
7
- data.tar.gz: c75f1377b5382c6c041211b9ed28ba60d3141b06c08e13aac04e82fb2002bbe9fc349b70545f3cb33400d172cb08ef5859af1dc0ba7ab6bfc7ce095a79bbe94d
6
+ metadata.gz: d26931a1bbe46f2c11ab59d098a1f59efdacbb0b74999812d2e13858f557d04621d5bb2903f8894ecfea601d281d35e90559254bb10e834f3edfed2c3f41dbcc
7
+ data.tar.gz: a6335c2c8d1aab0b9e5eb06eb19c47c7c5f332321319ac8310177a1e0ccbfd319286d89ba02d92568d5ad083ada51ac28711f048b53f113fa870a9c2e207b2d3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [3.0.16](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.15...vite_rails@3.0.16) (2023-09-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 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))
7
+
8
+
9
+
10
+ ## [3.0.15](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.14...vite_rails@3.0.15) (2023-06-19)
11
+
12
+
13
+ ### Features
14
+
15
+ * add nonce by default to react refresh tag (close [#249](https://github.com/ElMassimo/vite_ruby/issues/249)) ([a31f0a9](https://github.com/ElMassimo/vite_ruby/commit/a31f0a97588568a964b52005beee63217c7bcfa9))
16
+ * Use javascript_tag helper for vite_react_refresh_tag ([#372](https://github.com/ElMassimo/vite_ruby/issues/372)) ([238c6bd](https://github.com/ElMassimo/vite_ruby/commit/238c6bd211c0fafaa6170f0bdd631a0f6e41d992)), closes [#249](https://github.com/ElMassimo/vite_ruby/issues/249)
17
+
18
+
19
+
1
20
  ## [3.0.14](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.13...vite_rails@3.0.14) (2023-02-08)
2
21
 
3
22
 
@@ -10,8 +10,12 @@ module ViteRails::TagHelpers
10
10
  end
11
11
 
12
12
  # Public: Renders a script tag to enable HMR with React Refresh.
13
- def vite_react_refresh_tag
14
- vite_manifest.react_refresh_preamble&.html_safe
13
+ def vite_react_refresh_tag(**options)
14
+ return unless react_preamble_code = vite_manifest.react_preamble_code
15
+
16
+ options[:nonce] = true if Rails::VERSION::MAJOR >= 6 && !options.key?(:nonce)
17
+
18
+ javascript_tag(react_preamble_code.html_safe, type: :module, **options)
15
19
  end
16
20
 
17
21
  # Public: Resolves the path for the specified Vite asset.
@@ -84,9 +88,14 @@ private
84
88
 
85
89
  # Internal: Renders a modulepreload link tag.
86
90
  def vite_preload_tag(*sources, crossorigin:, **options)
87
- sources.map { |source|
88
- href = path_to_asset(source)
89
- try(:request).try(:send_early_hints, 'Link' => %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin }))
91
+ asset_paths = sources.map { |source| path_to_asset(source) }
92
+ try(:request).try(
93
+ :send_early_hints,
94
+ 'Link' => asset_paths.map { |href|
95
+ %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin })
96
+ }.join("\n"),
97
+ )
98
+ asset_paths.map { |href|
90
99
  tag.link(rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin, **options)
91
100
  }.join("\n").html_safe
92
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRails
4
- VERSION = '3.0.14'
4
+ VERSION = '3.0.16'
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.14
4
+ version: 3.0.16
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-02-08 00:00:00.000000000 Z
11
+ date: 2023-09-22 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.14/vite_rails
92
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@3.0.14/vite_rails/CHANGELOG.md
91
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@3.0.16/vite_rails
92
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@3.0.16/vite_rails/CHANGELOG.md
93
93
  post_install_message:
94
94
  rdoc_options: []
95
95
  require_paths: