vite_rails 3.0.14 → 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 +2 -80
- data/README.md +1 -1
- data/lib/tasks/vite.rake +0 -1
- data/lib/vite_rails/config.rb +1 -4
- data/lib/vite_rails/{cli.rb → installation.rb} +2 -20
- data/lib/vite_rails/tag_helpers.rb +28 -26
- data/lib/vite_rails/version.rb +1 -1
- metadata +10 -16
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,87 +1,9 @@
|
|
1
|
-
|
1
|
+
# [](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.5...vite_rails@) (2022-01-18)
|
2
2
|
|
3
3
|
|
4
4
|
### Features
|
5
5
|
|
6
|
-
*
|
7
|
-
* make vite_client_tag crossorigin: "anonymous" by default ([404a15a](https://github.com/ElMassimo/vite_ruby/commit/404a15a70c9d4fcd774735045c0d58d3e2aa37f2))
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
## [3.0.13](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.12...vite_rails@3.0.13) (2022-11-13)
|
12
|
-
|
13
|
-
|
14
|
-
### Bug Fixes
|
15
|
-
|
16
|
-
* avoid removing double extension for non-preprocessor assets ([#301](https://github.com/ElMassimo/vite_ruby/issues/301)) ([2024f62](https://github.com/ElMassimo/vite_ruby/commit/2024f62af917cabcb817c32a5fbbe709d477c19f))
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
## [3.0.12](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.11...vite_rails@3.0.12) (2022-08-12)
|
21
|
-
|
22
|
-
|
23
|
-
### Bug Fixes
|
24
|
-
|
25
|
-
* ensure rails app is initialized before inferring config ([#240](https://github.com/ElMassimo/vite_ruby/issues/240)) ([3ddc2bc](https://github.com/ElMassimo/vite_ruby/commit/3ddc2bc7873f06b6dd8e58e7c6b4e8a7fd8833f1))
|
26
|
-
|
27
|
-
|
28
|
-
### Features
|
29
|
-
|
30
|
-
* allow framework-specific libraries to extend the CLI ([a0ed66f](https://github.com/ElMassimo/vite_ruby/commit/a0ed66fe64fb2549cecc358ccd60c82be44255aa))
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
## [3.0.11](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.10...vite_rails@3.0.11) (2022-08-11)
|
35
|
-
|
36
|
-
|
37
|
-
### Bug Fixes
|
38
|
-
|
39
|
-
* use javascript_include_tag in vite_client_tag ([#238](https://github.com/ElMassimo/vite_ruby/issues/238)) ([3d8b366](https://github.com/ElMassimo/vite_ruby/commit/3d8b3668b2f43dacbaf09127fa67a27767e03ffe))
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
## [3.0.10](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.9...vite_rails@3.0.10) (2022-06-15)
|
44
|
-
|
45
|
-
|
46
|
-
### Bug Fixes
|
47
|
-
|
48
|
-
* symbol error on rake enhance call ([#218](https://github.com/ElMassimo/vite_ruby/issues/218)) ([5507156](https://github.com/ElMassimo/vite_ruby/commit/550715624ceb39e1ea5e845e73dcaf5557caa66f))
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
## [3.0.9](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.8...vite_rails@3.0.9) (2022-04-29)
|
53
|
-
|
54
|
-
|
55
|
-
### Features
|
56
|
-
|
57
|
-
* add vite_asset_url helper ([#208](https://github.com/ElMassimo/vite_ruby/issues/208)) ([d269793](https://github.com/ElMassimo/vite_ruby/commit/d2697934b5a866ea5b14588b650a00dfe88454a3))
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
## [3.0.8](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.7...vite_rails@3.0.8) (2022-04-14)
|
62
|
-
|
63
|
-
|
64
|
-
### Bug Fixes
|
65
|
-
|
66
|
-
* prevent error when using a proc in asset_host (close [#202](https://github.com/ElMassimo/vite_ruby/issues/202)) ([#203](https://github.com/ElMassimo/vite_ruby/issues/203)) ([cb23a81](https://github.com/ElMassimo/vite_ruby/commit/cb23a81037651ac01d993935f68cc526ec2c844d))
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
## [3.0.7](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.6...vite_rails@3.0.7) (2022-03-17)
|
71
|
-
|
72
|
-
|
73
|
-
### Bug Fixes
|
74
|
-
|
75
|
-
* load rails environment before rake tasks (close [#193](https://github.com/ElMassimo/vite_ruby/issues/193)) ([72afbc7](https://github.com/ElMassimo/vite_ruby/commit/72afbc7ab5ca33833e9330954499bcf460fd7669))
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
## [3.0.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@3.0.5...vite_rails@3.0.6) (2022-02-04)
|
80
|
-
|
81
|
-
|
82
|
-
### Bug Fixes
|
83
|
-
|
84
|
-
* don't add crossorigin to included stylesheet tags (close [#189](https://github.com/ElMassimo/vite_ruby/issues/189)) ([#190](https://github.com/ElMassimo/vite_ruby/issues/190)) ([575c731](https://github.com/ElMassimo/vite_ruby/commit/575c73192fb485e8844f67b821c856d1a09db8f5))
|
6
|
+
* **experimental:** add support for Subresource Integrity via vite-plugin-manifest-sri ([0b3142c](https://github.com/ElMassimo/vite_ruby/commit/0b3142cd9d569a5f56821f53cdade337779bb0c1))
|
85
7
|
|
86
8
|
|
87
9
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1 align="center">
|
2
2
|
<a href="https://vite-ruby.netlify.app/">
|
3
|
-
<img src="https://raw.githubusercontent.com/ElMassimo/vite_ruby/main/logo.svg" width="120px"/>
|
3
|
+
<img src="https://raw.githubusercontent.com/ElMassimo/vite_ruby/main/docs/public/logo.svg" width="120px"/>
|
4
4
|
</a>
|
5
5
|
|
6
6
|
<br>
|
data/lib/tasks/vite.rake
CHANGED
data/lib/vite_rails/config.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ViteRails::Config
|
4
|
-
private
|
5
|
-
|
6
4
|
# Override: Default values for a Rails application.
|
7
5
|
def config_defaults
|
8
6
|
require 'rails'
|
9
|
-
asset_host = Rails.application&.config&.action_controller&.asset_host
|
10
7
|
super(
|
11
|
-
asset_host:
|
8
|
+
asset_host: Rails.application&.config&.action_controller&.asset_host,
|
12
9
|
mode: Rails.env.to_s,
|
13
10
|
root: Rails.root || Dir.pwd,
|
14
11
|
)
|
@@ -2,26 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'vite_rails'
|
4
4
|
|
5
|
-
module ViteRails::CLI
|
6
|
-
end
|
7
|
-
|
8
|
-
module ViteRails::CLI::Build
|
9
|
-
def call(**options)
|
10
|
-
ensure_rails_init
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
# Internal: Attempts to initialize the Rails application.
|
15
|
-
def ensure_rails_init
|
16
|
-
require File.expand_path('config/environment', Dir.pwd)
|
17
|
-
rescue StandardError, LoadError => error
|
18
|
-
$stderr << "Unable to initialize Rails application before Vite build:\n\n\t#{ error.message }\n\n"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
5
|
# Internal: Extends the base installation script from Vite Ruby to work for a
|
23
6
|
# typical Rails app.
|
24
|
-
module ViteRails::
|
7
|
+
module ViteRails::Installation
|
25
8
|
RAILS_TEMPLATES = Pathname.new(File.expand_path('../../templates', __dir__))
|
26
9
|
|
27
10
|
# Override: Setup a typical apps/web Hanami app to use Vite.
|
@@ -80,5 +63,4 @@ module ViteRails::CLI::Install
|
|
80
63
|
end
|
81
64
|
end
|
82
65
|
|
83
|
-
ViteRuby::CLI::
|
84
|
-
ViteRuby::CLI::Install.prepend(ViteRails::CLI::Install)
|
66
|
+
ViteRuby::CLI::Install.prepend(ViteRails::Installation)
|
@@ -3,10 +3,10 @@
|
|
3
3
|
# Public: Allows to render HTML tags for scripts and styles processed by Vite.
|
4
4
|
module ViteRails::TagHelpers
|
5
5
|
# Public: Renders a script tag for vite/client to enable HMR in development.
|
6
|
-
def vite_client_tag
|
6
|
+
def vite_client_tag
|
7
7
|
return unless src = vite_manifest.vite_client_src
|
8
8
|
|
9
|
-
|
9
|
+
tag.script(src: src, type: 'module')
|
10
10
|
end
|
11
11
|
|
12
12
|
# Public: Renders a script tag to enable HMR with React Refresh.
|
@@ -22,30 +22,30 @@ module ViteRails::TagHelpers
|
|
22
22
|
path_to_asset vite_manifest.path_for(name, **options)
|
23
23
|
end
|
24
24
|
|
25
|
-
# Public: Resolves the url for the specified Vite asset.
|
26
|
-
#
|
27
|
-
# Example:
|
28
|
-
# <%= vite_asset_url 'calendar.css' %> # => "https://example.com/vite/assets/calendar-1016838bab065ae1e122.css"
|
29
|
-
def vite_asset_url(name, **options)
|
30
|
-
url_to_asset vite_manifest.path_for(name, **options)
|
31
|
-
end
|
32
|
-
|
33
25
|
# Public: Renders a <script> tag for the specified Vite entrypoints.
|
34
26
|
def vite_javascript_tag(*names,
|
35
27
|
type: 'module',
|
36
28
|
asset_type: :javascript,
|
29
|
+
integrity: false,
|
37
30
|
skip_preload_tags: false,
|
38
31
|
skip_style_tags: false,
|
39
32
|
crossorigin: 'anonymous',
|
40
33
|
media: 'screen',
|
41
34
|
**options)
|
42
35
|
entries = vite_manifest.resolve_entries(*names, type: asset_type)
|
43
|
-
tags =
|
44
|
-
|
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
|
45
41
|
|
46
|
-
|
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
47
|
|
48
|
-
tags << stylesheet_link_tag(*entries.fetch(:stylesheets), media: media, **options) unless skip_style_tags
|
48
|
+
tags << stylesheet_link_tag(*entries.fetch(:stylesheets), media: media, crossorigin: crossorigin, **options) unless skip_style_tags
|
49
49
|
|
50
50
|
tags
|
51
51
|
end
|
@@ -56,12 +56,12 @@ module ViteRails::TagHelpers
|
|
56
56
|
end
|
57
57
|
|
58
58
|
# Public: Renders a <link> tag for the specified Vite entrypoints.
|
59
|
-
def vite_stylesheet_tag(*names, **options)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
65
65
|
end
|
66
66
|
|
67
67
|
# Public: Renders an <img> tag for the specified Vite asset.
|
@@ -83,11 +83,13 @@ private
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# Internal: Renders a modulepreload link tag.
|
86
|
-
def vite_preload_tag(
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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)
|
92
94
|
end
|
93
95
|
end
|
data/lib/vite_rails/version.rb
CHANGED
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:
|
4
|
+
version: 4.0.0.alpha1
|
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:
|
11
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -34,22 +34,16 @@ dependencies:
|
|
34
34
|
name: vite_ruby
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 3.2.2
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
39
|
+
version: 4.0.0.alpha1
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 3.2.2
|
50
44
|
- - "~>"
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
46
|
+
version: 4.0.0.alpha1
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: spring
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,9 +70,9 @@ files:
|
|
76
70
|
- README.md
|
77
71
|
- lib/tasks/vite.rake
|
78
72
|
- lib/vite_rails.rb
|
79
|
-
- lib/vite_rails/cli.rb
|
80
73
|
- lib/vite_rails/config.rb
|
81
74
|
- lib/vite_rails/engine.rb
|
75
|
+
- lib/vite_rails/installation.rb
|
82
76
|
- lib/vite_rails/tag_helpers.rb
|
83
77
|
- lib/vite_rails/version.rb
|
84
78
|
- templates/Procfile.dev
|
@@ -88,8 +82,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
88
82
|
licenses:
|
89
83
|
- MIT
|
90
84
|
metadata:
|
91
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@
|
92
|
-
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
|
93
87
|
post_install_message:
|
94
88
|
rdoc_options: []
|
95
89
|
require_paths:
|
@@ -101,11 +95,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
95
|
version: '2.5'
|
102
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
97
|
requirements:
|
104
|
-
- - "
|
98
|
+
- - ">"
|
105
99
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
100
|
+
version: 1.3.1
|
107
101
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
102
|
+
rubygems_version: 3.2.32
|
109
103
|
signing_key:
|
110
104
|
specification_version: 4
|
111
105
|
summary: Use Vite in Rails and bring joy to your JavaScript experience
|