vite_rails 2.0.5 → 2.0.10

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: 8abb492c94977c4ce3b0fa8412a6d25fa3fe73b8b5bce3e1736233b7daafecd4
4
- data.tar.gz: d9846171170239c19634ab50d3a0eab7840ad305f94cded2c49cc5b6ea9a5af6
3
+ metadata.gz: e31434004c6d618baf4a5e77f3c0dffd7d48271d74ffffb066b2974ce7123c45
4
+ data.tar.gz: b0af4abb6a6ab8da8cb94a1eb777573b08ae274cf8411692fce3a1dc4b02c73c
5
5
  SHA512:
6
- metadata.gz: d9273818122428faf644437362cdb3951c4dc733c9935e70491b2effcdf1c2544b0e5ff78702d827413d4ba1e18fbb029d013c33bb5c39ca29711d7094faba33
7
- data.tar.gz: ebef265a9c4d210451a757fe8ac99c01dbd7134c56e6d0587bb7649a7866fc5f810adc1a24f4cfb9b0bfa3f283039b8dddfd4071579b9568a7bab5c0e251c258
6
+ metadata.gz: a95a0a352671cdb70e48e9662af9aa4be85825840812185c8fb5362b82b2e365b571a9c1fcf41a0deb6c40fad328035a16f25ee2280cb5e063f6872942388908
7
+ data.tar.gz: 8d47687979934033c777b1ccf2658fd8b1a9dd067e4ae09c7abe7ef1105e4f717c821c8f19db69b4e2875b659259d488f2b4830955764ff3e394623bfb1eb5f2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ ## [2.0.10](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.9...vite_rails@2.0.10) (2021-04-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add helpers to enable HMR when using @vitejs/plugin-react-refresh ([a80f286](https://github.com/ElMassimo/vite_ruby/commit/a80f286d4305bbae29ea7cea42a4329a530f43fa))
7
+
8
+
9
+
10
+ ## [2.0.9](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.8...vite_rails@2.0.9) (2021-04-15)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Allow passing additional attributes to scripts and stylesheets. ([edf6019](https://github.com/ElMassimo/vite_ruby/commit/edf6019fa83646e413f36d289eac89bb2f8042a5))
16
+
17
+
18
+
19
+ ## [2.0.8](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.7...vite_rails@2.0.8) (2021-03-20)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * Simplify installation of build dependencies by using package manager flags ([5c8bb62](https://github.com/ElMassimo/vite_ruby/commit/5c8bb625926f2ab1788a3e3a22aeafd7104984cb))
25
+
26
+
27
+
28
+ ## [2.0.7](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.6...vite_rails@2.0.7) (2021-03-19)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * Typo typecript -> typescript in tag helpers ([#38](https://github.com/ElMassimo/vite_ruby/issues/38)) ([3d375df](https://github.com/ElMassimo/vite_ruby/commit/3d375df8553c8542966ac912a38fe70b7d59ba74))
34
+
35
+
36
+
37
+ ## [2.0.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.5...vite_rails@2.0.6) (2021-03-18)
38
+
39
+ * Add more help text in the example entrypoints ([87d6f14](https://github.com/ElMassimo/vite_ruby/commit/87d6f14a59bba2667089bb952960dce059f36592))
40
+
1
41
  ## [2.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.4...vite_rails@2.0.5) (2021-03-18)
2
42
 
3
43
 
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
@@ -44,6 +44,15 @@ module ViteRails::Installation
44
44
  inject_line_before layout_file, '</head>', <<-HTML
45
45
  <%= vite_client_tag %>
46
46
  <%= vite_javascript_tag 'application' %>
47
+ <!--
48
+ If using a TypeScript entrypoint file:
49
+ vite_typescript_tag 'application'
50
+
51
+ If using a .jsx or .tsx entrypoint, add the extension:
52
+ vite_javascript_tag 'application.jsx'
53
+
54
+ Visit the guide for more information: https://vite-ruby.netlify.app/guide/rails
55
+ -->
47
56
  HTML
48
57
  end
49
58
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRails
4
- VERSION = '2.0.5'
4
+ VERSION = '2.0.10'
5
5
  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
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.10
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-03-18 00:00:00.000000000 Z
11
+ date: 2021-04-21 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.5/vite_rails
85
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.5/vite_rails/CHANGELOG.md
84
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@2.0.10/vite_rails
85
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.10/vite_rails/CHANGELOG.md
86
86
  post_install_message:
87
87
  rdoc_options: []
88
88
  require_paths: