vite_rails 2.0.6 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -1
- data/lib/tasks/vite.rake +0 -13
- data/lib/vite_rails/installation.rb +1 -1
- data/lib/vite_rails/tag_helpers.rb +10 -4
- data/lib/vite_rails/version.rb +1 -1
- data/templates/entrypoints/application.js +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196df1f83a2f6508ee1e8359514be727d98f43f664fdabd66115e16b9093581b
|
4
|
+
data.tar.gz: 6f1dd12925e16250bb92852294107deb234821b67a252e73eb2025d60a8012e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2005d4ab00353cde534027f0b97d372d86786f1dc57b5f73d7c3bcd2e62ac26bc0acd210f103d38cc617fd9eee6b264b0ba8b8edc2916fbf83100af760a8ced7
|
7
|
+
data.tar.gz: 6ed632c3fc2ae1b3b76867fcc8c15d5eab63622e57bba0e7b0e865bba8b87a814bb0518a879d477b77afe772cf3a9511baa6787e6488d5a31cc98548915dc5de
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,46 @@
|
|
1
|
-
## [2.0.
|
1
|
+
## [2.0.11](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.10...vite_rails@2.0.11) (2021-05-10)
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
## [2.0.10](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.9...vite_rails@2.0.10) (2021-04-21)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* Add helpers to enable HMR when using @vitejs/plugin-react-refresh ([a80f286](https://github.com/ElMassimo/vite_ruby/commit/a80f286d4305bbae29ea7cea42a4329a530f43fa))
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [2.0.9](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.8...vite_rails@2.0.9) (2021-04-15)
|
15
|
+
|
16
|
+
|
17
|
+
### Bug Fixes
|
18
|
+
|
19
|
+
* Allow passing additional attributes to scripts and stylesheets. ([edf6019](https://github.com/ElMassimo/vite_ruby/commit/edf6019fa83646e413f36d289eac89bb2f8042a5))
|
20
|
+
|
2
21
|
|
3
22
|
|
23
|
+
## [2.0.8](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.7...vite_rails@2.0.8) (2021-03-20)
|
24
|
+
|
25
|
+
|
26
|
+
### Bug Fixes
|
27
|
+
|
28
|
+
* Simplify installation of build dependencies by using package manager flags ([5c8bb62](https://github.com/ElMassimo/vite_ruby/commit/5c8bb625926f2ab1788a3e3a22aeafd7104984cb))
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
## [2.0.7](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.6...vite_rails@2.0.7) (2021-03-19)
|
33
|
+
|
34
|
+
|
35
|
+
### Bug Fixes
|
36
|
+
|
37
|
+
* Typo typecript -> typescript in tag helpers ([#38](https://github.com/ElMassimo/vite_ruby/issues/38)) ([3d375df](https://github.com/ElMassimo/vite_ruby/commit/3d375df8553c8542966ac912a38fe70b7d59ba74))
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
## [2.0.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.5...vite_rails@2.0.6) (2021-03-18)
|
42
|
+
|
43
|
+
* Add more help text in the example entrypoints ([87d6f14](https://github.com/ElMassimo/vite_ruby/commit/87d6f14a59bba2667089bb952960dce059f36592))
|
4
44
|
|
5
45
|
## [2.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.4...vite_rails@2.0.5) (2021-03-18)
|
6
46
|
|
data/lib/tasks/vite.rake
CHANGED
@@ -2,16 +2,3 @@
|
|
2
2
|
|
3
3
|
require 'vite_ruby'
|
4
4
|
ViteRuby.install_tasks
|
5
|
-
|
6
|
-
namespace :vite_rails do
|
7
|
-
desc 'Fixes Rails management of node dev dependencies (build dependencies)'
|
8
|
-
task :set_node_env do
|
9
|
-
ENV['NODE_ENV'] = 'development'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
# Set NODE_ENV before installation, so that Rails installs JS build dependencies
|
14
|
-
# on servers that precompile assets.
|
15
|
-
['yarn:install', 'webpacker:yarn_install'].each do |name|
|
16
|
-
Rake::Task[name].enhance([:'vite_rails:set_node_env']) if Rake::Task.task_defined?(name)
|
17
|
-
end
|
@@ -11,7 +11,7 @@ module ViteRails::Installation
|
|
11
11
|
def setup_app_files
|
12
12
|
cp RAILS_TEMPLATES.join('config/rails-vite.json'), config.config_path
|
13
13
|
if dir = %w[app/javascript app/packs].find { |path| root.join(path).exist? }
|
14
|
-
|
14
|
+
replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "#{ dir }",)
|
15
15
|
end
|
16
16
|
setup_content_security_policy root.join('config/initializers/content_security_policy.rb')
|
17
17
|
end
|
@@ -9,6 +9,11 @@ module ViteRails::TagHelpers
|
|
9
9
|
tag.script(src: src, type: 'module')
|
10
10
|
end
|
11
11
|
|
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
|
15
|
+
end
|
16
|
+
|
12
17
|
# Public: Resolves the path for the specified Vite asset.
|
13
18
|
#
|
14
19
|
# Example:
|
@@ -24,11 +29,12 @@ module ViteRails::TagHelpers
|
|
24
29
|
skip_preload_tags: false,
|
25
30
|
skip_style_tags: false,
|
26
31
|
crossorigin: 'anonymous',
|
32
|
+
media: 'screen',
|
27
33
|
**options)
|
28
34
|
entries = vite_manifest.resolve_entries(*names, type: asset_type)
|
29
35
|
tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, extname: false, **options)
|
30
|
-
tags << vite_preload_tag(*entries.fetch(:imports), crossorigin: crossorigin) unless skip_preload_tags
|
31
|
-
tags << stylesheet_link_tag(*entries.fetch(:stylesheets)) unless skip_style_tags
|
36
|
+
tags << vite_preload_tag(*entries.fetch(:imports), crossorigin: crossorigin, **options) unless skip_preload_tags
|
37
|
+
tags << stylesheet_link_tag(*entries.fetch(:stylesheets), media: media, crossorigin: crossorigin, **options) unless skip_style_tags
|
32
38
|
tags
|
33
39
|
end
|
34
40
|
|
@@ -51,11 +57,11 @@ private
|
|
51
57
|
end
|
52
58
|
|
53
59
|
# Internal: Renders a modulepreload link tag.
|
54
|
-
def vite_preload_tag(*sources, crossorigin
|
60
|
+
def vite_preload_tag(*sources, crossorigin:, **options)
|
55
61
|
sources.map { |source|
|
56
62
|
href = path_to_asset(source)
|
57
63
|
try(:request).try(:send_early_hints, 'Link' => %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin }))
|
58
|
-
tag.link(rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin)
|
64
|
+
tag.link(rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin, **options)
|
59
65
|
}.join("\n").html_safe
|
60
66
|
end
|
61
67
|
end
|
data/lib/vite_rails/version.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
console.log('Vite ⚡️ Rails')
|
7
7
|
|
8
8
|
// If using a TypeScript entrypoint file:
|
9
|
-
// <%=
|
9
|
+
// <%= vite_typescript_tag 'application.jsx' %>
|
10
10
|
//
|
11
11
|
// If you want to use .jsx or .tsx, add the extension:
|
12
12
|
// <%= vite_javascript_tag 'application.jsx' %>
|
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: 2.0.
|
4
|
+
version: 2.0.11
|
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: 2021-
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -81,8 +81,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
81
81
|
licenses:
|
82
82
|
- MIT
|
83
83
|
metadata:
|
84
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@2.0.
|
85
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.
|
84
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@2.0.11/vite_rails
|
85
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.11/vite_rails/CHANGELOG.md
|
86
86
|
post_install_message:
|
87
87
|
rdoc_options: []
|
88
88
|
require_paths:
|