vite_rails 2.0.3 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6bd0ba71782fc5f805aaa491a323dd54fa53cdb1a4eec20280dac1240ba3eaa
4
- data.tar.gz: 732b25178ea38456fb779e132d3c9b1b3a0d51bf08c09b4bfabb99f91bbb9b03
3
+ metadata.gz: 836b70a490a2917136f857fb88a3f5f84c1fbc9305b2d4080b7bfb8a4dbc9303
4
+ data.tar.gz: 5fa491c04e0464c3c5d83c22a099e750fcd0509126d7597030aca9c045f9ac1d
5
5
  SHA512:
6
- metadata.gz: 681ab6f425a853f1f95a0ee3ef4308c56406b5e298c906f56558ff8898dcc155271de4e80dc2f4bdeb77343651ff24a58c300c4c05748a5ca9177bd0fc4f520d
7
- data.tar.gz: c57fbf21518f89a2c7d171095802feef551422f0c6ac32b4d1a0875d4b4e41e981aac3cb72c4e2df1e7fca301fa5443b6c843eb0cf8c2469ce72720fcd41cf9a
6
+ metadata.gz: 92400212e26217861818c4ae16b295e2fd7fa9ef54d500a7361febbc24ee544525e1dbb45a77e50af2155b447dc11a5c2aaf8528fdc42e1ba8cfb6435bdb97ed
7
+ data.tar.gz: 6ae80aa42432c7438653f01f2899299e8979e6b126f9f5d646dbbbe862e7098391689ae3642a30ad079e69f630ace1fbf0383df57c0311894e7c21ff69902d78
data/CHANGELOG.md CHANGED
@@ -1,3 +1,52 @@
1
+ ## [2.0.9](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.8...vite_rails@2.0.9) (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.8](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.7...vite_rails@2.0.8) (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.7](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.6...vite_rails@2.0.7) (2021-03-19)
20
+
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.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.5...vite_rails@2.0.6) (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.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.4...vite_rails@2.0.5) (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.4](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.3...vite_rails@2.0.4) (2021-03-09)
42
+
43
+
44
+ ### Features
45
+
46
+ * Detect installations of the latest version of Webpacker (app/packs) ([e9a3bc0](https://github.com/ElMassimo/vite_ruby/commit/e9a3bc02475dbadac77e58b3980a4af8df5aaa02))
47
+
48
+
49
+
1
50
  ## [2.0.3](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.2...vite_rails@2.0.3) (2021-03-07)
2
51
 
3
52
  - Add a bounded requirement to `vite_ruby` dependency.
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
@@ -10,8 +10,8 @@ module ViteRails::Installation
10
10
  # Override: Setup a typical apps/web Hanami app to use Vite.
11
11
  def setup_app_files
12
12
  cp RAILS_TEMPLATES.join('config/rails-vite.json'), config.config_path
13
- if root.join('app/javascript').exist?
14
- Dry::CLI::Utils::Files.replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "app/javascript",)
13
+ if dir = %w[app/javascript app/packs].find { |path| root.join(path).exist? }
14
+ Dry::CLI::Utils::Files.replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "#{ dir }",)
15
15
  end
16
16
  setup_content_security_policy root.join('config/initializers/content_security_policy.rb')
17
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
@@ -24,17 +24,18 @@ module ViteRails::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, extname: false, **options)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRails
4
- VERSION = '2.0.3'
4
+ VERSION = '2.0.9'
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.3
4
+ version: 2.0.9
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-07 00:00:00.000000000 Z
11
+ date: 2021-04-15 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.3/vite_rails
85
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.3/vite_rails/CHANGELOG.md
84
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@2.0.9/vite_rails
85
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.9/vite_rails/CHANGELOG.md
86
86
  post_install_message:
87
87
  rdoc_options: []
88
88
  require_paths: