vite_rails 3.0.5 → 4.0.0.alpha1

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: c87996666ec3539001f3df454f8dbd7d7b20acd6cdc231f5bcfef06d763280b0
4
- data.tar.gz: c80aa99a365b9fc8208453ec3d07587b5b98524306cbaeaac6bd5c1e46859184
3
+ metadata.gz: b468faa93a51c963d70a987a45f6dbb605c3854dd9ec188d40f0a93c085508d5
4
+ data.tar.gz: a04b6b5f89227b70c1d82e3a649ee1b6d423beedc1e1408126528962ba2962a0
5
5
  SHA512:
6
- metadata.gz: 7d9fd4ee0e5927cc15f8d9857a747e0222613fdbbb06c6ace6a13bdbe88084848d19471baf70e8d3c59ad63222ecda6832d8245bf64f82baf03348eddbf840d5
7
- data.tar.gz: 749a3fb089e0b40f615305eddd63c12249e1b7f5406fc2afd8a7533cda2fd389a3a66addf3ba01cb05eb193236d995711fd66252f725a4c7a65b09a41f5a79d1
6
+ metadata.gz: 5d5d14601db1a186747566549bd620c1d6c534fe111a2dd9712694743ae3ba691200c56628f1a9fd08c0edbbce68da81ecd28d7e338b8fac215f2bf4b1c99373
7
+ data.tar.gz: 305be4fa2c036e0b8ef509b38fb50985f7c3a8ff8caedc608b919b436a048ffe1d06c5a136a0183ebd80faf5946882ae0a76814eac809e017477c22f7bcbbe24
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.5...vite_rails@) (2022-01-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * **experimental:** add support for Subresource Integrity via vite-plugin-manifest-sri ([0b3142c](https://github.com/ElMassimo/vite_ruby/commit/0b3142cd9d569a5f56821f53cdade337779bb0c1))
7
+
8
+
9
+
1
10
  ## [3.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.4...vite_rails@3.0.5) (2022-01-18)
2
11
 
3
12
 
@@ -26,15 +26,27 @@ module ViteRails::TagHelpers
26
26
  def vite_javascript_tag(*names,
27
27
  type: 'module',
28
28
  asset_type: :javascript,
29
+ integrity: false,
29
30
  skip_preload_tags: false,
30
31
  skip_style_tags: false,
31
32
  crossorigin: 'anonymous',
32
33
  media: 'screen',
33
34
  **options)
34
35
  entries = vite_manifest.resolve_entries(*names, type: asset_type)
35
- tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, extname: false, **options)
36
- tags << vite_preload_tag(*entries.fetch(:imports), crossorigin: crossorigin, **options) unless skip_preload_tags
36
+ tags = ''.html_safe
37
+
38
+ entries.fetch(:main).each do |src, attrs|
39
+ tags << javascript_include_tag(src, crossorigin: crossorigin, type: type, extname: false, **attrs, **options)
40
+ end
41
+
42
+ unless skip_preload_tags
43
+ entries.fetch(:imports).each do |href, attrs|
44
+ tags << vite_preload_tag(href, crossorigin: crossorigin, **attrs, **options)
45
+ end
46
+ end
47
+
37
48
  tags << stylesheet_link_tag(*entries.fetch(:stylesheets), media: media, crossorigin: crossorigin, **options) unless skip_style_tags
49
+
38
50
  tags
39
51
  end
40
52
 
@@ -44,9 +56,12 @@ module ViteRails::TagHelpers
44
56
  end
45
57
 
46
58
  # Public: Renders a <link> tag for the specified Vite entrypoints.
47
- def vite_stylesheet_tag(*names, **options)
48
- style_paths = names.map { |name| vite_asset_path(name, type: :stylesheet) }
49
- stylesheet_link_tag(*style_paths, **options)
59
+ def vite_stylesheet_tag(*names, integrity: false, **options)
60
+ ''.html_safe.tap do |tags|
61
+ vite_manifest.resolve_entries(*names, type: :stylesheet).fetch(:main).each do |href, attrs|
62
+ tags << stylesheet_link_tag(href, **attrs, **options)
63
+ end
64
+ end
50
65
  end
51
66
 
52
67
  # Public: Renders an <img> tag for the specified Vite asset.
@@ -68,11 +83,13 @@ private
68
83
  end
69
84
 
70
85
  # Internal: Renders a modulepreload link tag.
71
- def vite_preload_tag(*sources, crossorigin:, **options)
72
- sources.map { |source|
73
- href = path_to_asset(source)
74
- try(:request).try(:send_early_hints, 'Link' => %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin }))
75
- tag.link(rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin, **options)
76
- }.join("\n").html_safe
86
+ def vite_preload_tag(source, crossorigin:, **options)
87
+ href = path_to_asset(source)
88
+ try(:request).try(:send_early_hints, 'Link' => %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin }).tap { |hint|
89
+ if integrity = options[:integrity]
90
+ hint << "; integrity: #{ integrity }"
91
+ end
92
+ })
93
+ tag.link(rel: 'modulepreload', href: href, as: 'script', type: 'module', crossorigin: crossorigin, **options)
77
94
  end
78
95
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRails
4
- VERSION = '3.0.5'
4
+ VERSION = '4.0.0.alpha1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 4.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '3.0'
39
+ version: 4.0.0.alpha1
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '3.0'
46
+ version: 4.0.0.alpha1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: spring
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -82,8 +82,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
82
82
  licenses:
83
83
  - MIT
84
84
  metadata:
85
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@3.0.5/vite_rails
86
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@3.0.5/vite_rails/CHANGELOG.md
85
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@4.0.0.alpha1/vite_rails
86
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@4.0.0.alpha1/vite_rails/CHANGELOG.md
87
87
  post_install_message:
88
88
  rdoc_options: []
89
89
  require_paths:
@@ -95,9 +95,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  version: '2.5'
96
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ">="
98
+ - - ">"
99
99
  - !ruby/object:Gem::Version
100
- version: '0'
100
+ version: 1.3.1
101
101
  requirements: []
102
102
  rubygems_version: 3.2.32
103
103
  signing_key: