vite_ruby 1.2.16 → 1.2.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7965194ea235189606dac388c19d8b624f54622a666644f93a6ec3ac3bf4dc48
4
- data.tar.gz: f9996a594e4c34d0283e498411e71d37d83b7cd793fc8f76a426f84588f5a7f4
3
+ metadata.gz: ba6a2c2dfa0c80f225fa9779b50aa3937c7cc12d260399c858e5491c6e9b9b9b
4
+ data.tar.gz: 2db29cb4b421ea2e4b96a936924b70abd071f32a3272a3d524296989fefe2c99
5
5
  SHA512:
6
- metadata.gz: bfa35cd809b3034cba60919967a5af1a720ea7c8497e6722d8ebf25a23847c274ebe4da216b79c0f8cadf712c16a20b070514d4bf1b23bb813457e492ddf7cbb
7
- data.tar.gz: 5f35583a17581e6b0fc2f27b068df7420956b6069d5a85447caaa6f3f056ee41d80f8ad6f813836caf8b0a897581c5dee430f0327c634b51d16975c61f010079
6
+ metadata.gz: bd0b836df9e9890ac7de7e7729b11deebb064331bcc30e2df82568feae4c219aa6195848dde7b535f292300dfd888824eeabcd59f08175e4da7e450ef6776363
7
+ data.tar.gz: 93eb9909a490974e14b375b2375173b669523e674877783019b9c09d62ff31e46f1a55c6c00d2b15eeffdfff88326d5670759a4fbef96c767ed53a50a394384d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,25 @@
1
- ## <small>1.2.16 (2021-07-07)</small>
1
+ ## [1.2.20](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.18...vite_ruby@1.2.20) (2021-07-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * use `asset_host` for Vite client if set during development ([89a338c](https://github.com/ElMassimo/vite_ruby/commit/89a338c2f23e6b43af9dadfd937fe29c82a08b10))
7
+ * Watch Windi CSS config file by default if it exists ([842c5eb](https://github.com/ElMassimo/vite_ruby/commit/842c5eb46cd12887f28ed62cb656d81645c7239c))
8
+
9
+
10
+
11
+ ## [1.2.18](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.17...vite_ruby@1.2.18) (2021-07-19)
12
+
13
+ * fix: Proxy entrypoint HMR requests only after verifying the file exists (close #102) ([67c22ec](https://github.com/ElMassimo/vite_ruby/commit/67c22ec)), closes [#102](https://github.com/ElMassimo/vite_ruby/issues/102)
14
+
15
+
16
+ ## [1.2.17](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.16...vite_ruby@1.2.17) (2021-07-12)
17
+
18
+ * fix: Proxy CSS Modules requests to Vite.js with the correct extension (close #98) ([8976872](https://github.com/ElMassimo/vite_ruby/commit/8976872)), closes [#98](https://github.com/ElMassimo/vite_ruby/issues/98)
19
+
20
+
21
+
22
+ ## [1.2.16](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.15...vite_ruby@1.2.16) (2021-07-07)
2
23
 
3
24
  * feat: Enable usage in engines by using `run` from the current instance ([023a61d](https://github.com/ElMassimo/vite_ruby/commit/023a61d))
4
25
 
@@ -102,6 +102,7 @@ private
102
102
  'package.json',
103
103
  'vite.config.ts',
104
104
  'vite.config.js',
105
+ 'windi.config.ts',
105
106
  config.config_path,
106
107
  ].freeze
107
108
  end
@@ -33,7 +33,7 @@ private
33
33
  uri = env.fetch('REQUEST_URI') { [env['PATH_INFO'], env['QUERY_STRING']].reject { |str| str.to_s.strip.empty? }.join('?') }
34
34
  .sub(HOST_WITH_PORT_REGEX, '/') # Hanami adds the host and port.
35
35
  .sub('.ts.js', '.ts') # Hanami's javascript helper always adds the extension.
36
- .sub(/(\.(?!min)\w+)\.css$/, '\1') # Rails' stylesheet_link_tag always adds the extension.
36
+ .sub(/(\.(?!min|module)\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
 
@@ -49,12 +49,16 @@ private
49
49
  end
50
50
 
51
51
  def vite_should_handle?(env)
52
- path, query, referer = env['PATH_INFO'], env['QUERY_STRING'], env['HTTP_REFERER']
52
+ path = env['PATH_INFO']
53
53
  return true if path.start_with?(vite_asset_url_prefix) # Vite asset
54
54
  return true if path.start_with?(VITE_DEPENDENCY_PREFIX) # Packages and imports
55
- return true if query&.start_with?('t=') # Hot Reload for a stylesheet
56
- return true if query&.start_with?('import&') # Hot Reload for an imported entrypoint
57
- return true if referer && URI.parse(referer).path.start_with?(vite_asset_url_prefix) # Entry imported from another entry.
55
+ return true if vite_entrypoint?(path) # HMR for entrypoint stylesheets and imports does not include the prefix
56
+ end
57
+
58
+ # Internal: We want to avoid checking the filesystem if possible
59
+ def vite_entrypoint?(path)
60
+ path.include?('.') &&
61
+ config.resolved_entrypoints_dir.join(path.start_with?('/') ? path[1..-1] : path).file?
58
62
  end
59
63
 
60
64
  def vite_asset_url_prefix
@@ -43,7 +43,7 @@ class ViteRuby::Manifest
43
43
 
44
44
  # Public: The path from where the browser can download the Vite HMR client.
45
45
  def vite_client_src
46
- prefix_vite_asset('@vite/client') if dev_server_running?
46
+ prefix_asset_with_host('@vite/client') if dev_server_running?
47
47
  end
48
48
 
49
49
  # Public: The content of the preamble needed by the React Refresh plugin.
@@ -51,7 +51,7 @@ class ViteRuby::Manifest
51
51
  if dev_server_running?
52
52
  <<~REACT_REFRESH
53
53
  <script type="module">
54
- import RefreshRuntime from '#{ prefix_vite_asset('@react-refresh') }'
54
+ import RefreshRuntime from '#{ prefix_asset_with_host('@react-refresh') }'
55
55
  RefreshRuntime.injectIntoGlobalHook(window)
56
56
  window.$RefreshReg$ = () => {}
57
57
  window.$RefreshSig$ = () => (type) => type
@@ -125,6 +125,12 @@ private
125
125
  File.join("/#{ config.public_output_dir }", path)
126
126
  end
127
127
 
128
+ # Internal: Prefixes an asset with the `asset_host` for tags that do not use
129
+ # the framework tag helpers.
130
+ def prefix_asset_with_host(path)
131
+ File.join(config.asset_host || '/', config.public_output_dir, path)
132
+ end
133
+
128
134
  # Internal: Resolves the paths that reference a manifest entry.
129
135
  def resolve_references(manifest)
130
136
  manifest.each_value do |entry|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '1.2.16'
4
+ VERSION = '1.2.20'
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.16
4
+ version: 1.2.20
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-07-07 00:00:00.000000000 Z
11
+ date: 2021-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -198,8 +198,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
198
198
  licenses:
199
199
  - MIT
200
200
  metadata:
201
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.2.16/vite_ruby
202
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.2.16/vite_ruby/CHANGELOG.md
201
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.2.20/vite_ruby
202
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.2.20/vite_ruby/CHANGELOG.md
203
203
  post_install_message:
204
204
  rdoc_options: []
205
205
  require_paths: