vite_ruby 3.10.5 → 3.10.6

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: fb3ebc635493bea9141886ead481f531ef3d8dd702a6783d73ace641718947af
4
- data.tar.gz: 9324ffbeac900fc3df340621e2b7f17ab126b70bd71493f5be8c5a7c9b626e91
3
+ metadata.gz: 129b1982f425d4c3b67385c93b43f7eccd1cd177db7f13197cfb843f10248852
4
+ data.tar.gz: 6e16251499ae23bc413ff671dc95e6a390d9ba241073d9e93326a3f140326e2d
5
5
  SHA512:
6
- metadata.gz: 90bd9770f6c04da48c1bac016cc6c7783450dea06feeb5c193805138d3f8583a22e6becd3378486874ba2d086e0b7b0404a225ab953a5eba911198977c8c7233
7
- data.tar.gz: 152d63b27c564284e2a0c0775aec7019a518664f915e0a6c72cfdfaedb017e1f40f198b09679cab861a384da020b3a82fcdc907e69b96acdb53a20d9e3ce697d
6
+ metadata.gz: f02fdbab75740f5d0c510eddbae774120cd06b44c99d7cabfbed7a1e5ca18120b5a0b55ba6e5e35eea6129087052255255e07bc199f8f855825c01fd17e920d8
7
+ data.tar.gz: 56ee4a35214aadc548c538ee13898df54c91f95349f58f8008465afcd3e74d186df05d82badd7af562192947369859e3bcf3461c25e0c7f3beaeae782821d1aa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [3.10.6](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.10.5...vite_ruby@3.10.6) (2026-09-16)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * skip re-hashing unchanged watched files on every build check ([#625](https://github.com/ElMassimo/vite_ruby/issues/625)) ([e0ad345](https://github.com/ElMassimo/vite_ruby/commit/e0ad34511b7fc0e34cdfbf2bbe9aca4660b2e904)), closes [#624](https://github.com/ElMassimo/vite_ruby/issues/624)
7
+
8
+
9
+
1
10
  ## [3.10.5](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.10.4...vite_ruby@3.10.5) (2026-08-28)
2
11
 
3
12
 
data/README.md CHANGED
@@ -37,7 +37,7 @@
37
37
  [config]: https://vite-ruby.netlify.app/config/
38
38
  [vite_rails]: https://github.com/ElMassimo/vite_ruby
39
39
  [webpacker]: https://github.com/rails/webpacker
40
- [vite]: http://vitejs.dev/
40
+ [vite]: https://vite.dev/
41
41
  [config file]: https://github.com/ElMassimo/vite_ruby/blob/main/vite-plugin-ruby/default.vite.json
42
42
  [example app]: https://github.com/ElMassimo/pingcrm-vite
43
43
  [heroku]: https://pingcrm-vite.herokuapp.com/
@@ -6,6 +6,7 @@ require "digest/sha1"
6
6
  class ViteRuby::Builder
7
7
  def initialize(vite_ruby)
8
8
  @vite_ruby = vite_ruby
9
+ @file_digests = {}
9
10
  end
10
11
 
11
12
  # Public: Checks if the watched files have changed since the last compilation,
@@ -55,13 +56,48 @@ private
55
56
  return @last_digest if @last_digest_at && Time.now - @last_digest_at < 1
56
57
 
57
58
  config.within_root do
58
- files = Dir[*config.watched_paths].reject { |f| File.directory?(f) }
59
- file_ids = files.sort.map { |f| "#{File.basename(f)}/#{Digest::SHA1.file(f).hexdigest}" }
59
+ previous_digests = @file_digests
60
+ @file_digests = {}
61
+ file_ids = Dir[*config.watched_paths].sort.filter_map { |file|
62
+ file_digest(file, previous_digests)
63
+ }
60
64
  @last_digest_at = Time.now
61
65
  @last_digest = Digest::SHA1.hexdigest(file_ids.join("/"))
62
66
  end
63
67
  end
64
68
 
69
+ # Internal: Returns the id of a watched file, or nil if it's a directory.
70
+ #
71
+ # NOTE: Reading and hashing every watched file dominates the cost of the
72
+ # check, and the answer is almost always the same one as the last time, so the
73
+ # contents are read again only once the file has been touched. The digest
74
+ # stays content-based: a checkout that changes mtimes but not contents still
75
+ # counts as unchanged, and no Vite build is triggered.
76
+ def file_digest(file, previous_digests)
77
+ stat = File.stat(file)
78
+ return if stat.directory?
79
+
80
+ signature = [stat.mtime, stat.size]
81
+ previous_signature, previous_id = previous_digests[file]
82
+ id = if previous_signature == signature && !recently_modified?(stat)
83
+ previous_id
84
+ else
85
+ "#{File.basename(file)}/#{Digest::SHA1.file(file).hexdigest}"
86
+ end
87
+ @file_digests[file] = [signature, id]
88
+ id
89
+ end
90
+
91
+ # Internal: Whether the file was modified too recently to trust its mtime.
92
+ #
93
+ # NOTE: A file edited twice within the resolution of the file system clock,
94
+ # without changing its size, would keep the same signature. Rehashing the
95
+ # files touched in the last second rules that out, the same way Git resolves
96
+ # a racily clean entry in the index.
97
+ def recently_modified?(stat)
98
+ Time.now - stat.mtime < 1
99
+ end
100
+
65
101
  # Public: Initiates a Vite build command to generate assets.
66
102
  def build_with_vite(*args)
67
103
  logger.info "Building with Vite ⚡️"
@@ -110,7 +110,7 @@ private
110
110
  /public/vite*
111
111
  node_modules
112
112
  # Vite uses dotenv and suggests to ignore local-only env files. See
113
- # https://vitejs.dev/guide/env-and-mode.html#env-files
113
+ # https://vite.dev/guide/env-and-mode.html#env-files
114
114
  *.local
115
115
  GITIGNORE
116
116
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = "3.10.5"
4
+ VERSION = "3.10.6"
5
5
 
6
6
  # Internal: Versions used by default when running `vite install`.
7
7
  DEFAULT_VITE_VERSION = "^8.0.0"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.5
4
+ version: 3.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-08-28 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dry-cli
@@ -184,7 +183,6 @@ dependencies:
184
183
  - - "<"
185
184
  - !ruby/object:Gem::Version
186
185
  version: '0.23'
187
- description:
188
186
  email:
189
187
  - maximomussini@gmail.com
190
188
  executables:
@@ -230,8 +228,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
230
228
  licenses:
231
229
  - MIT
232
230
  metadata:
233
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.10.5/vite_ruby
234
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.10.5/vite_ruby/CHANGELOG.md
231
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.10.6/vite_ruby
232
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.10.6/vite_ruby/CHANGELOG.md
235
233
  rubygems_mfa_required: 'true'
236
234
  post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
237
235
  manually, please run:\n\tbundle exec vite upgrade"
@@ -249,8 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
247
  - !ruby/object:Gem::Version
250
248
  version: '0'
251
249
  requirements: []
252
- rubygems_version: 3.5.16
253
- signing_key:
250
+ rubygems_version: 4.0.16
254
251
  specification_version: 4
255
252
  summary: Use Vite in Ruby and bring joy to your JavaScript experience
256
253
  test_files: []