vite_ruby 1.2.3 → 1.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e62cc73b0659d4d93cae3cb3f6f526b08136fc631f68554d628720e3cb5a8bc6
4
- data.tar.gz: 2333f049e0d9656505b089ff8a93a6b464462d860b02e93d9166a7faa8c773c4
3
+ metadata.gz: e208284305c3370dd47dac35ef06af231c8ddd55b13b8870b7f32179e4c350c4
4
+ data.tar.gz: 1390d37229bf7d4139b0df3ce08d7e7b64877e2ad7ec041b7d49722545caa652
5
5
  SHA512:
6
- metadata.gz: c0dd63133d786c0928b2e21d1ac238d048b7320f6178f10d6c8f30b3b0463d2357466d48333e8d05b1b9bb701c5fad7d7fec037cedf165cb6d2cd2557c061d44
7
- data.tar.gz: f6861e9046ce1f0c14ec3715cce93bb6d5b8a3d3b59e5f236c1efa3f900db0c0019d710e05bb038a0bbd20dc621b7c62fd1551381e03c4fd3509f755cde37a25
6
+ metadata.gz: b99b7aaf20cb938245f5f83f61d5aace6ffc40519f139b51b9fa9ecd86c14b9098cfafb0b966e08048d64cb62848ff25b4ee086990b44469a44ec739c61712ba
7
+ data.tar.gz: cf4db82501767990f54d994a0c8fce16404a9d5156ef956990a1b3fb403ddd8a71a8e220f629c03c6d188400cc40176be650a2985dde6d2c677838fa25a87fee
data/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ ## [1.2.8](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.7...vite_ruby@1.2.8) (2021-04-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Don't modify url for minified css when proxying a request ([#71](https://github.com/ElMassimo/vite_ruby/issues/71)) ([d30a577](https://github.com/ElMassimo/vite_ruby/commit/d30a577a8436c4987d7c2e08e7eae68e589eb2a7))
7
+
8
+
9
+
10
+ ## [1.2.7](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.6...vite_ruby@1.2.7) (2021-04-28)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Support Rails 5.1 by avoiding [incorrectly monkeypatched](https://github.com//github.com/rails/rails/blob/5-1-stable/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb/issues/L2-L3) `Array#append` ([1b59551](https://github.com/ElMassimo/vite_ruby/commit/1b5955170b33a528a2b13d7e7e308e8493d97a91))
16
+
17
+
18
+
19
+ ## [1.2.6](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.5...vite_ruby@1.2.6) (2021-04-26)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * 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))
25
+
26
+
27
+
28
+ ## [1.2.5](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.4...vite_ruby@1.2.5) (2021-04-21)
29
+
30
+
31
+ ### Features
32
+
33
+ * Add helpers to enable HMR when using @vitejs/plugin-react-refresh ([a80f286](https://github.com/ElMassimo/vite_ruby/commit/a80f286d4305bbae29ea7cea42a4329a530f43fa))
34
+
35
+
36
+
37
+ ## [1.2.4](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.3...vite_ruby@1.2.4) (2021-04-21)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * Avoid removing `base` from proxied requests to avoid confusion. ([25f79a9](https://github.com/ElMassimo/vite_ruby/commit/25f79a9848df3e6c2ffbeb9bd4fbc44f73e4c68a))
43
+
44
+
45
+
1
46
  ## [1.2.3](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.2...vite_ruby@1.2.3) (2021-04-15)
2
47
 
3
48
 
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.0.3'
21
- DEFAULT_PLUGIN_VERSION = '^1.0.13'
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
@@ -31,10 +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.
37
- .sub(/(\.\w+)\.css$/, '\1') # Rails' stylesheet_link_tag always adds the extension.
36
+ .sub(/(\.(?!min)\w+)\.css$/, '\1') # Rails' stylesheet_link_tag always adds the extension.
38
37
  env['PATH_INFO'], env['QUERY_STRING'] = (env['REQUEST_URI'] = uri).split('?')
39
38
  end
40
39
 
@@ -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.
@@ -28,11 +28,11 @@ private
28
28
  def command_for(args)
29
29
  [config.to_env].tap do |cmd|
30
30
  args = args.clone
31
- cmd.append('node', '--inspect-brk') if args.delete('--inspect')
32
- cmd.append('node', '--trace-deprecation') if args.delete('--trace_deprecation')
33
- cmd.append(vite_executable)
34
- cmd.append(*args)
35
- cmd.append('--mode', config.mode) unless args.include?('--mode') || args.include?('-m')
31
+ cmd.push('node', '--inspect-brk') if args.delete('--inspect')
32
+ cmd.push('node', '--trace-deprecation') if args.delete('--trace_deprecation')
33
+ cmd.push(vite_executable)
34
+ cmd.push(*args)
35
+ cmd.push('--mode', config.mode) unless args.include?('--mode') || args.include?('-m')
36
36
  end
37
37
  end
38
38
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '1.2.3'
4
+ VERSION = '1.2.8'
5
5
  end
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.3
4
+ version: 1.2.8
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-04-15 00:00:00.000000000 Z
11
+ date: 2021-04-29 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.3/vite_ruby
241
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.2.3/vite_ruby/CHANGELOG.md
240
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.2.8/vite_ruby
241
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.2.8/vite_ruby/CHANGELOG.md
242
242
  post_install_message:
243
243
  rdoc_options: []
244
244
  require_paths: