proscenium 0.19.0.beta7-aarch64-linux → 0.19.0.beta8-aarch64-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 +1 -1
- data/lib/proscenium/react_componentable.rb +0 -1
- data/lib/proscenium/side_load.rb +17 -6
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium.rb +1 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 404958b92b7c4c7b403452181011ebb130ae87da1ebfcdb447db6b5a8d7c985a
|
4
|
+
data.tar.gz: 3415f136e50e9a2c4deb0714a603f19774e2858df274ad4f6efea12a383d528e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50afe55df921b523513563ce52e4a8ee052dab53399365f069ec7492edf17be074e12ddd815aaaaf5ed4c01a69cb9a2bd31f7f00e49de919417f50ad1403eebe
|
7
|
+
data.tar.gz: 14d69418c2721ca47952682d1bff242fcbbcf89321bfb38cd6c2bf958ec9ff431ef62b91ed9428e6c6cfa30ab573ebe110af14e996562ced58cf9702807e30af
|
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
|
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/version.rb
CHANGED
data/lib/proscenium.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# loader = Zeitwerk::Loader.for_gem
|
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'
|
10
4
|
|
11
5
|
module Proscenium
|
12
6
|
extend ActiveSupport::Autoload
|
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.19.0.
|
4
|
+
version: 0.19.0.beta8
|
5
5
|
platform: aarch64-linux
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|