vite_ruby 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/vite_ruby/config.rb +7 -1
- data/lib/vite_ruby/dev_server_proxy.rb +7 -3
- data/lib/vite_ruby/version.rb +1 -1
- data/lib/vite_ruby.rb +6 -1
- 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: a205056fa6566aba9f30cd801ae38e347ea60a962ca4bf02ea8302153362e0fc
|
4
|
+
data.tar.gz: 84637ce863e221000cecd5ae4a524a5a54196f8feee6ced7a9cf4f34a00604b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2056cdd9c5663e9353a7fc5377227723ea7d1b00a78c27856ea434ca116c4e4274a912e449c782d13cdc063ef3e72148ba7af2eaddb2d5d893b5ec8e2029908c
|
7
|
+
data.tar.gz: c6add178ee83b16a6bcb0c72cf9935be58eb79290a36ab692b5f4a481d1232afb258f7bf84506795e37f098fcec9c54f4cfb279940312387e4330f02224492e6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [3.0.6](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.0.5...vite_ruby@3.0.6) (2021-12-24)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* allow providing an empty public output dir (close [#161](https://github.com/ElMassimo/vite_ruby/issues/161)) ([#164](https://github.com/ElMassimo/vite_ruby/issues/164)) ([ef48c9b](https://github.com/ElMassimo/vite_ruby/commit/ef48c9b39084a96364a783fa670bd6ec68dfa289))
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* support ruby config file for advanced configuration (close [#162](https://github.com/ElMassimo/vite_ruby/issues/162)) ([34e63fd](https://github.com/ElMassimo/vite_ruby/commit/34e63fdd546078dfc94f2c546b096aa296a47d37))
|
12
|
+
|
13
|
+
|
14
|
+
|
1
15
|
## [3.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.0.4...vite_ruby@3.0.5) (2021-12-17)
|
2
16
|
|
3
17
|
|
data/lib/vite_ruby/config.rb
CHANGED
@@ -43,6 +43,12 @@ class ViteRuby::Config
|
|
43
43
|
root.join(source_code_dir)
|
44
44
|
end
|
45
45
|
|
46
|
+
# Public: Loads an optional config/vite.rb file that can modify ViteRuby.env
|
47
|
+
def load_ruby_config
|
48
|
+
rb_config_path = File.expand_path(config_path.sub(/.json$/, '.rb'), root)
|
49
|
+
load rb_config_path if File.exist?(rb_config_path)
|
50
|
+
end
|
51
|
+
|
46
52
|
# Public: Sets additional environment variables for vite-plugin-ruby.
|
47
53
|
def to_env
|
48
54
|
CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env|
|
@@ -59,7 +65,7 @@ class ViteRuby::Config
|
|
59
65
|
dir.start_with?('~/') || dir.start_with?(source_code_dir)
|
60
66
|
},
|
61
67
|
"#{ source_code_dir }/**/*",
|
62
|
-
config_path,
|
68
|
+
config_path.sub(/.json$/, '.{rb,json}'),
|
63
69
|
*DEFAULT_WATCHED_PATHS,
|
64
70
|
].freeze
|
65
71
|
end
|
@@ -31,10 +31,14 @@ private
|
|
31
31
|
|
32
32
|
def rewrite_uri_for_vite(env)
|
33
33
|
uri = env.fetch('REQUEST_URI') { [env['PATH_INFO'], env['QUERY_STRING']].reject { |str| str.to_s.strip.empty? }.join('?') }
|
34
|
+
env['PATH_INFO'], env['QUERY_STRING'] = (env['REQUEST_URI'] = normalize_uri(uri)).split('?')
|
35
|
+
end
|
36
|
+
|
37
|
+
def normalize_uri(uri)
|
38
|
+
uri
|
34
39
|
.sub(HOST_WITH_PORT_REGEX, '/') # Hanami adds the host and port.
|
35
40
|
.sub('.ts.js', '.ts') # Hanami's javascript helper always adds the extension.
|
36
41
|
.sub(/(\.(?!min|module)\w+)\.css$/, '\1') # Rails' stylesheet_link_tag always adds the extension.
|
37
|
-
env['PATH_INFO'], env['QUERY_STRING'] = (env['REQUEST_URI'] = uri).split('?')
|
38
42
|
end
|
39
43
|
|
40
44
|
def forward_to_vite_dev_server(env)
|
@@ -49,7 +53,7 @@ private
|
|
49
53
|
end
|
50
54
|
|
51
55
|
def vite_should_handle?(env)
|
52
|
-
path = env['PATH_INFO']
|
56
|
+
path = normalize_uri(env['PATH_INFO'])
|
53
57
|
return true if path.start_with?(vite_asset_url_prefix) # Vite asset
|
54
58
|
return true if path.start_with?(VITE_DEPENDENCY_PREFIX) # Packages and imports
|
55
59
|
return true if file_in_vite_root?(path) # Fallback if Vite can serve the file
|
@@ -61,6 +65,6 @@ private
|
|
61
65
|
end
|
62
66
|
|
63
67
|
def vite_asset_url_prefix
|
64
|
-
@vite_asset_url_prefix ||= "/#{ config.public_output_dir }/"
|
68
|
+
@vite_asset_url_prefix ||= config.public_output_dir.empty? ? "\0" : "/#{ config.public_output_dir }/"
|
65
69
|
end
|
66
70
|
end
|
data/lib/vite_ruby/version.rb
CHANGED
data/lib/vite_ruby.rb
CHANGED
@@ -122,7 +122,12 @@ class ViteRuby
|
|
122
122
|
|
123
123
|
# Public: Current instance configuration for Vite.
|
124
124
|
def config
|
125
|
-
@config
|
125
|
+
unless defined?(@config)
|
126
|
+
@config = ViteRuby::Config.resolve_config(**@config_options)
|
127
|
+
@config.load_ruby_config
|
128
|
+
end
|
129
|
+
|
130
|
+
@config
|
126
131
|
end
|
127
132
|
|
128
133
|
# Public: Enables looking up assets managed by Vite using name and type.
|
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.0.
|
4
|
+
version: 3.0.6
|
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: 2021-12-
|
11
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -201,8 +201,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
201
201
|
licenses:
|
202
202
|
- MIT
|
203
203
|
metadata:
|
204
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.0.
|
205
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.0.
|
204
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.0.6/vite_ruby
|
205
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.0.6/vite_ruby/CHANGELOG.md
|
206
206
|
post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
|
207
207
|
manually, please run:\n\tbundle exec vite upgrade"
|
208
208
|
rdoc_options: []
|