vite_ruby 3.10.6 → 3.11.1
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 +4 -4
- data/CHANGELOG.md +18 -0
- data/default.vite.json +1 -0
- data/lib/vite_ruby/config.rb +9 -1
- data/lib/vite_ruby/version.rb +2 -2
- data/lib/vite_ruby.rb +37 -13
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b123a02b4b5ed8154b52f7b15f1ffed680818dc6f823c7cb3a7f466a9c0b3e3
|
|
4
|
+
data.tar.gz: 61310dc93fb66de90968b00a1b65f9cd8269501c9451c06b13152727e414f317
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f63402050f71af9335a59737209f985c8671416be2be27a08c6b7281eedb825bb0b213b5d2d11bc473aa6371daaeec39f0b91a11159638ec068b3e8e02df241b
|
|
7
|
+
data.tar.gz: 17c238e9ddef2890f8fbf0508fcd2b1194198821290bcf8673ba897d34f64758d1e3108dd804be0173f7c7c503bfad4596829ffdefd66815b867470828a6264a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [3.11.1](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.11.0...vite_ruby@3.11.1) (2026-09-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* scope dev server metadata to Ruby mode ([#632](https://github.com/ElMassimo/vite_ruby/issues/632)) ([#633](https://github.com/ElMassimo/vite_ruby/issues/633)) ([d3d8e6f](https://github.com/ElMassimo/vite_ruby/commit/d3d8e6f50524e9415df5e0621fe92117175f6dfd))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# [3.11.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.10.6...vite_ruby@3.11.0) (2026-09-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* detect if dev server is running using a local file (close [#391](https://github.com/ElMassimo/vite_ruby/issues/391)) ([#621](https://github.com/ElMassimo/vite_ruby/issues/621)) ([d424fbf](https://github.com/ElMassimo/vite_ruby/commit/d424fbf5fbd3782c4446c4c357331320e3512352))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [3.10.6](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.10.5...vite_ruby@3.10.6) (2026-09-16)
|
|
2
20
|
|
|
3
21
|
|
data/default.vite.json
CHANGED
data/lib/vite_ruby/config.rb
CHANGED
|
@@ -5,6 +5,9 @@ require "json"
|
|
|
5
5
|
# Public: Allows to resolve configuration sourced from `config/vite.json` and
|
|
6
6
|
# environment variables, combining them with the default options.
|
|
7
7
|
class ViteRuby::Config
|
|
8
|
+
# Internal: Base name of the metadata file written by the Vite dev server.
|
|
9
|
+
DEV_SERVER_META_BASENAME = "vite-ruby"
|
|
10
|
+
|
|
8
11
|
def origin
|
|
9
12
|
"#{protocol}://#{host_with_port}"
|
|
10
13
|
end
|
|
@@ -38,6 +41,11 @@ class ViteRuby::Config
|
|
|
38
41
|
root.join(public_dir, public_output_dir)
|
|
39
42
|
end
|
|
40
43
|
|
|
44
|
+
# Internal: Path to the metadata file written by the Vite dev server.
|
|
45
|
+
def dev_server_meta_path
|
|
46
|
+
root.join("tmp", "#{DEV_SERVER_META_BASENAME}-#{mode}.json")
|
|
47
|
+
end
|
|
48
|
+
|
|
41
49
|
# Public: The directory where the entries are located.
|
|
42
50
|
def resolved_entrypoints_dir
|
|
43
51
|
vite_root_dir.join(entrypoints_dir)
|
|
@@ -96,7 +104,7 @@ private
|
|
|
96
104
|
config["build_cache_dir"] = root.join(config["build_cache_dir"])
|
|
97
105
|
config["ssr_output_dir"] = root.join(config["ssr_output_dir"])
|
|
98
106
|
config["dev_server_connect_timeout"] = config["dev_server_connect_timeout"].to_f
|
|
99
|
-
coerce_booleans(config, "auto_build", "hide_build_console_output", "https", "skip_compatibility_check", "skip_proxy")
|
|
107
|
+
coerce_booleans(config, "auto_build", "dev_server_connection_check", "hide_build_console_output", "https", "skip_compatibility_check", "skip_proxy")
|
|
100
108
|
config["package_manager"] ||= detect_package_manager(root)
|
|
101
109
|
end
|
|
102
110
|
|
data/lib/vite_ruby/version.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class ViteRuby
|
|
4
|
-
VERSION = "3.
|
|
4
|
+
VERSION = "3.11.1"
|
|
5
5
|
|
|
6
6
|
# Internal: Versions used by default when running `vite install`.
|
|
7
7
|
DEFAULT_VITE_VERSION = "^8.0.0"
|
|
8
|
-
DEFAULT_PLUGIN_VERSION = "^5.2.
|
|
8
|
+
DEFAULT_PLUGIN_VERSION = "^5.2.5"
|
|
9
9
|
end
|
data/lib/vite_ruby.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "json"
|
|
3
4
|
require "logger"
|
|
4
5
|
require "forwardable"
|
|
5
6
|
require "pathname"
|
|
@@ -82,19 +83,12 @@ class ViteRuby
|
|
|
82
83
|
end
|
|
83
84
|
|
|
84
85
|
# Public: Returns true if the Vite development server is currently running.
|
|
85
|
-
# NOTE: Checks only once every second since every lookup calls this method.
|
|
86
86
|
def dev_server_running?
|
|
87
|
-
return false unless
|
|
88
|
-
return
|
|
87
|
+
return false unless dev_mode?
|
|
88
|
+
return dev_server_connected? if config.dev_server_connection_check
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
@running = true
|
|
93
|
-
rescue
|
|
94
|
-
@running = false
|
|
95
|
-
ensure
|
|
96
|
-
@running_checked_at = Time.now
|
|
97
|
-
end
|
|
90
|
+
meta = dev_server_meta
|
|
91
|
+
meta.is_a?(Hash) && meta["port"] == config.port
|
|
98
92
|
end
|
|
99
93
|
|
|
100
94
|
# Public: Additional environment variables to pass to Vite.
|
|
@@ -105,13 +99,15 @@ class ViteRuby
|
|
|
105
99
|
@env ||= ENV.select { |key, _| key.start_with?(ENV_PREFIX) }
|
|
106
100
|
end
|
|
107
101
|
|
|
108
|
-
# Public:
|
|
109
|
-
def
|
|
102
|
+
# Public: Whether we are in an environment that might run the Vite dev server.
|
|
103
|
+
def dev_mode?
|
|
110
104
|
config.mode == "development" || (config.mode == "test" && !ENV["CI"])
|
|
111
105
|
rescue => error
|
|
112
106
|
logger.error("Failed to check mode for Vite: #{error.message}")
|
|
113
107
|
false
|
|
114
108
|
end
|
|
109
|
+
# Public: The proxy for assets should only run in development mode.
|
|
110
|
+
alias_method :run_proxy?, :dev_mode?
|
|
115
111
|
|
|
116
112
|
# Internal: Executes the vite binary.
|
|
117
113
|
def run(argv, **options)
|
|
@@ -147,6 +143,34 @@ class ViteRuby
|
|
|
147
143
|
def manifest
|
|
148
144
|
@manifest ||= ViteRuby::Manifest.new(self)
|
|
149
145
|
end
|
|
146
|
+
|
|
147
|
+
private
|
|
148
|
+
|
|
149
|
+
# Internal: Returns true if a TCP connection to the dev server can be opened.
|
|
150
|
+
def dev_server_connected?
|
|
151
|
+
return @running if defined?(@running) && Time.now - @running_checked_at < 1
|
|
152
|
+
|
|
153
|
+
begin
|
|
154
|
+
Socket.tcp(config.host, config.port, connect_timeout: config.dev_server_connect_timeout).close
|
|
155
|
+
@running = true
|
|
156
|
+
rescue
|
|
157
|
+
@running = false
|
|
158
|
+
ensure
|
|
159
|
+
@running_checked_at = Time.now
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Internal: Metadata written by the running Vite dev server, or nil when stopped.
|
|
164
|
+
def dev_server_meta
|
|
165
|
+
return @dev_server_meta if defined?(@dev_server_meta) && Time.now - @dev_server_meta_checked_at < 1
|
|
166
|
+
|
|
167
|
+
path = config.dev_server_meta_path
|
|
168
|
+
@dev_server_meta = (JSON.parse(path.read) if path.exist?)
|
|
169
|
+
rescue JSON::ParserError, SystemCallError
|
|
170
|
+
@dev_server_meta = nil
|
|
171
|
+
ensure
|
|
172
|
+
@dev_server_meta_checked_at = Time.now
|
|
173
|
+
end
|
|
150
174
|
end
|
|
151
175
|
|
|
152
176
|
require "vite_ruby/version"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vite_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Máximo Mussini
|
|
@@ -228,8 +228,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
|
228
228
|
licenses:
|
|
229
229
|
- MIT
|
|
230
230
|
metadata:
|
|
231
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.
|
|
232
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.
|
|
231
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.11.1/vite_ruby
|
|
232
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.11.1/vite_ruby/CHANGELOG.md
|
|
233
233
|
rubygems_mfa_required: 'true'
|
|
234
234
|
post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
|
|
235
235
|
manually, please run:\n\tbundle exec vite upgrade"
|