vite_rails_legacy 3.0.5 → 3.1.0

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: 40f3eac22ded3c1aa51f8df2f9f358fd6ca22d4a161da559e5d3ce88a989ffa7
4
- data.tar.gz: a1ecde2de7ffb38d832e88e3a35357bf36c7360c7edb7c196fa7a09582d9bf8e
3
+ metadata.gz: 1039841e84fe521267ebea3233102d6153dc3890ca8f07c882f1eb2143e4c307
4
+ data.tar.gz: 1de43a51b7ab11124afef02ea784d2b5f0871bbfc4ad10a5167e33019dce0927
5
5
  SHA512:
6
- metadata.gz: c7ea3513568e709000f49ae9bebcb810accb1155017a3543e1af741887a3841c21c98485957066da0afac75a00332f1114b308dc0c92bb0b749cc88a8c4049c6
7
- data.tar.gz: 66f7ebc27e416121c9ff6dc7036f3100ebacb23a829bbcca818bf1f3df2e1f258e0b7e068534808c2bac1fa4bdbc4ea343bbae3d420f796f1847f10385382325
6
+ metadata.gz: e0841767bac11afadf2f764601f555bf90f378800f5d2ed33e7eeda7227245e60eade0f605c1197bffe9a0d237795429278d4fe4bbfd463773db6472f7103bc6
7
+ data.tar.gz: b5805e3cfaa7475c7da405e359355a21842b25c7ac70131b76eacd4ea80db6cf37b05f0d23d1a6332ff4dd3e3049af070a6322c652f32b7538e2f8516cbd43e2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # [3.1.0](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@3.0.5...vite_rails_legacy@3.1.0) (2024-11-06)
2
+
3
+
4
+
1
5
  ## [3.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@3.0.4...vite_rails_legacy@3.0.5) (2022-04-29)
2
6
 
3
7
 
data/lib/tasks/vite.rake CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'vite_ruby'
3
+ require "vite_ruby"
4
4
  ViteRuby.install_tasks
@@ -3,7 +3,7 @@
3
3
  module ViteRailsLegacy::Config
4
4
  # Override: Default values for a Rails application.
5
5
  def config_defaults
6
- require 'rails'
6
+ require "rails"
7
7
  asset_host = Rails.application&.config&.action_controller&.asset_host
8
8
  super(
9
9
  asset_host: asset_host.is_a?(Proc) ? nil : asset_host,
@@ -13,5 +13,5 @@ module ViteRailsLegacy::Config
13
13
  end
14
14
  end
15
15
 
16
- require 'active_support/core_ext/hash'
16
+ require "active_support/core_ext/hash"
17
17
  ViteRuby::Config.singleton_class.prepend(ViteRailsLegacy::Config)
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails/railtie'
3
+ require "rails/railtie"
4
4
 
5
5
  class ViteRailsLegacy::Engine < Rails::Engine
6
- initializer 'vite_rails.proxy' do |app|
7
- app.middleware.insert_before 0, 'ViteRuby::DevServerProxy', ssl_verify_none: true if ViteRuby.run_proxy?
6
+ initializer "vite_rails.proxy" do |app|
7
+ app.middleware.insert_before 0, "ViteRuby::DevServerProxy", ssl_verify_none: true if ViteRuby.run_proxy?
8
8
  end
9
9
 
10
- initializer 'vite_rails_legacy.helper' do
10
+ initializer "vite_rails_legacy.helper" do
11
11
  ActiveSupport.on_load(:action_controller) do
12
12
  ActionController::Base.helper(ViteRailsLegacy::TagHelpers)
13
13
  end
@@ -17,17 +17,17 @@ class ViteRailsLegacy::Engine < Rails::Engine
17
17
  end
18
18
  end
19
19
 
20
- initializer 'vite_rails.logger' do
20
+ initializer "vite_rails.logger" do
21
21
  config.after_initialize do
22
22
  ViteRuby.instance.logger = Rails.logger
23
23
  end
24
24
  end
25
25
 
26
- initializer 'vite_rails.bootstrap' do
26
+ initializer "vite_rails.bootstrap" do
27
27
  if defined?(Rails::Server) || defined?(Rails::Console)
28
28
  ViteRuby.bootstrap
29
29
  if defined?(Spring)
30
- require 'spring/watcher'
30
+ require "spring/watcher"
31
31
  Spring.after_fork { ViteRuby.bootstrap }
32
32
  Spring.watch(ViteRuby.config.config_path)
33
33
  end
@@ -1,28 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'vite_rails_legacy'
3
+ require "vite_rails_legacy"
4
4
 
5
5
  # Internal: Extends the base installation script from Vite Ruby to work for a
6
6
  # typical Rails app.
7
7
  module ViteRailsLegacy::Installation
8
- RAILS_TEMPLATES = Pathname.new(File.expand_path('../../templates', __dir__))
8
+ RAILS_TEMPLATES = Pathname.new(File.expand_path("../../templates", __dir__))
9
9
 
10
10
  # Override: Setup a typical apps/web Hanami app to use Vite.
11
11
  def setup_app_files
12
- cp RAILS_TEMPLATES.join('config/rails-vite.json'), config.config_path
13
- if root.join('app/javascript').exist?
14
- replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "app/javascript",)
12
+ cp RAILS_TEMPLATES.join("config/rails-vite.json"), config.config_path
13
+ if root.join("app/javascript").exist?
14
+ replace_first_line config.config_path, "app/frontend", %( "sourceCodeDir": "app/javascript",)
15
15
  end
16
16
  end
17
17
 
18
18
  # Override: Create a sample JS file and attempt to inject it in an HTML template.
19
19
  def install_sample_files
20
- unless config.resolved_entrypoints_dir.join('application.js').exist?
21
- cp RAILS_TEMPLATES.join('entrypoints/application.js'), config.resolved_entrypoints_dir.join('application.js')
20
+ unless config.resolved_entrypoints_dir.join("application.js").exist?
21
+ cp RAILS_TEMPLATES.join("entrypoints/application.js"), config.resolved_entrypoints_dir.join("application.js")
22
22
  end
23
23
 
24
- if (layout_file = root.join('app/views/layouts/application.html.erb')).exist?
25
- inject_line_before layout_file, '</head>', <<-HTML
24
+ if (layout_file = root.join("app/views/layouts/application.html.erb")).exist?
25
+ inject_line_before layout_file, "</head>", <<-HTML
26
26
  <%= vite_client_tag %>
27
27
  <%= vite_javascript_tag 'application' %>
28
28
  <!--
@@ -6,7 +6,7 @@ module ViteRailsLegacy::TagHelpers
6
6
  def vite_client_tag
7
7
  return unless src = vite_manifest.vite_client_src
8
8
 
9
- "<script#{ tag_options({ src: src, type: 'module' }, escape: true) }></script>".html_safe
9
+ "<script#{tag_options({src: src, type: "module"}, escape: true)}></script>".html_safe
10
10
  end
11
11
 
12
12
  # Public: Renders a script tag to enable HMR with React Refresh.
@@ -32,13 +32,13 @@ module ViteRailsLegacy::TagHelpers
32
32
 
33
33
  # Public: Renders a <script> tag for the specified Vite entrypoints.
34
34
  def vite_javascript_tag(*names,
35
- type: 'module',
36
- asset_type: :javascript,
37
- skip_preload_tags: false,
38
- skip_style_tags: false,
39
- crossorigin: 'anonymous',
40
- media: 'screen',
41
- **options)
35
+ type: "module",
36
+ asset_type: :javascript,
37
+ skip_preload_tags: false,
38
+ skip_style_tags: false,
39
+ crossorigin: "anonymous",
40
+ media: "screen",
41
+ **options)
42
42
  entries = vite_manifest.resolve_entries(*names, type: asset_type)
43
43
  tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, extname: false, **options)
44
44
  tags << vite_preload_tag(*entries.fetch(:imports), crossorigin: crossorigin, **options) unless skip_preload_tags
@@ -61,8 +61,8 @@ module ViteRailsLegacy::TagHelpers
61
61
  def vite_image_tag(name, **options)
62
62
  if options[:srcset] && !options[:srcset].is_a?(String)
63
63
  options[:srcset] = options[:srcset].map do |src_name, size|
64
- "#{ vite_asset_path(src_name) } #{ size }"
65
- end.join(', ')
64
+ "#{vite_asset_path(src_name)} #{size}"
65
+ end.join(", ")
66
66
  end
67
67
 
68
68
  image_tag(vite_asset_path(name), options)
@@ -79,8 +79,8 @@ private
79
79
  def vite_preload_tag(*sources, crossorigin:, **options)
80
80
  sources.map { |source|
81
81
  href = path_to_asset(source)
82
- try(:request).try(:send_early_hints, 'Link' => %(<#{ href }>; rel=modulepreload; as=script; crossorigin=#{ crossorigin }))
83
- tag('link', rel: 'modulepreload', href: href, as: 'script', crossorigin: crossorigin, **options)
82
+ try(:request).try(:send_early_hints, "Link" => %(<#{href}>; rel=modulepreload; as=script; crossorigin=#{crossorigin}))
83
+ tag("link", rel: "modulepreload", href: href, as: "script", crossorigin: crossorigin, **options)
84
84
  }.join("\n").html_safe
85
85
  end
86
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRailsLegacy
4
- VERSION = '3.0.5'
4
+ VERSION = "3.1.0"
5
5
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'vite_ruby'
3
+ require "vite_ruby"
4
4
 
5
- require 'vite_rails_legacy/version'
6
- require 'vite_rails_legacy/config'
7
- require 'vite_rails_legacy/tag_helpers'
8
- require 'vite_rails_legacy/engine' if defined?(Rails)
5
+ require "vite_rails_legacy/version"
6
+ require "vite_rails_legacy/config"
7
+ require "vite_rails_legacy/tag_helpers"
8
+ require "vite_rails_legacy/engine" if defined?(Rails)
9
9
 
10
10
  # Active Support 4 does not support multiple arguments in append.
11
11
  class Array
12
- alias append push
12
+ alias_method :append, :push
13
13
  end
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: 3.0.5
4
+ version: 3.1.0
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: 2022-04-29 00:00:00.000000000 Z
11
+ date: 2024-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -61,8 +61,9 @@ 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@3.0.5/vite_rails_legacy
65
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@3.0.5/vite_rails_legacy/CHANGELOG.md
64
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@3.1.0/vite_rails_legacy
65
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@3.1.0/vite_rails_legacy/CHANGELOG.md
66
+ rubygems_mfa_required: 'true'
66
67
  post_install_message:
67
68
  rdoc_options: []
68
69
  require_paths:
@@ -78,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
79
  - !ruby/object:Gem::Version
79
80
  version: '0'
80
81
  requirements: []
81
- rubygems_version: 3.2.32
82
+ rubygems_version: 3.5.16
82
83
  signing_key:
83
84
  specification_version: 4
84
85
  summary: Use Vite in Rails 4 and bring joy to your JavaScript experience