proscenium 0.15.0.beta.6-x86_64-darwin → 0.16.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/proscenium/builder.rb +3 -3
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/importer.rb +22 -5
- data/lib/proscenium/log_subscriber.rb +2 -2
- data/lib/proscenium/middleware/esbuild.rb +1 -1
- data/lib/proscenium/middleware.rb +1 -1
- data/lib/proscenium/phlex/react_component.rb +2 -2
- data/lib/proscenium/railtie.rb +1 -1
- data/lib/proscenium/side_load.rb +14 -2
- data/lib/proscenium/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 479d3b5ead246fb0f02afc95f9b274cf45eda3e8cf36dd2d9da25e9204e39433
|
4
|
+
data.tar.gz: a95291f48d2f582f9781f7a504ee35317ff5ac5c6b12b7cedf5a7b3f1934e971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9b5ab728976d9d3b80435e9ae5a9103fde26d1926ca0bf30cf49853f34cfc50e7aad197ee8e842e08c874d0c4dfc8a5c4a2113ca1fd6350df291c25700117ff
|
7
|
+
data.tar.gz: f3f75fec50b5324ff608e40ec683c21212bf3d4495d8a81eb87db86fc8008bd6be857d09a85643c757b26caf68cb5ce8bc7614ac4c20a2b3138d66d51daef985
|
data/README.md
CHANGED
@@ -415,7 +415,7 @@ By default, Proscenium's output will take advantage of all modern JS features. F
|
|
415
415
|
|
416
416
|
### Tree Shaking
|
417
417
|
|
418
|
-
Tree shaking is the term the JavaScript community uses for dead code elimination, a common compiler optimization that automatically removes unreachable code. Tree shaking is enabled by default in
|
418
|
+
Tree shaking is the term the JavaScript community uses for dead code elimination, a common compiler optimization that automatically removes unreachable code. Tree shaking is enabled by default in Proscenium.
|
419
419
|
|
420
420
|
```javascript
|
421
421
|
function one() {
|
data/lib/proscenium/builder.rb
CHANGED
@@ -84,15 +84,15 @@ module Proscenium
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.build_to_path(path, root: nil, base_url: nil)
|
87
|
-
new(root
|
87
|
+
new(root:, base_url:).build_to_path(path)
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.build_to_string(path, root: nil, base_url: nil)
|
91
|
-
new(root
|
91
|
+
new(root:, base_url:).build_to_string(path)
|
92
92
|
end
|
93
93
|
|
94
94
|
def self.resolve(path, root: nil)
|
95
|
-
new(root:
|
95
|
+
new(root:).resolve(path)
|
96
96
|
end
|
97
97
|
|
98
98
|
def initialize(root: nil, base_url: nil)
|
Binary file
|
data/lib/proscenium/importer.rb
CHANGED
@@ -25,7 +25,7 @@ module Proscenium
|
|
25
25
|
# Should be the actual asset file, eg. app.css, some/component.js.
|
26
26
|
# @param resolve [String] description of the file to resolve and import.
|
27
27
|
# @return [String] the digest of the imported file path if a css module (*.module.css).
|
28
|
-
def import(filepath = nil, resolve: nil, **
|
28
|
+
def import(filepath = nil, resolve: nil, **)
|
29
29
|
self.imported ||= {}
|
30
30
|
|
31
31
|
filepath = Resolver.resolve(resolve) if !filepath && resolve
|
@@ -34,7 +34,7 @@ module Proscenium
|
|
34
34
|
unless self.imported.key?(filepath)
|
35
35
|
# ActiveSupport::Notifications.instrument('sideload.proscenium', identifier: value)
|
36
36
|
|
37
|
-
self.imported[filepath] = { **
|
37
|
+
self.imported[filepath] = { ** }
|
38
38
|
self.imported[filepath][:digest] = Utils.digest(filepath) if css_module
|
39
39
|
end
|
40
40
|
|
@@ -61,19 +61,36 @@ module Proscenium
|
|
61
61
|
#
|
62
62
|
# @param filepath [Pathname] Absolute file system path of the Ruby file to sideload.
|
63
63
|
def sideload(filepath, **options)
|
64
|
+
return if !Proscenium.config.side_load || (options[:js] == false && options[:css] == false)
|
65
|
+
|
66
|
+
sideload_js(filepath, **options) unless options[:js] == false
|
67
|
+
sideload_css(filepath, **options) unless options[:css] == false
|
68
|
+
end
|
69
|
+
|
70
|
+
def sideload_js(filepath, **options)
|
64
71
|
return unless Proscenium.config.side_load
|
65
72
|
|
66
73
|
filepath = Rails.root.join(filepath) unless filepath.is_a?(Pathname)
|
67
74
|
filepath = filepath.sub_ext('')
|
68
75
|
|
69
|
-
|
76
|
+
JS_EXTENSIONS.find do |x|
|
70
77
|
if (fp = filepath.sub_ext(x)).exist?
|
71
78
|
import(Resolver.resolve(fp.to_s), sideloaded: true, **options)
|
72
79
|
end
|
73
80
|
end
|
81
|
+
end
|
74
82
|
|
75
|
-
|
76
|
-
|
83
|
+
def sideload_css(filepath, **options)
|
84
|
+
return unless Proscenium.config.side_load
|
85
|
+
|
86
|
+
filepath = Rails.root.join(filepath) unless filepath.is_a?(Pathname)
|
87
|
+
filepath = filepath.sub_ext('')
|
88
|
+
|
89
|
+
CSS_EXTENSIONS.find do |x|
|
90
|
+
if (fp = filepath.sub_ext(x)).exist?
|
91
|
+
import(Resolver.resolve(fp.to_s), sideloaded: true, **options)
|
92
|
+
end
|
93
|
+
end
|
77
94
|
end
|
78
95
|
|
79
96
|
def each_stylesheet(delete: false)
|
@@ -16,7 +16,7 @@ module Proscenium
|
|
16
16
|
path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
|
17
17
|
|
18
18
|
info do
|
19
|
-
message =
|
19
|
+
message = " #{color('[Proscenium]', nil, bold: true)} Building (to path) #{path}"
|
20
20
|
message << " (Duration: #{event.duration.round(1)}ms | " \
|
21
21
|
"Allocations: #{event.allocations}#{cached})"
|
22
22
|
end
|
@@ -27,7 +27,7 @@ module Proscenium
|
|
27
27
|
path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
|
28
28
|
|
29
29
|
info do
|
30
|
-
message =
|
30
|
+
message = " #{color('[Proscenium]', nil, bold: true)} Building #{path}"
|
31
31
|
message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
32
32
|
end
|
33
33
|
end
|
@@ -18,7 +18,7 @@ module Proscenium
|
|
18
18
|
|
19
19
|
chunks_path = Rails.public_path.join('assets').to_s
|
20
20
|
headers = Rails.application.config.public_file_server.headers || {}
|
21
|
-
@chunk_handler = ::ActionDispatch::FileHandler.new(chunks_path, headers:
|
21
|
+
@chunk_handler = ::ActionDispatch::FileHandler.new(chunks_path, headers:)
|
22
22
|
end
|
23
23
|
|
24
24
|
def call(env)
|
@@ -25,8 +25,8 @@ module Proscenium
|
|
25
25
|
# end
|
26
26
|
#
|
27
27
|
# @yield the given block to a `div` within the top level component div.
|
28
|
-
def view_template(**attributes, &
|
29
|
-
send
|
28
|
+
def view_template(**attributes, &)
|
29
|
+
send(root_tag, **{ data: data_attributes }.deep_merge(attributes), &)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/proscenium/railtie.rb
CHANGED
@@ -88,7 +88,7 @@ module Proscenium
|
|
88
88
|
index = app.config.public_file_server.index_name || 'index'
|
89
89
|
|
90
90
|
app.middleware.insert_after(ActionDispatch::Static, ActionDispatch::Static,
|
91
|
-
root.join('public').to_s, index
|
91
|
+
root.join('public').to_s, index:, headers:)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
data/lib/proscenium/side_load.rb
CHANGED
@@ -76,7 +76,7 @@ module Proscenium
|
|
76
76
|
next unless imports.key?(inpath)
|
77
77
|
|
78
78
|
if (import = imports[inpath]).delete(:lazy)
|
79
|
-
scripts[inpath] = import.merge(outpath:
|
79
|
+
scripts[inpath] = import.merge(outpath:)
|
80
80
|
else
|
81
81
|
opts = import[:js].is_a?(Hash) ? import[:js] : {}
|
82
82
|
out << helpers.javascript_include_tag(outpath, extname: false, **opts)
|
@@ -127,16 +127,28 @@ module Proscenium
|
|
127
127
|
options[k] = obj.instance_eval(&options[k]) if options[k].is_a?(Proc)
|
128
128
|
end
|
129
129
|
|
130
|
+
css_imports = []
|
131
|
+
|
130
132
|
klass = obj.class
|
131
133
|
while klass.respond_to?(:source_path) && klass.source_path && !klass.abstract_class
|
132
134
|
if klass.respond_to?(:sideload)
|
133
135
|
klass.sideload options
|
134
|
-
|
136
|
+
elsif options[:css] == false
|
135
137
|
Importer.sideload klass.source_path, **options
|
138
|
+
else
|
139
|
+
Importer.sideload_js klass.source_path, **options
|
140
|
+
css_imports << klass.source_path
|
136
141
|
end
|
137
142
|
|
138
143
|
klass = klass.superclass
|
139
144
|
end
|
145
|
+
|
146
|
+
# The reason why we sideload CSS after JS is because the order of CSS is important.
|
147
|
+
# Basically, the layout should be loaded before the view so that CSS cascading works i9n the
|
148
|
+
# right direction.
|
149
|
+
css_imports.reverse_each do |it|
|
150
|
+
Importer.sideload_css it, **options
|
151
|
+
end
|
140
152
|
end
|
141
153
|
end
|
142
154
|
end
|
data/lib/proscenium/version.rb
CHANGED
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.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.1.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '8.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 7.1.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8.0'
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 1.
|
67
|
+
version: 1.17.0
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 1.
|
74
|
+
version: 1.17.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: oj
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 7.1.0
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '8.0'
|
@@ -116,7 +116,7 @@ dependencies:
|
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: 7.1.0
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '8.0'
|
@@ -214,14 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
requirements:
|
215
215
|
- - ">="
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version: 2.
|
217
|
+
version: 3.2.0
|
218
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - "
|
220
|
+
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
222
|
+
version: '0'
|
223
223
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
224
|
+
rubygems_version: 3.5.21
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: The engine powering your Rails frontend
|