vite_ruby 3.2.11 → 3.2.12
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 +15 -0
- data/default.vite.json +1 -0
- data/lib/vite_ruby/builder.rb +4 -1
- data/lib/vite_ruby/config.rb +5 -1
- data/lib/vite_ruby/manifest.rb +7 -2
- data/lib/vite_ruby/version.rb +1 -1
- data/lib/vite_ruby.rb +8 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2850c006c8005addf043f212c1a7e42a39f20f20b1935db704d94cc637feb4da
|
4
|
+
data.tar.gz: 4674de49f84fcdad1c453c9e17b210363af477346f3c515c75ecacf16ee4e781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7225d5ca1173bc2195a7f6c9ab60eb324f2d1dd53b8e8a5176b152f43929904e0290a99bb6c8c6d3cdca57900c6c05080f70bbaaee2457ce233512de8530891
|
7
|
+
data.tar.gz: ed8ec38933ba729e41eafd7269f8fce03f82c9676055bfe135d7856c17d11fd15a5cb1cb33f83b875f1d52ec374cf26fe3ba4235843232841383dd8cceccbe9f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## [3.2.12](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.2.11...vite_ruby@3.2.12) (2022-12-02)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add experimental `skipProxy` setting ([#315](https://github.com/ElMassimo/vite_ruby/issues/315)) ([e9285f6](https://github.com/ElMassimo/vite_ruby/commit/e9285f62c76cc0cbbc5dc99d977e8aef30d08b6f))
|
7
|
+
* add ViteRuby.instance.configure API to be used in config/vite.rb ([b5b8681](https://github.com/ElMassimo/vite_ruby/commit/b5b8681f85f5388a56d72c9b05dbfc95d5ba607b))
|
8
|
+
|
9
|
+
|
10
|
+
### Performance Improvements
|
11
|
+
|
12
|
+
* avoid calculating digest on each lookup ([#314](https://github.com/ElMassimo/vite_ruby/issues/314)) ([62df93a](https://github.com/ElMassimo/vite_ruby/commit/62df93a15c09c652a8b7496e26cf85d5d69acce7))
|
13
|
+
|
14
|
+
|
15
|
+
|
1
16
|
## [3.2.11](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.2.10...vite_ruby@3.2.11) (2022-11-13)
|
2
17
|
|
3
18
|
|
data/default.vite.json
CHANGED
data/lib/vite_ruby/builder.rb
CHANGED
@@ -52,10 +52,13 @@ private
|
|
52
52
|
# Internal: Returns a digest of all the watched files, allowing to detect
|
53
53
|
# changes, and skip Vite builds if no files have changed.
|
54
54
|
def watched_files_digest
|
55
|
+
return @last_digest if @last_digest_at && Time.now - @last_digest_at < 1
|
56
|
+
|
55
57
|
config.within_root do
|
56
58
|
files = Dir[*config.watched_paths].reject { |f| File.directory?(f) }
|
57
59
|
file_ids = files.sort.map { |f| "#{ File.basename(f) }/#{ Digest::SHA1.file(f).hexdigest }" }
|
58
|
-
|
60
|
+
@last_digest_at = Time.now
|
61
|
+
@last_digest = Digest::SHA1.hexdigest(file_ids.join('/'))
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
data/lib/vite_ruby/config.rb
CHANGED
@@ -5,6 +5,10 @@ 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
|
+
def origin
|
9
|
+
"#{ protocol }://#{ host_with_port }"
|
10
|
+
end
|
11
|
+
|
8
12
|
def protocol
|
9
13
|
https ? 'https' : 'http'
|
10
14
|
end
|
@@ -90,7 +94,7 @@ private
|
|
90
94
|
config['root'] = Pathname.new(config['root'])
|
91
95
|
config['build_cache_dir'] = config['root'].join(config['build_cache_dir'])
|
92
96
|
config['ssr_output_dir'] = config['root'].join(config['ssr_output_dir'])
|
93
|
-
coerce_booleans(config, 'auto_build', 'hide_build_console_output', 'https', 'skip_compatibility_check')
|
97
|
+
coerce_booleans(config, 'auto_build', 'hide_build_console_output', 'https', 'skip_compatibility_check', 'skip_proxy')
|
94
98
|
end
|
95
99
|
|
96
100
|
# Internal: Coerces configuration options to boolean.
|
data/lib/vite_ruby/manifest.rb
CHANGED
@@ -125,13 +125,18 @@ private
|
|
125
125
|
|
126
126
|
# Internal: Scopes an asset to the output folder in public, as a path.
|
127
127
|
def prefix_vite_asset(path)
|
128
|
-
File.join(
|
128
|
+
File.join(vite_asset_origin || '/', config.public_output_dir, path)
|
129
129
|
end
|
130
130
|
|
131
131
|
# Internal: Prefixes an asset with the `asset_host` for tags that do not use
|
132
132
|
# the framework tag helpers.
|
133
133
|
def prefix_asset_with_host(path)
|
134
|
-
File.join(config.asset_host || '/', config.public_output_dir, path)
|
134
|
+
File.join(vite_asset_origin || config.asset_host || '/', config.public_output_dir, path)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Internal: The origin of assets managed by Vite.
|
138
|
+
def vite_asset_origin
|
139
|
+
config.origin if dev_server_running? && config.skip_proxy
|
135
140
|
end
|
136
141
|
|
137
142
|
# Internal: Resolves the paths that reference a manifest entry.
|
data/lib/vite_ruby/version.rb
CHANGED
data/lib/vite_ruby.rb
CHANGED
@@ -32,7 +32,7 @@ class ViteRuby
|
|
32
32
|
class << self
|
33
33
|
extend Forwardable
|
34
34
|
|
35
|
-
def_delegators :instance, :config, :commands, :digest, :env, :run, :run_proxy?
|
35
|
+
def_delegators :instance, :config, :configure, :commands, :digest, :env, :run, :run_proxy?
|
36
36
|
def_delegators :config, :mode
|
37
37
|
|
38
38
|
def instance
|
@@ -85,7 +85,7 @@ 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
|
88
|
+
return true if @running_at && Time.now - @running_at < 1
|
89
89
|
|
90
90
|
Socket.tcp(config.host, config.port, connect_timeout: config.dev_server_connect_timeout).close
|
91
91
|
@running_at = Time.now
|
@@ -128,13 +128,18 @@ class ViteRuby
|
|
128
128
|
# Public: Current instance configuration for Vite.
|
129
129
|
def config
|
130
130
|
unless defined?(@config)
|
131
|
-
|
131
|
+
configure
|
132
132
|
@config.load_ruby_config
|
133
133
|
end
|
134
134
|
|
135
135
|
@config
|
136
136
|
end
|
137
137
|
|
138
|
+
# Public: Allows overriding the configuration for this instance.
|
139
|
+
def configure(**options)
|
140
|
+
@config = ViteRuby::Config.resolve_config(**@config_options, **options)
|
141
|
+
end
|
142
|
+
|
138
143
|
# Public: Enables looking up assets managed by Vite using name and type.
|
139
144
|
def manifest
|
140
145
|
@manifest ||= ViteRuby::Manifest.new(self)
|
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.2.
|
4
|
+
version: 3.2.12
|
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: 2022-
|
11
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -202,8 +202,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
202
202
|
licenses:
|
203
203
|
- MIT
|
204
204
|
metadata:
|
205
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.2.
|
206
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.2.
|
205
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.2.12/vite_ruby
|
206
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.2.12/vite_ruby/CHANGELOG.md
|
207
207
|
post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
|
208
208
|
manually, please run:\n\tbundle exec vite upgrade"
|
209
209
|
rdoc_options: []
|