proscenium 0.22.5 → 0.22.6

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: b734a39a18ceb59865780c1b45743729a196fdf78a39410a9cb13e1693b476ae
4
- data.tar.gz: 9db24bf0455398beebbe5620fd7690552f3bd968949ee179c76c43efef008581
3
+ metadata.gz: 9b42a3d7e81b82be5157c35eafcb6e4a44a220956201026063f3049ab947fad2
4
+ data.tar.gz: cbd55dfbe3c9c9efa8ffc5ec76486d73ba3fc3aceb4b8ae5d2fe8c5fbc7e0369
5
5
  SHA512:
6
- metadata.gz: 0cff8e4f2acf26177b664cd716e1f657a0ff3f53bf6d24ac9b542bf542e08ba1458079331f490c8387d0de88e3d349f4a2ce7e063a5306ba840082364179014c
7
- data.tar.gz: 7dd1ea4ff328e8c54139791dd15177891a3e7a2f02db7f97d593262a761873ba125ac0e15a7825c6a1053f065c3cfdc1a4f061fb2db4b5d86514b74916b39b86
6
+ metadata.gz: 3bb3a8972d11b64e340538f60cbf46612b0166d6fb997cd6850bd692dbe4ea4ebb4fb5472b692a7dbe2b66a27925e8a1eb0f8e78d107827c9a1fbf0bda397022
7
+ data.tar.gz: a5e10df8a12b50a1eddf0aec340760864fd4b174063282f677df62d64bff444a1dc23d8b80936cae79084e3cc153e8c88e22e78f543e6525c2c340e7ea08d0e8
Binary file
@@ -1,38 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/current_attributes'
4
-
5
3
  module Proscenium
6
- class Resolver < ActiveSupport::CurrentAttributes
7
- attribute :resolved unless Rails.env.production?
8
- mattr_accessor :resolved if Rails.env.production?
4
+ class Resolver
5
+ mattr_accessor :resolved, instance_accessor: false, default: {}
9
6
 
10
7
  # Resolve the given `path` to a fully qualified URL path.
11
8
  #
12
- # TODO: cache this across requests in production.
13
- #
14
9
  # @param path [String] URL path, file system path, or bare specifier (ie. NPM package).
15
10
  # @param as_array [Boolean] whether or not to return the manifest path, non-manifest path, and
16
11
  # absolute file system path as an array. Only returns the resolved path if false (default).
17
12
  # @return [String, Array<String>]
18
13
  def self.resolve(path, as_array: false)
19
- self.resolved ||= {}
20
-
21
14
  if path.start_with?('./', '../')
22
15
  raise ArgumentError, '`path` must be an absolute file system or URL path'
23
16
  end
24
17
 
25
- self.resolved[path] ||= if (gem = BundledGems.paths.find { |_, v| path.start_with? "#{v}/" })
26
- vpath = path.sub(/^#{gem.last}/, "@rubygems/#{gem.first}")
27
- [Proscenium::Manifest[vpath], "/node_modules/#{vpath}", path]
28
- elsif path.start_with?("#{Rails.root}/")
29
- vpath = path.delete_prefix(Rails.root.to_s)
30
- [Proscenium::Manifest[vpath], vpath, path]
31
- else
32
- [Proscenium::Manifest[path], *Builder.resolve(path)]
33
- end
18
+ resolved[path] ||= if (gem = BundledGems.paths.find { |_, v| path.start_with? "#{v}/" })
19
+ vpath = path.sub(/^#{gem.last}/, "@rubygems/#{gem.first}")
20
+ [Proscenium::Manifest[vpath], "/node_modules/#{vpath}", path]
21
+ elsif path.start_with?("#{Rails.root}/")
22
+ vpath = path.delete_prefix(Rails.root.to_s)
23
+ [Proscenium::Manifest[vpath], vpath, path]
24
+ else
25
+ [Proscenium::Manifest[path], *Builder.resolve(path)]
26
+ end
27
+
28
+ as_array ? resolved[path] : resolved[path][0] || resolved[path][1]
29
+ end
34
30
 
35
- as_array ? self.resolved[path] : self.resolved[path][0] || self.resolved[path][1]
31
+ def self.reset
32
+ self.resolved = {}
36
33
  end
37
34
  end
38
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.22.5'
4
+ VERSION = '0.22.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proscenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.5
4
+ version: 0.22.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-30 00:00:00.000000000 Z
11
+ date: 2026-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi