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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/vite_rails/tag_helpers.rb +28 -11
- data/lib/vite_rails/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b468faa93a51c963d70a987a45f6dbb605c3854dd9ec188d40f0a93c085508d5
|
4
|
+
data.tar.gz: a04b6b5f89227b70c1d82e3a649ee1b6d423beedc1e1408126528962ba2962a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
36
|
-
|
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
|
-
|
49
|
-
|
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(
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
data/lib/vite_rails/version.rb
CHANGED
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:
|
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:
|
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:
|
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@
|
86
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@
|
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:
|
100
|
+
version: 1.3.1
|
101
101
|
requirements: []
|
102
102
|
rubygems_version: 3.2.32
|
103
103
|
signing_key:
|