vite_ruby 3.3.3 → 3.4.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: b261ed4c2d3d2653bc218492a4507b17e45d34a4988fe974b6f1f6b5cb1edce3
4
- data.tar.gz: ed8074ec0a226b8814b22b8dbc494c2a927acc0c08d96219bcee97e044b7de0d
3
+ metadata.gz: 91b619b1d7813eea11ef1f6a9a0c7950801e194d82daab5688e63b837f76ff46
4
+ data.tar.gz: ea993f8bdc8264307970584257a20a6a05fbc2a9492c4174e261ce9b23cca440
5
5
  SHA512:
6
- metadata.gz: d49d7a773da0ad3f5766b045d333ac04e84f3fc61bfe94af473c45f1aeda1a2070dc6d8319fc4e051ed18b598286b35ff295e80d6c26d09c7485a2d6df4c41f6
7
- data.tar.gz: d1bce21f1be30d5beb653d73ff999475939affcd93db82734560979ca1a2a5413498ef9ec948ae036273bd1946ce9c0113e4607a38cc2e78f6d2f3f0e50309b9
6
+ metadata.gz: 8054ec74fe9106dce8c808262953830c3f59afd9c71db9cc22c1f078d5b6cf8e1780627c1e696edd21a2d4efbd7d852f250ad47f91f505e15012aef867775022
7
+ data.tar.gz: 835a6e695afc3f6c2df427e216267a080ccfc2abb3a6577f1717bbbefbd5ec930ba5f9bab13a85e4d278a209b09d96a1c48ca732f8bc5069ff4b5ac3695b66e7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ # [3.4.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.3.4...vite_ruby@3.4.0) (2023-11-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **breaking:** check for any existing manifest path before cleaning ([c450483](https://github.com/ElMassimo/vite_ruby/commit/c4504839e11006d50d6503288469cb3de0c6a9cd))
7
+
8
+
9
+ ### Features
10
+
11
+ * add support for vite 5, which changed default manifest path ([818132a](https://github.com/ElMassimo/vite_ruby/commit/818132a07af3f17ba27ae09c44fcd59029064238))
12
+
13
+
14
+
15
+ ## [3.3.4](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.3.3...vite_ruby@3.3.4) (2023-06-27)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * check only once per second when dev server is not running ([#377](https://github.com/ElMassimo/vite_ruby/issues/377)) ([fb33f0a](https://github.com/ElMassimo/vite_ruby/commit/fb33f0a28077f9912deed257b7be3a7e050c2d94))
21
+
22
+
23
+
1
24
  ## [3.3.3](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.3.2...vite_ruby@3.3.3) (2023-06-19)
2
25
 
3
26
 
@@ -131,7 +131,7 @@ private
131
131
  def_delegators :@vite_ruby, :config, :builder, :manifest, :logger, :logger=
132
132
 
133
133
  def may_clean?
134
- config.build_output_dir.exist? && config.manifest_path.exist?
134
+ config.build_output_dir.exist? && config.manifest_paths.any?
135
135
  end
136
136
 
137
137
  def clean_files(files)
@@ -17,19 +17,24 @@ class ViteRuby::Config
17
17
  "#{ host }:#{ port }"
18
18
  end
19
19
 
20
- # Internal: Path where Vite outputs the manifest file.
21
- def manifest_path
22
- build_output_dir.join('manifest.json')
23
- end
24
-
25
- # Internal: Path where vite-plugin-ruby outputs the assets manifest file.
26
- def assets_manifest_path
27
- build_output_dir.join('manifest-assets.json')
20
+ # Internal: Path to the manifest files generated by Vite and vite-plugin-ruby.
21
+ def known_manifest_paths
22
+ [
23
+ # NOTE: Generated by Vite when `manifest: true`, which vite-plugin-ruby enables.
24
+ 'manifest.json',
25
+ # NOTE: Path where vite-plugin-ruby outputs the assets manifest file.
26
+ 'manifest-assets.json',
27
+ ].flat_map { |path|
28
+ [
29
+ build_output_dir.join(".vite/#{ path }"), # Vite 5 onwards
30
+ build_output_dir.join(path), # Vite 4 and below
31
+ ]
32
+ }
28
33
  end
29
34
 
30
35
  # Internal: Path to the manifest files generated by Vite and vite-plugin-ruby.
31
36
  def manifest_paths
32
- [manifest_path, assets_manifest_path].select(&:exist?)
37
+ known_manifest_paths.select(&:exist?)
33
38
  end
34
39
 
35
40
  # Public: The directory where Vite will store the built assets.
@@ -11,12 +11,13 @@ class ViteRuby::MissingEntrypointError < ViteRuby::Error
11
11
  def initialize(info)
12
12
  @info = info
13
13
  super <<~MSG
14
- Vite Ruby can't find #{ file_name } in #{ config.manifest_path.relative_path_from(config.root) } or #{ config.assets_manifest_path.relative_path_from(config.root) }.
14
+ Vite Ruby can't find #{ file_name } in the manifests.
15
15
 
16
16
  Possible causes:
17
17
  #{ possible_causes(last_build) }
18
18
  :troubleshooting:
19
- #{ "\nContent in your manifests:\n#{ JSON.pretty_generate(manifest) }\n" if last_build.success }
19
+ #{ "Manifest files found:\n#{ config.manifest_paths.map { |path| " #{ path.relative_path_from(config.root) }" }.join("\n") }\n" if last_build.success }
20
+ #{ "Content in your manifests:\n#{ JSON.pretty_generate(manifest) }\n" if last_build.success }
20
21
  #{ "Last build in #{ config.mode } mode:\n#{ last_build.to_json }\n" if last_build.success }
21
22
  MSG
22
23
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '3.3.3'
4
+ VERSION = '3.4.0'
5
5
 
6
6
  # Internal: Versions used by default when running `vite install`.
7
7
  DEFAULT_VITE_VERSION = '^4.3.0'
data/lib/vite_ruby.rb CHANGED
@@ -85,13 +85,16 @@ class ViteRuby
85
85
  # NOTE: Checks only once every second since every lookup calls this method.
86
86
  def dev_server_running?
87
87
  return false unless run_proxy?
88
- return true if @running_at && Time.now - @running_at < 1
89
-
90
- Socket.tcp(config.host, config.port, connect_timeout: config.dev_server_connect_timeout).close
91
- @running_at = Time.now
92
- true
93
- rescue StandardError
94
- @running_at = false
88
+ return @running if defined?(@running) && Time.now - @running_checked_at < 1
89
+
90
+ begin
91
+ Socket.tcp(config.host, config.port, connect_timeout: config.dev_server_connect_timeout).close
92
+ @running = true
93
+ rescue StandardError
94
+ @running = false
95
+ ensure
96
+ @running_checked_at = Time.now
97
+ end
95
98
  end
96
99
 
97
100
  # Public: Additional environment variables to pass to Vite.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -208,8 +208,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
208
208
  licenses:
209
209
  - MIT
210
210
  metadata:
211
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.3.3/vite_ruby
212
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.3.3/vite_ruby/CHANGELOG.md
211
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.4.0/vite_ruby
212
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.4.0/vite_ruby/CHANGELOG.md
213
213
  post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
214
214
  manually, please run:\n\tbundle exec vite upgrade"
215
215
  rdoc_options: []