proscenium 0.19.0.beta7-x86_64-linux → 0.19.0.beta9-x86_64-linux
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 +4 -4
- data/lib/proscenium/builder.rb +1 -1
- data/lib/proscenium/css_module/rewriter.rb +2 -2
- data/lib/proscenium/css_module.rb +4 -1
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/importer.rb +23 -7
- data/lib/proscenium/log_subscriber.rb +18 -3
- data/lib/proscenium/phlex/css_modules.rb +4 -1
- data/lib/proscenium/railtie.rb +0 -13
- data/lib/proscenium/react_componentable.rb +0 -1
- data/lib/proscenium/side_load.rb +17 -6
- data/lib/proscenium/ui/breadcrumbs/component.rb +0 -2
- data/lib/proscenium/ui/form.rb +0 -2
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium.rb +3 -7
- metadata +18 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04d39d42c27ca3a65dd38d39bf7494c2a8a42d0ed86e73882d92cdc209b3c5c
|
4
|
+
data.tar.gz: bd52e00bd2c2eafaeab5d2a868f6edabf5d7e832f1792dc285fecd1a78a8e546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee53c5ec7c4fa3906ade09464fe5fda71a4bb66d17f768defe69653c3b707cf2ba67f256111470f70ee6c009afac86eaf1ee88c261315e7ad06e8efde479c69c
|
7
|
+
data.tar.gz: 287757c6ad880ef96727e1e19db2387ca612c88609eae22e3d1195abc019a103b20a13afdbb4c1020fb0ad55e7112ee55ed7cf7300a4d9b445dcf789cd2510f5
|
data/lib/proscenium/builder.rb
CHANGED
@@ -85,7 +85,7 @@ module Proscenium
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def build_to_string(path)
|
88
|
-
ActiveSupport::Notifications.instrument('
|
88
|
+
ActiveSupport::Notifications.instrument('build.proscenium', identifier: path) do
|
89
89
|
result = Request.build_to_string(path, @request_config)
|
90
90
|
|
91
91
|
raise BuildError, result[:response] unless result[:success]
|
@@ -27,9 +27,9 @@ module Proscenium
|
|
27
27
|
def css_module_string(name)
|
28
28
|
if (path = Pathname.new(context.path).sub_ext('.module.css')).exist?
|
29
29
|
tname = Transformer.new(path).class_name!(name, name.dup).first
|
30
|
-
"Proscenium::CssModule::Name.new(:@#{name}, '#{tname}')"
|
30
|
+
"Proscenium::CssModule::Name.new(:@#{name}, '#{tname}', #{path})"
|
31
31
|
else
|
32
|
-
"Proscenium::CssModule::Name.new(:@#{name}, css_module(:#{name}))"
|
32
|
+
"Proscenium::CssModule::Name.new(:@#{name}, css_module(:#{name}), nil)"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
Binary file
|
data/lib/proscenium/importer.rb
CHANGED
@@ -24,17 +24,23 @@ module Proscenium
|
|
24
24
|
# @param filepath [String] Absolute URL path (relative to Rails root) of the file to import.
|
25
25
|
# Should be the actual asset file, eg. app.css, some/component.js.
|
26
26
|
# @return [String|nil] the digest of the imported file path if a css module (*.module.css).
|
27
|
-
def import(filepath = nil, **)
|
27
|
+
def import(filepath = nil, sideloaded: false, **)
|
28
28
|
self.imported ||= {}
|
29
29
|
|
30
30
|
filepath = "/node_modules/#{filepath}" if filepath.start_with?('@rubygems/')
|
31
31
|
css_module = filepath.end_with?('.module.css')
|
32
32
|
|
33
33
|
unless self.imported.key?(filepath)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
if sideloaded
|
35
|
+
ActiveSupport::Notifications.instrument 'sideload.proscenium', identifier: filepath,
|
36
|
+
sideloaded: do
|
37
|
+
self.imported[filepath] = { ** }
|
38
|
+
self.imported[filepath][:digest] = Utils.digest(filepath) if css_module
|
39
|
+
end
|
40
|
+
else
|
41
|
+
self.imported[filepath] = { ** }
|
42
|
+
self.imported[filepath][:digest] = Utils.digest(filepath) if css_module
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
css_module ? self.imported[filepath][:digest] : nil
|
@@ -72,12 +78,17 @@ module Proscenium
|
|
72
78
|
end
|
73
79
|
|
74
80
|
def sideload_css(filepath, **)
|
75
|
-
_sideload(filepath,
|
81
|
+
_sideload(filepath, ['.css'], **)
|
82
|
+
end
|
83
|
+
|
84
|
+
def sideload_css_module(filepath, **)
|
85
|
+
_sideload(filepath, ['.module.css'], **)
|
76
86
|
end
|
77
87
|
|
78
88
|
# @param filepath [Pathname] Absolute file system path of the Ruby file to sideload.
|
79
89
|
# @param extensions [Array<String>] Supported file extensions to sideload.
|
80
90
|
# @param options [Hash] Options to pass to `import`.
|
91
|
+
# @return [Array<String>] The imported file paths.
|
81
92
|
# @raise [ArgumentError] if `filepath` is not an absolute file system path.
|
82
93
|
private def _sideload(filepath, extensions, **options) # rubocop:disable Style/AccessModifierDeclarations
|
83
94
|
return unless Proscenium.config.side_load
|
@@ -86,13 +97,18 @@ module Proscenium
|
|
86
97
|
raise ArgumentError, "`filepath` (#{filepath}) must be a `Pathname`, and an absolute path"
|
87
98
|
end
|
88
99
|
|
100
|
+
# Ensures extensions with more than one dot are handled correctly.
|
89
101
|
filepath = filepath.sub_ext('')
|
90
102
|
|
103
|
+
sideloaded = []
|
104
|
+
|
91
105
|
extensions.find do |x|
|
92
106
|
if (fp = filepath.sub_ext(x)).exist?
|
93
|
-
import(Resolver.resolve(fp.to_s), sideloaded:
|
107
|
+
sideloaded << import(Resolver.resolve(fp.to_s), sideloaded: filepath, **options)
|
94
108
|
end
|
95
109
|
end
|
110
|
+
|
111
|
+
sideloaded
|
96
112
|
end
|
97
113
|
|
98
114
|
def each_stylesheet(delete: false)
|
@@ -5,17 +5,32 @@ require 'active_support/log_subscriber'
|
|
5
5
|
module Proscenium
|
6
6
|
class LogSubscriber < ActiveSupport::LogSubscriber
|
7
7
|
def sideload(event)
|
8
|
+
path = event.payload[:identifier]
|
9
|
+
sideloaded = event.payload[:sideloaded]
|
10
|
+
sideloaded = sideloaded.relative_path_from(Rails.root) if sideloaded.is_a?(Pathname)
|
11
|
+
|
12
|
+
info do
|
13
|
+
msg = " #{color('[Proscenium]', nil, bold: true)} Sideloading #{path}"
|
14
|
+
sideloaded.is_a?(Pathname) ? msg << " from #{sideloaded}" : msg
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def build(event)
|
19
|
+
path = event.payload[:identifier]
|
20
|
+
path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
|
21
|
+
|
8
22
|
info do
|
9
|
-
"
|
23
|
+
message = "#{color('[Proscenium]', nil, bold: true)} Building /#{path}"
|
24
|
+
message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
10
25
|
end
|
11
26
|
end
|
12
27
|
|
13
|
-
def
|
28
|
+
def resolve(event)
|
14
29
|
path = event.payload[:identifier]
|
15
30
|
path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
|
16
31
|
|
17
32
|
info do
|
18
|
-
message = " #{color('[Proscenium]', nil, bold: true)}
|
33
|
+
message = " #{color('[Proscenium]', nil, bold: true)} Resolving #{path}"
|
19
34
|
message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
20
35
|
end
|
21
36
|
end
|
@@ -23,8 +23,9 @@ module Proscenium
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def after_template
|
26
|
+
self.class.resolved_css_module_paths ||= Concurrent::Set.new
|
26
27
|
self.class.resolved_css_module_paths.each do |path|
|
27
|
-
Proscenium::Importer.import path
|
28
|
+
Proscenium::Importer.import path, sideloaded: true
|
28
29
|
end
|
29
30
|
|
30
31
|
super
|
@@ -67,6 +68,8 @@ module Proscenium
|
|
67
68
|
if attributes.key?(:class) && (attributes[:class] = tokens(attributes[:class])).include?('@')
|
68
69
|
names = attributes[:class].is_a?(Array) ? attributes[:class] : attributes[:class].split
|
69
70
|
|
71
|
+
self.class.resolved_css_module_paths ||= Concurrent::Set.new
|
72
|
+
|
70
73
|
attributes[:class] = cssm.class_names(*names).map do |name, path|
|
71
74
|
self.class.resolved_css_module_paths << path if path
|
72
75
|
name
|
data/lib/proscenium/railtie.rb
CHANGED
@@ -48,8 +48,6 @@ module Proscenium
|
|
48
48
|
|
49
49
|
initializer 'proscenium.middleware' do |app|
|
50
50
|
app.middleware.insert_after ActionDispatch::Static, Proscenium::Middleware
|
51
|
-
# app.middleware.insert_after ActionDispatch::Static, Rack::ETag, 'no-cache'
|
52
|
-
# app.middleware.insert_after ActionDispatch::Static, Rack::ConditionalGet
|
53
51
|
end
|
54
52
|
|
55
53
|
initializer 'proscenium.sideloading' do
|
@@ -77,14 +75,3 @@ module Proscenium
|
|
77
75
|
end
|
78
76
|
end
|
79
77
|
end
|
80
|
-
|
81
|
-
if Rails.gem_version < Gem::Version.new('7.1.0')
|
82
|
-
class ActionDispatch::DebugView
|
83
|
-
def initialize(assigns)
|
84
|
-
tpl_path = Proscenium::Railtie.root.join('lib', 'proscenium', 'templates').to_s
|
85
|
-
paths = [RESCUES_TEMPLATE_PATH, tpl_path]
|
86
|
-
lookup_context = ActionView::LookupContext.new(paths)
|
87
|
-
super(lookup_context, assigns, nil)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
data/lib/proscenium/side_load.rb
CHANGED
@@ -86,13 +86,14 @@ module Proscenium
|
|
86
86
|
end
|
87
87
|
|
88
88
|
class << self
|
89
|
-
# Side loads the class, and its super classes that respond to `.source_path
|
89
|
+
# Side loads assets for the class, and its super classes that respond to `.source_path`, which
|
90
|
+
# should return a Pathname of the class source file.
|
90
91
|
#
|
91
92
|
# Set the `abstract_class` class variable to true in any class, and it will not be side
|
92
93
|
# loaded.
|
93
94
|
#
|
94
|
-
# If the class responds to `.sideload`, it will be called
|
95
|
-
#
|
95
|
+
# If the class responds to `.sideload`, it will be called after the regular side loading. You
|
96
|
+
# can use this to customise what is side loaded.
|
96
97
|
def sideload_inheritance_chain(obj, options)
|
97
98
|
return unless Proscenium.config.side_load
|
98
99
|
|
@@ -116,18 +117,28 @@ module Proscenium
|
|
116
117
|
|
117
118
|
klass = obj.class
|
118
119
|
while klass.respond_to?(:source_path) && klass.source_path && !klass.abstract_class
|
119
|
-
if
|
120
|
-
klass.sideload options
|
121
|
-
elsif options[:css] == false
|
120
|
+
if options[:css] == false
|
122
121
|
Importer.sideload klass.source_path, **options
|
123
122
|
else
|
124
123
|
Importer.sideload_js klass.source_path, **options
|
125
124
|
css_imports << klass.source_path
|
126
125
|
end
|
127
126
|
|
127
|
+
klass.sideload options if klass.respond_to?(:sideload)
|
128
|
+
|
128
129
|
klass = klass.superclass
|
129
130
|
end
|
130
131
|
|
132
|
+
# All regular CSS files (*.css) are ancestrally sideloaded. However, the first CSS module
|
133
|
+
# in the ancestry is also sideloaded in addition to the regular CSS files. This is because
|
134
|
+
# the CSS module digest will be different for each file, so we only sideload the first CSS
|
135
|
+
# module.
|
136
|
+
css_imports.each do |it|
|
137
|
+
break if Importer.sideload_css_module(it, **options).present?
|
138
|
+
end
|
139
|
+
|
140
|
+
# Sideload regular CSS files in reverse order.
|
141
|
+
#
|
131
142
|
# The reason why we sideload CSS after JS is because the order of CSS is important.
|
132
143
|
# Basically, the layout should be loaded before the view so that CSS cascading works in the
|
133
144
|
# right direction.
|
data/lib/proscenium/ui/form.rb
CHANGED
data/lib/proscenium/version.rb
CHANGED
data/lib/proscenium.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# loader.inflector.inflect 'ui' => 'UI'
|
7
|
-
# loader.ignore "#{__dir__}/proscenium/ext"
|
8
|
-
# loader.ignore "#{__dir__}/proscenium/libs"
|
9
|
-
# loader.setup
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_record/type' # needed by Literal, even though we're not using ActiveRecord
|
5
|
+
require 'literal'
|
10
6
|
|
11
7
|
module Proscenium
|
12
8
|
extend ActiveSupport::Autoload
|
metadata
CHANGED
@@ -1,77 +1,70 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proscenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.0.
|
4
|
+
version: 0.19.0.beta9
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
13
|
+
name: countries
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: 7.1.0
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '9.0'
|
23
19
|
type: :runtime
|
24
20
|
prerelease: false
|
25
21
|
version_requirements: !ruby/object:Gem::Requirement
|
26
22
|
requirements:
|
27
|
-
- - "
|
23
|
+
- - "~>"
|
28
24
|
- !ruby/object:Gem::Version
|
29
25
|
version: 7.1.0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '9.0'
|
33
26
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
27
|
+
name: ffi
|
35
28
|
requirement: !ruby/object:Gem::Requirement
|
36
29
|
requirements:
|
37
30
|
- - "~>"
|
38
31
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
32
|
+
version: 1.17.0
|
40
33
|
type: :runtime
|
41
34
|
prerelease: false
|
42
35
|
version_requirements: !ruby/object:Gem::Requirement
|
43
36
|
requirements:
|
44
37
|
- - "~>"
|
45
38
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
39
|
+
version: 1.17.0
|
47
40
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
41
|
+
name: literal
|
49
42
|
requirement: !ruby/object:Gem::Requirement
|
50
43
|
requirements:
|
51
44
|
- - "~>"
|
52
45
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
46
|
+
version: '1.0'
|
54
47
|
type: :runtime
|
55
48
|
prerelease: false
|
56
49
|
version_requirements: !ruby/object:Gem::Requirement
|
57
50
|
requirements:
|
58
51
|
- - "~>"
|
59
52
|
- !ruby/object:Gem::Version
|
60
|
-
version: 1.
|
53
|
+
version: '1.0'
|
61
54
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
55
|
+
name: phlex-rails
|
63
56
|
requirement: !ruby/object:Gem::Requirement
|
64
57
|
requirements:
|
65
58
|
- - "~>"
|
66
59
|
- !ruby/object:Gem::Version
|
67
|
-
version: '1.
|
60
|
+
version: '1.2'
|
68
61
|
type: :runtime
|
69
62
|
prerelease: false
|
70
63
|
version_requirements: !ruby/object:Gem::Requirement
|
71
64
|
requirements:
|
72
65
|
- - "~>"
|
73
66
|
- !ruby/object:Gem::Version
|
74
|
-
version: '1.
|
67
|
+
version: '1.2'
|
75
68
|
- !ruby/object:Gem::Dependency
|
76
69
|
name: phonelib
|
77
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,7 +80,7 @@ dependencies:
|
|
87
80
|
- !ruby/object:Gem::Version
|
88
81
|
version: 0.10.3
|
89
82
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
83
|
+
name: rails
|
91
84
|
requirement: !ruby/object:Gem::Requirement
|
92
85
|
requirements:
|
93
86
|
- - ">="
|
@@ -112,15 +105,14 @@ dependencies:
|
|
112
105
|
requirements:
|
113
106
|
- - "~>"
|
114
107
|
- !ruby/object:Gem::Version
|
115
|
-
version: 1.
|
108
|
+
version: 1.1.1
|
116
109
|
type: :runtime
|
117
110
|
prerelease: false
|
118
111
|
version_requirements: !ruby/object:Gem::Requirement
|
119
112
|
requirements:
|
120
113
|
- - "~>"
|
121
114
|
- !ruby/object:Gem::Version
|
122
|
-
version: 1.
|
123
|
-
description:
|
115
|
+
version: 1.1.1
|
124
116
|
email:
|
125
117
|
- joel@developwithstyle.com
|
126
118
|
executables: []
|
@@ -245,7 +237,6 @@ metadata:
|
|
245
237
|
source_code_uri: https://github.com/joelmoss/proscenium
|
246
238
|
changelog_uri: https://github.com/joelmoss/proscenium/releases
|
247
239
|
rubygems_mfa_required: 'true'
|
248
|
-
post_install_message:
|
249
240
|
rdoc_options: []
|
250
241
|
require_paths:
|
251
242
|
- lib
|
@@ -260,8 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
251
|
- !ruby/object:Gem::Version
|
261
252
|
version: '0'
|
262
253
|
requirements: []
|
263
|
-
rubygems_version: 3.5
|
264
|
-
signing_key:
|
254
|
+
rubygems_version: 3.6.5
|
265
255
|
specification_version: 4
|
266
256
|
summary: The engine powering your Rails frontend
|
267
257
|
test_files: []
|