opal-vite-rails 0.2.13 → 0.3.13

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: 14d0a172031cb97c3e8edeea1aef19764cc7784aa7371f837fe7bbbd34d8bbdf
4
- data.tar.gz: 32eff08bd3c3b40e2034147ad061c404d6a4357d8fa47d1bc16834a386a7bb5d
3
+ metadata.gz: fb4b027bd6a9af93d8ca80700e7fcadb26251b792e3b0df8f43f72492d680717
4
+ data.tar.gz: 509ab21889bf6c849f0775c051ac6ae98474977fd37fb6251a71d47fce2894f4
5
5
  SHA512:
6
- metadata.gz: c786a60aed283b7ce493a024b4aa2e766a64b6fc8f2c65086268e7d474600a9a3917c8cb8c712a327fd54ccd7a78d0d48c768c8695bb9da3a133a4624b8192f7
7
- data.tar.gz: c243690b8eb9d5ab4eadf840106158a2b9bdc3767dfee6b7d58ee00c6088b28bcd49927be774f36f62f331a77888cffd149e5da6ffe9b5df7831f6da7fd9f52b
6
+ metadata.gz: c598f18eba197fc1cd9c94f6a21c40997cf05dd4626e6f23f29a5de6d28022891784d7a492e668c0f7542d75a0600c19f09999d6eeb5ec2884e40ce70c0c18be
7
+ data.tar.gz: c4eaef2d98bdf29e2c7d09310cac16a72e37c655f1d8e35605e68e190c788710b2975fb709290454a0dce68fade9199cf1ae52350bf8dbb539e4b4dd3dc3f7eb
@@ -18,10 +18,6 @@ module Opal
18
18
  Opal::Vite::Rails.config.public_output_path = app.config.opal_vite.public_output_path
19
19
  end
20
20
 
21
- # Set manifest path from ViteRails
22
- if defined?(ViteRuby)
23
- Opal::Vite::Rails.config.manifest_path = ViteRuby.manifest_path
24
- end
25
21
  end
26
22
 
27
23
  initializer "opal_vite.view_helpers" do
@@ -33,9 +33,17 @@ module Opal
33
33
  end
34
34
 
35
35
  # Get asset path from Vite manifest
36
+ #
37
+ # NOTE: the manifest lives on the ViteRuby *instance* — `ViteRuby.manifest`
38
+ # is not a class-level delegator (it raises NoMethodError), so we go
39
+ # through `ViteRuby.instance`. Use ViteRuby::Manifest#path_for (public)
40
+ # rather than #lookup: #lookup is *protected* and returns the raw manifest
41
+ # entry Hash ({ "file" => "..." }), so `lookup(name).to_s` would emit the
42
+ # Hash's inspect string instead of a URL. #path_for returns the resolved
43
+ # asset URL string.
36
44
  def opal_asset_path(name)
37
45
  if defined?(ViteRuby)
38
- ViteRuby.manifest.lookup(name).to_s
46
+ ViteRuby.instance.manifest.path_for(name)
39
47
  else
40
48
  # Fallback to standard asset path
41
49
  "/#{Opal::Vite::Rails.config.public_output_path}/#{name}"
@@ -39,7 +39,11 @@ module Opal
39
39
  private
40
40
 
41
41
  def default_manifest_path
42
- if defined?(::Rails)
42
+ if defined?(::ViteRuby) && ::ViteRuby.instance.config.respond_to?(:manifest_paths)
43
+ vite_config = ::ViteRuby.instance.config
44
+ vite_config.manifest_paths.first ||
45
+ vite_config.build_output_dir.join('.vite', 'manifest.json')
46
+ elsif defined?(::Rails)
43
47
  ::Rails.public_path.join('vite', 'manifest.json')
44
48
  else
45
49
  'public/vite/manifest.json'
@@ -1,7 +1,7 @@
1
1
  module Opal
2
2
  module Vite
3
3
  module Rails
4
- VERSION = "0.2.13"
4
+ VERSION = "0.3.13"
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,4 @@
1
+ require "ostruct"
1
2
  require "opal-vite"
2
3
  require "rails"
3
4
  require "vite_rails"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-vite-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - stofu1234
@@ -15,14 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.13
18
+ version: '0.3'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.13
25
+ version: '0.3'
26
+ - !ruby/object:Gem::Dependency
27
+ name: ostruct
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0.2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0.2'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: railties
28
42
  requirement: !ruby/object:Gem::Requirement