vite_ruby 1.2.1 → 1.2.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 +46 -0
- data/lib/tasks/vite.rake +8 -2
- data/lib/vite_ruby.rb +2 -2
- data/lib/vite_ruby/cli/install.rb +1 -1
- data/lib/vite_ruby/dev_server_proxy.rb +1 -1
- data/lib/vite_ruby/manifest.rb +15 -0
- data/lib/vite_ruby/version.rb +1 -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: 25d6f543baa813ce51efadb33c24e701832a892ff73d3091b72978a7937b020c
|
4
|
+
data.tar.gz: cc3135c8be27c94e4f52ea679ba6ef41d2063af64cf6eb7a1bb4e662260e6171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea9e613b7b58f625b2c0f014f51b07652da52405308a4d07f5ad481d9d94e39c19ef20ef8feac6d8457277fc09fdb920bac6de2d1b3e99b934ca9715a1e06fd7
|
7
|
+
data.tar.gz: 2c5d0955a5651ea278bbe6fca0dd6905770709959776ad867c679e0c65e7304d8c7b9d7becf739226825223b8ed0e319461c5e1768d7acef4a2249ef2c34204d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,49 @@
|
|
1
|
+
## [1.2.6](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.5...vite_ruby@1.2.6) (2021-04-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Update installation to use the latest version of the plugin ([#67](https://github.com/ElMassimo/vite_ruby/issues/67)) ([7e10636](https://github.com/ElMassimo/vite_ruby/commit/7e10636f5396f496bd099a03e069cf8572b9585b))
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
## [1.2.5](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.4...vite_ruby@1.2.5) (2021-04-21)
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* Add helpers to enable HMR when using @vitejs/plugin-react-refresh ([a80f286](https://github.com/ElMassimo/vite_ruby/commit/a80f286d4305bbae29ea7cea42a4329a530f43fa))
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
## [1.2.4](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.3...vite_ruby@1.2.4) (2021-04-21)
|
20
|
+
|
21
|
+
|
22
|
+
### Bug Fixes
|
23
|
+
|
24
|
+
* Avoid removing `base` from proxied requests to avoid confusion. ([25f79a9](https://github.com/ElMassimo/vite_ruby/commit/25f79a9848df3e6c2ffbeb9bd4fbc44f73e4c68a))
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## [1.2.3](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.2...vite_ruby@1.2.3) (2021-04-15)
|
29
|
+
|
30
|
+
|
31
|
+
### Features
|
32
|
+
|
33
|
+
* Add support for .scss, .less, and .styl entrypoints (close [#50](https://github.com/ElMassimo/vite_ruby/issues/50)) ([bb1d295](https://github.com/ElMassimo/vite_ruby/commit/bb1d2953b3a8c5862d26cdfcd5edc5cc918d1c5a))
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
## [1.2.2](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.1...vite_ruby@1.2.2) (2021-03-20)
|
38
|
+
|
39
|
+
|
40
|
+
### Bug Fixes
|
41
|
+
|
42
|
+
* Avoid prompts when using npx outside a CI ([ed7ccd7](https://github.com/ElMassimo/vite_ruby/commit/ed7ccd7d32c079ab78555ecd36dcb68ad2da331e))
|
43
|
+
* Simplify installation of build dependencies by using package manager flags ([5c8bb62](https://github.com/ElMassimo/vite_ruby/commit/5c8bb625926f2ab1788a3e3a22aeafd7104984cb))
|
44
|
+
|
45
|
+
|
46
|
+
|
1
47
|
## [1.2.1](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.0...vite_ruby@1.2.1) (2021-03-19)
|
2
48
|
|
3
49
|
|
data/lib/tasks/vite.rake
CHANGED
@@ -29,9 +29,9 @@ namespace :vite do
|
|
29
29
|
ViteRuby.commands.verify_install
|
30
30
|
end
|
31
31
|
|
32
|
-
desc '
|
32
|
+
desc 'Ensures build dependencies like Vite are installed when compiling assets'
|
33
33
|
task :install_dependencies do
|
34
|
-
system({ 'NODE_ENV' => 'development' }, 'npx ci')
|
34
|
+
system({ 'NODE_ENV' => 'development' }, 'npx --yes ci')
|
35
35
|
end
|
36
36
|
|
37
37
|
desc "Provide information on ViteRuby's environment"
|
@@ -48,3 +48,9 @@ if Rake::Task.task_defined?('assets:precompile')
|
|
48
48
|
else
|
49
49
|
Rake::Task.define_task('assets:precompile' => ['vite:install_dependencies', 'vite:build'])
|
50
50
|
end
|
51
|
+
|
52
|
+
# Any prerequisite task that installs packages should also install build dependencies.
|
53
|
+
if ARGV.include?('assets:precompile')
|
54
|
+
ENV['NPM_CONFIG_PRODUCTION'] = 'false'
|
55
|
+
ENV['YARN_PRODUCTION'] = 'false'
|
56
|
+
end
|
data/lib/vite_ruby.rb
CHANGED
@@ -17,8 +17,8 @@ class ViteRuby
|
|
17
17
|
ENV_PREFIX = 'VITE_RUBY'
|
18
18
|
|
19
19
|
# Internal: Versions used by default when running `vite install`.
|
20
|
-
DEFAULT_VITE_VERSION = '^2.
|
21
|
-
DEFAULT_PLUGIN_VERSION = '^
|
20
|
+
DEFAULT_VITE_VERSION = '^2.2.3'
|
21
|
+
DEFAULT_PLUGIN_VERSION = '^2.0.2'
|
22
22
|
|
23
23
|
# Internal: Ruby Frameworks that have a companion library for Vite Ruby.
|
24
24
|
SUPPORTED_FRAMEWORKS = %w[rails hanami roda padrino sinatra].freeze
|
@@ -75,7 +75,7 @@ private
|
|
75
75
|
write(package_json, '{}') unless package_json.exist?
|
76
76
|
Dir.chdir(root) do
|
77
77
|
deps = "vite@#{ ViteRuby::DEFAULT_VITE_VERSION } vite-plugin-ruby@#{ ViteRuby::DEFAULT_PLUGIN_VERSION }"
|
78
|
-
stdout, stderr, status = Open3.capture3({
|
78
|
+
stdout, stderr, status = Open3.capture3({}, "npx --yes --package @antfu/ni -- ni -D #{ deps }")
|
79
79
|
stdout, stderr, = Open3.capture3({}, "yarn add -D #{ deps }") unless status.success?
|
80
80
|
say(stdout, "\n", stderr)
|
81
81
|
end
|
@@ -31,9 +31,9 @@ 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
|
-
.sub(vite_asset_url_prefix, '/')
|
35
34
|
.sub(HOST_WITH_PORT_REGEX, '/') # Hanami adds the host and port.
|
36
35
|
.sub('.ts.js', '.ts') # Hanami's javascript helper always adds the extension.
|
36
|
+
.sub(/(\.\w+)\.css$/, '\1') # Rails' stylesheet_link_tag always adds the extension.
|
37
37
|
env['PATH_INFO'], env['QUERY_STRING'] = (env['REQUEST_URI'] = uri).split('?')
|
38
38
|
end
|
39
39
|
|
data/lib/vite_ruby/manifest.rb
CHANGED
@@ -46,6 +46,21 @@ class ViteRuby::Manifest
|
|
46
46
|
prefix_vite_asset('@vite/client') if dev_server_running?
|
47
47
|
end
|
48
48
|
|
49
|
+
# Public: The content of the preamble needed by the React Refresh plugin.
|
50
|
+
def react_refresh_preamble
|
51
|
+
if dev_server_running?
|
52
|
+
<<~REACT_REFRESH
|
53
|
+
<script type="module">
|
54
|
+
import RefreshRuntime from '#{ prefix_vite_asset('@react-refresh') }'
|
55
|
+
RefreshRuntime.injectIntoGlobalHook(window)
|
56
|
+
window.$RefreshReg$ = () => {}
|
57
|
+
window.$RefreshSig$ = () => (type) => type
|
58
|
+
window.__vite_plugin_react_preamble_installed__ = true
|
59
|
+
</script>
|
60
|
+
REACT_REFRESH
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
49
64
|
protected
|
50
65
|
|
51
66
|
# Internal: Strict version of lookup.
|
data/lib/vite_ruby/version.rb
CHANGED
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: 1.2.
|
4
|
+
version: 1.2.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-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -237,8 +237,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
237
237
|
licenses:
|
238
238
|
- MIT
|
239
239
|
metadata:
|
240
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.2.
|
241
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.2.
|
240
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.2.6/vite_ruby
|
241
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.2.6/vite_ruby/CHANGELOG.md
|
242
242
|
post_install_message:
|
243
243
|
rdoc_options: []
|
244
244
|
require_paths:
|