vite_rails_legacy 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: 65705cf238af07aab1c1ddd9ec74d5749d65ecce0f215099615788a446cb4a0c
4
- data.tar.gz: 70aa01f47d3d38540f646bbd0763bdb5f8d39d2ddc9a46df7a3c0b0c370400ba
3
+ metadata.gz: 6e5a4eb4664f9457a5ec58fc2593add95372b0e67412f90f73a804686de4ac0f
4
+ data.tar.gz: ae8ad4182384a88f3656165acd6e84bff59d162675f875d1bccf666fd0886cdb
5
5
  SHA512:
6
- metadata.gz: bf0f6807dd11d46b3a79fd7c5e86241de3470bb463ab1e888023902d59ed0b7931456413685d59c779e97ed0b8413c3c808d8c5e5d141918d5e5ffb61bdb9596
7
- data.tar.gz: cfa784d431774178424e8ce7a5b9904bacfdbfab7f8b9580845ae3d4cddfa2c5bb34ec0b89b1a90973c3ecea3ca2c7ede6450228be421bd28f4b814dfd89e886
6
+ metadata.gz: f2ccf8d3920c1c7cd9ab03971a7730a55219e608076a100e7a26937e4ca383e5520dab71fde5f9b4050393320efd2f7e50818fe6a2914207662c57250bfe6541
7
+ data.tar.gz: 062505176534e3b3fcd66824e124804260b38f3f17386f7660fc3bfc54fcab2278befa3c813641c78015d73509951c5a599c9bf23195046cb8cdfd2742f220d7
data/CHANGELOG.md CHANGED
@@ -1,6 +1,46 @@
1
- ## [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)
1
+ ## [2.0.10](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.9...vite_rails_legacy@2.0.10) (2021-05-10)
2
+
3
+
4
+
5
+ ## [2.0.9](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.8...vite_rails_legacy@2.0.9) (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.8](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.7...vite_rails_legacy@2.0.8) (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
+
21
+
2
22
 
23
+ ## [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)
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.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.5...vite_rails_legacy@2.0.6) (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.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.4...vite_rails_legacy@2.0.5) (2021-03-18)
3
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.4](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.3...vite_rails_legacy@2.0.4) (2021-03-18)
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
@@ -11,7 +11,7 @@ module ViteRailsLegacy::Installation
11
11
  def setup_app_files
12
12
  cp RAILS_TEMPLATES.join('config/rails-vite.json'), config.config_path
13
13
  if root.join('app/javascript').exist?
14
- Dry::CLI::Utils::Files.replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "app/javascript",)
14
+ replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "app/javascript",)
15
15
  end
16
16
  end
17
17
 
@@ -9,6 +9,11 @@ module ViteRailsLegacy::TagHelpers
9
9
  "<script#{ tag_options({ src: src, type: 'module' }, escape: true) }></script>".html_safe
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 ViteRailsLegacy::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 ViteRailsLegacy
4
- VERSION = '2.0.5'
4
+ VERSION = '2.0.10'
5
5
  end
@@ -6,7 +6,7 @@
6
6
  console.log('Vite ⚡️ Rails')
7
7
 
8
8
  // If using a TypeScript entrypoint file:
9
- // <%= vite_typecript_tag 'application.jsx' %>
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_legacy
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-05-10 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.5/vite_rails_legacy
65
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@2.0.5/vite_rails_legacy/CHANGELOG.md
64
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@2.0.10/vite_rails_legacy
65
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@2.0.10/vite_rails_legacy/CHANGELOG.md
66
66
  post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths: