vite_rails_legacy 2.0.6 → 2.0.11

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: 717e96252a46e147b8ee0e8ee83e0007d7b46e579be3c7c2daf08c6c67645598
4
- data.tar.gz: 94a9eff2ee78e9697ab410c849ebe472975220a1a3ed245e4f659ce09142c5b0
3
+ metadata.gz: b714e9001b6d6999959472a8d24089d89e29aef5aca69e652ee49a1c22adc87e
4
+ data.tar.gz: facdc459d3e4a0646d6488dfd9397c38dd2cd4a711d65eeb94b23a08064fb634
5
5
  SHA512:
6
- metadata.gz: 05cbe4cc36d62713101ef6fd630aef09500bfb253ab1e9e30f90c6ea31083efad9266a0268bbedb5fd60016221be10af88fc358cd2a6640cccbe8b54aec39067
7
- data.tar.gz: 0cc53fe9843addd5d0f92eb2d790916dc93a3ca2584ea8cc04c080c81ffb5fe5f8059558f607eb8ef28e730512556022cea3b03e19c30b1168a1e5b29a95d96b
6
+ metadata.gz: 9d8ffaf71359c339c2022f0dd5530e282f5afd575042e0ab697d4887ec29ba94e83dc839da0953cc17da4486c6596ded54c28fd4618436527b734a5e3822a518
7
+ data.tar.gz: c5cd6c2225c3d51bf4d6a08c7c8be191958d993415822f42d4d98d7d6f58d6324194743bb79658b2cbf76e06ab4ece65286bf72cb17ff283908cd1aad697f22f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ ## [2.0.11](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@2.0.10...vite_rails_legacy@2.0.11) (2021-05-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Fix typo in comment in example entrypoint in Rails ([78b3104](https://github.com/ElMassimo/vite_ruby/commit/78b3104bc687a79aebd4e0538b8b7c34562cb4eb))
7
+
8
+
9
+
10
+ ## [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)
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+
17
+ ### Features
18
+
19
+ * Add helpers to enable HMR when using @vitejs/plugin-react-refresh ([a80f286](https://github.com/ElMassimo/vite_ruby/commit/a80f286d4305bbae29ea7cea42a4329a530f43fa))
20
+
21
+
22
+
23
+ ## [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)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * Allow passing additional attributes to scripts and stylesheets. ([edf6019](https://github.com/ElMassimo/vite_ruby/commit/edf6019fa83646e413f36d289eac89bb2f8042a5))
29
+
30
+
31
+
32
+ ## [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)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * Simplify installation of build dependencies by using package manager flags ([5c8bb62](https://github.com/ElMassimo/vite_ruby/commit/5c8bb625926f2ab1788a3e3a22aeafd7104984cb))
38
+
39
+
40
+
1
41
  ## [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)
2
42
 
3
43
 
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.6'
4
+ VERSION = '2.0.11'
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_typescript_tag 'application.jsx' %>
9
+ // <%= vite_typescript_tag 'application' %>
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.6
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-03-19 00:00:00.000000000 Z
11
+ date: 2021-05-24 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.6/vite_rails_legacy
65
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@2.0.6/vite_rails_legacy/CHANGELOG.md
64
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@2.0.11/vite_rails_legacy
65
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@2.0.11/vite_rails_legacy/CHANGELOG.md
66
66
  post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths: