vite_rails_legacy 2.0.3 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -1
- data/lib/tasks/vite.rake +0 -16
- data/lib/vite_rails_legacy/installation.rb +9 -0
- data/lib/vite_rails_legacy/tag_helpers.rb +7 -6
- data/lib/vite_rails_legacy/version.rb +1 -1
- data/templates/entrypoints/application.js +8 -0
- 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: bf3942cf5b2c1298305f69e56f027c89624822259b54b6c9b922e33051c6a473
|
4
|
+
data.tar.gz: f4c4b9e2512d62900d02e1c6777275023f1a7ec295c3352953142da98f9ede57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48f4459682922f42bd4f0808d3a89f97c181594468a5c7883463bf391ea7d2fc27bae3c13d0238ede925f6f2d7e33da3854f05f5e40e9bd178cd100894e88eac
|
7
|
+
data.tar.gz: a00df5ab4e26305f0a6130d057d9b556bfdef646b05b0afc94ced6e11a6603d1bd0ebf820a37f807888b5e4505cb551918f606c5e0710a053bb315742d1ea00c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,46 @@
|
|
1
|
-
## [2.0.
|
1
|
+
## [2.0.8](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.7...vite_rails_legacy@2.0.8) (2021-04-15)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Allow passing additional attributes to scripts and stylesheets. ([edf6019](https://github.com/ElMassimo/vite_ruby/commit/edf6019fa83646e413f36d289eac89bb2f8042a5))
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
## [2.0.7](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.6...vite_rails_legacy@2.0.7) (2021-03-20)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* Simplify installation of build dependencies by using package manager flags ([5c8bb62](https://github.com/ElMassimo/vite_ruby/commit/5c8bb625926f2ab1788a3e3a22aeafd7104984cb))
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
## [2.0.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.5...vite_rails_legacy@2.0.6) (2021-03-19)
|
20
|
+
|
2
21
|
|
22
|
+
### Bug Fixes
|
23
|
+
|
24
|
+
* Typo typecript -> typescript in tag helpers ([#38](https://github.com/ElMassimo/vite_ruby/issues/38)) ([3d375df](https://github.com/ElMassimo/vite_ruby/commit/3d375df8553c8542966ac912a38fe70b7d59ba74))
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## [2.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.4...vite_rails_legacy@2.0.5) (2021-03-18)
|
29
|
+
|
30
|
+
* Add more help text in the example entrypoints ([87d6f14](https://github.com/ElMassimo/vite_ruby/commit/87d6f14a59bba2667089bb952960dce059f36592))
|
31
|
+
|
32
|
+
## [2.0.4](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.3...vite_rails_legacy@2.0.4) (2021-03-18)
|
33
|
+
|
34
|
+
|
35
|
+
### Bug Fixes
|
36
|
+
|
37
|
+
* Using a .jsx extension in a tag helper in development ([a56491b](https://github.com/ElMassimo/vite_ruby/commit/a56491b96720ae537b6b6305aa7efa70cf19e4ee))
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
## [2.0.3](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.2...vite_rails_legacy@2.0.3) (2021-03-07)
|
3
42
|
|
43
|
+
- Add a bounded requirement to `vite_ruby` dependency.
|
4
44
|
|
5
45
|
## ViteRailsLegacy 2.0.2 (2020-02-11)
|
6
46
|
|
data/lib/tasks/vite.rake
CHANGED
@@ -1,20 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Set NODE_ENV before installation, so that Rails installs JS build dependencies
|
4
|
-
# on servers that precompile assets.
|
5
|
-
installation_tasks = ['yarn:install', 'webpacker:yarn_install'].select { |name| Rake::Task.task_defined?(name) }.each do |name|
|
6
|
-
Rake::Task[name].enhance([:'vite_rails:set_node_env'])
|
7
|
-
end
|
8
|
-
|
9
|
-
# Ensure dependencies are installed in older versions of Rails
|
10
|
-
Rake::Task['assets:precompile']&.enhance([:'vite:install_dependencies']) if installation_tasks.none?
|
11
|
-
|
12
3
|
require 'vite_ruby'
|
13
4
|
ViteRuby.install_tasks
|
14
|
-
|
15
|
-
namespace :vite_rails do
|
16
|
-
desc 'Fixes Rails management of node dev dependencies (build dependencies)'
|
17
|
-
task :set_node_env do
|
18
|
-
ENV['NODE_ENV'] = 'development'
|
19
|
-
end
|
20
|
-
end
|
@@ -25,6 +25,15 @@ module ViteRailsLegacy::Installation
|
|
25
25
|
inject_line_before layout_file, '</head>', <<-HTML
|
26
26
|
<%= vite_client_tag %>
|
27
27
|
<%= vite_javascript_tag 'application' %>
|
28
|
+
<!--
|
29
|
+
If using a TypeScript entrypoint file:
|
30
|
+
vite_typescript_tag 'application'
|
31
|
+
|
32
|
+
If using a .jsx or .tsx entrypoint, add the extension:
|
33
|
+
vite_javascript_tag 'application.jsx'
|
34
|
+
|
35
|
+
Visit the guide for more information: https://vite-ruby.netlify.app/guide/rails
|
36
|
+
-->
|
28
37
|
HTML
|
29
38
|
end
|
30
39
|
end
|
@@ -24,17 +24,18 @@ module ViteRailsLegacy::TagHelpers
|
|
24
24
|
skip_preload_tags: false,
|
25
25
|
skip_style_tags: false,
|
26
26
|
crossorigin: 'anonymous',
|
27
|
+
media: 'screen',
|
27
28
|
**options)
|
28
29
|
entries = vite_manifest.resolve_entries(*names, type: asset_type)
|
29
|
-
tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, **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
|
30
|
+
tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, extname: false, **options)
|
31
|
+
tags << vite_preload_tag(*entries.fetch(:imports), crossorigin: crossorigin, **options) unless skip_preload_tags
|
32
|
+
tags << stylesheet_link_tag(*entries.fetch(:stylesheets), media: media, crossorigin: crossorigin, **options) unless skip_style_tags
|
32
33
|
tags
|
33
34
|
end
|
34
35
|
|
35
36
|
# Public: Renders a <script> tag for the specified Vite entrypoints.
|
36
37
|
def vite_typescript_tag(*names, **options)
|
37
|
-
vite_javascript_tag(*names, asset_type: :typescript,
|
38
|
+
vite_javascript_tag(*names, asset_type: :typescript, **options)
|
38
39
|
end
|
39
40
|
|
40
41
|
# Public: Renders a <link> tag for the specified Vite entrypoints.
|
@@ -51,11 +52,11 @@ private
|
|
51
52
|
end
|
52
53
|
|
53
54
|
# Internal: Renders a modulepreload link tag.
|
54
|
-
def vite_preload_tag(*sources, crossorigin
|
55
|
+
def vite_preload_tag(*sources, crossorigin:, **options)
|
55
56
|
sources.map { |source|
|
56
57
|
href = path_to_asset(source)
|
57
58
|
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)
|
59
|
+
tag('link', rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin, **options)
|
59
60
|
}.join("\n").html_safe
|
60
61
|
end
|
61
62
|
end
|
@@ -5,6 +5,14 @@
|
|
5
5
|
// <%= vite_javascript_tag 'application' %>
|
6
6
|
console.log('Vite ⚡️ Rails')
|
7
7
|
|
8
|
+
// If using a TypeScript entrypoint file:
|
9
|
+
// <%= vite_typescript_tag 'application.jsx' %>
|
10
|
+
//
|
11
|
+
// If you want to use .jsx or .tsx, add the extension:
|
12
|
+
// <%= vite_javascript_tag 'application.jsx' %>
|
13
|
+
|
14
|
+
console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails')
|
15
|
+
|
8
16
|
// Example: Load Rails libraries in Vite.
|
9
17
|
//
|
10
18
|
// import '@rails/ujs'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vite_rails_legacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
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-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -61,8 +61,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
61
61
|
licenses:
|
62
62
|
- MIT
|
63
63
|
metadata:
|
64
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@2.0.
|
65
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@2.0.
|
64
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@2.0.8/vite_rails_legacy
|
65
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@2.0.8/vite_rails_legacy/CHANGELOG.md
|
66
66
|
post_install_message:
|
67
67
|
rdoc_options: []
|
68
68
|
require_paths:
|