proscenium 0.11.0.pre.5-aarch64-linux → 0.11.0.pre.7-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -8
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/helper.rb +20 -3
- data/lib/proscenium/libs/react-manager/index.jsx +23 -19
- data/lib/proscenium/middleware.rb +3 -4
- data/lib/proscenium/phlex.rb +1 -0
- data/lib/proscenium/railtie.rb +0 -6
- data/lib/proscenium/react_componentable.rb +4 -3
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium.rb +1 -2
- 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: e1ee6cce6b3894e20caf601ef5773c0590f1f45294caddbf3bb9c1a928e58442
|
4
|
+
data.tar.gz: b7632f5101baaf4b817549e6996e89cff43bfc5cbcb82231779c35103675e278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13d5ee5faaf01aa581320381983e7b86f331afd9ab56c1298384ac36b804f541acd4e5cfe673ef26b505ec310237768a13b09bdbd57b8d547b9ae11310c1de73
|
7
|
+
data.tar.gz: 55b6b9c95b56f7f478272c4ea4d3bf450806a793af869d609250ca0032bf37307aaf0e0dd9dfc377d406b9c392c08174c712daa52f0d5a4c0579aa67223d3388
|
data/README.md
CHANGED
@@ -757,19 +757,18 @@ Rails.application.config.proscenium.cache_max_age = 12.months.to_i
|
|
757
757
|
|
758
758
|
Proscenium brings back RJS! Any path ending in .rjs will be served from your Rails app. This allows you to import server rendered javascript.
|
759
759
|
|
760
|
-
## Serving from Ruby Gem
|
761
|
-
|
762
|
-
*docs needed*
|
763
760
|
|
764
761
|
## Included Paths
|
765
762
|
|
766
|
-
|
763
|
+
Proscenium will serve files ending with any of these extension: `js,mjs,ts,css,jsx,tsx` from the following directories, and their sub-directories: `/app`, `/lib`, `/config`, `/node_modules`, `/vendor`.
|
767
764
|
|
768
|
-
|
765
|
+
So a file at `/app/views/users/index.js` will be served from `https://yourapp.com/app/views/users/index.js`.
|
769
766
|
|
770
|
-
|
771
|
-
|
772
|
-
|
767
|
+
You can continue to access any file in the `/public` directory as you normally would, but any file ending with a supported extension (`js,mjs,ts,css,jsx,tsx`) will be processed by Proscenium. For example, `/public/some/file.js` will be served from `https://yourapp.com/some/file.js`.
|
768
|
+
|
769
|
+
## Serving from Ruby Gems and Rails Engines
|
770
|
+
|
771
|
+
Proscenium can serve assets from Ruby Gems and Rails Engines.
|
773
772
|
|
774
773
|
## Thanks
|
775
774
|
|
Binary file
|
data/lib/proscenium/helper.rb
CHANGED
@@ -35,7 +35,14 @@ module Proscenium
|
|
35
35
|
alias side_load_stylesheets include_stylesheets
|
36
36
|
deprecate side_load_stylesheets: 'Use `include_stylesheets` instead', deprecator: Deprecator.new
|
37
37
|
|
38
|
-
|
38
|
+
# Includes all javascripts that have been imported and side loaded.
|
39
|
+
#
|
40
|
+
# @param extract_lazy_scripts [Boolean] if true, any lazy scripts will be extracted using
|
41
|
+
# `content_for` to `:proscenium_lazy_scripts` for later use. Be sure to include this in your
|
42
|
+
# page with the `declare_lazy_scripts` helper, or simply
|
43
|
+
# `content_for :proscenium_lazy_scripts`.
|
44
|
+
# @return [String] the HTML tags for the javascripts.
|
45
|
+
def include_javascripts(extract_lazy_scripts: false, **options) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
39
46
|
out = []
|
40
47
|
|
41
48
|
if Rails.application.config.proscenium.code_splitting && Importer.multiple_js_imported?
|
@@ -66,9 +73,15 @@ module Proscenium
|
|
66
73
|
end
|
67
74
|
end
|
68
75
|
|
69
|
-
|
76
|
+
if extract_lazy_scripts
|
77
|
+
content_for :proscenium_lazy_scripts do
|
78
|
+
javascript_tag "window.prosceniumLazyScripts = #{scripts.to_json}"
|
79
|
+
end
|
80
|
+
else
|
81
|
+
out << javascript_tag("window.prosceniumLazyScripts = #{scripts.to_json}")
|
82
|
+
end
|
70
83
|
else
|
71
|
-
Importer.each_javascript(delete: true) do |path,
|
84
|
+
Importer.each_javascript(delete: true) do |path, _|
|
72
85
|
out << javascript_include_tag(path, extname: false, **options)
|
73
86
|
end
|
74
87
|
end
|
@@ -77,5 +90,9 @@ module Proscenium
|
|
77
90
|
end
|
78
91
|
alias side_load_javascripts include_javascripts
|
79
92
|
deprecate side_load_javascripts: 'Use `include_javascripts` instead', deprecator: Deprecator.new
|
93
|
+
|
94
|
+
def declare_lazy_scripts
|
95
|
+
content_for :proscenium_lazy_scripts
|
96
|
+
end
|
80
97
|
end
|
81
98
|
end
|
@@ -31,27 +31,31 @@ function init() {
|
|
31
31
|
"prosceniumComponentForwardChildren" in element.dataset &&
|
32
32
|
element.innerHTML !== "";
|
33
33
|
|
34
|
-
Promise.all([react, Component])
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
Promise.all([react, Component])
|
35
|
+
.then(([r, c]) => {
|
36
|
+
if (proscenium.env.RAILS_ENV === "development") {
|
37
|
+
console.groupCollapsed(
|
38
|
+
`[proscenium/react/manager] 🔥 %o mounted!`,
|
39
|
+
path
|
40
|
+
);
|
41
|
+
console.log("props: %o", props);
|
42
|
+
console.groupEnd();
|
43
|
+
}
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
let component;
|
46
|
+
if (forwardChildren) {
|
47
|
+
component = r.createElement(c.default, props, element.innerHTML);
|
48
|
+
} else if (children) {
|
49
|
+
component = r.createElement(c.default, props, children);
|
50
|
+
} else {
|
51
|
+
component = r.createElement(c.default, props);
|
52
|
+
}
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
r.createRoot(element).render(component);
|
55
|
+
})
|
56
|
+
.catch((error) => {
|
57
|
+
console.error("[proscenium/react/manager] %o - %o", path, error);
|
58
|
+
});
|
55
59
|
}
|
56
60
|
|
57
61
|
Array.from(elements, (element) => {
|
@@ -43,12 +43,11 @@ module Proscenium
|
|
43
43
|
return Url if request.path.match?(%r{^/https?%3A%2F%2F})
|
44
44
|
return Runtime if request.path.match?(%r{^/@proscenium/})
|
45
45
|
|
46
|
-
Esbuild if Pathname.new(request.path).fnmatch?(
|
46
|
+
Esbuild if Pathname.new(request.path).fnmatch?(app_path_glob, File::FNM_EXTGLOB)
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
|
51
|
-
"/{#{paths}}/**.{#{FILE_EXTENSIONS.join(',')}}"
|
49
|
+
def app_path_glob
|
50
|
+
"/{#{Proscenium::ALLOWED_DIRECTORIES.join(',')}}/**.{#{FILE_EXTENSIONS.join(',')}}"
|
52
51
|
end
|
53
52
|
|
54
53
|
# TODO: handle precompiled assets
|
data/lib/proscenium/phlex.rb
CHANGED
data/lib/proscenium/railtie.rb
CHANGED
@@ -19,7 +19,6 @@ module Proscenium
|
|
19
19
|
config.proscenium.debug = false
|
20
20
|
config.proscenium.side_load = true
|
21
21
|
config.proscenium.code_splitting = true
|
22
|
-
config.proscenium.include_paths = Set.new(APPLICATION_INCLUDE_PATHS)
|
23
22
|
|
24
23
|
# TODO: implement!
|
25
24
|
config.proscenium.cache_query_string = Rails.env.production? && ENV.fetch('REVISION', nil)
|
@@ -48,11 +47,6 @@ module Proscenium
|
|
48
47
|
# }
|
49
48
|
config.proscenium.side_load_gems = {}
|
50
49
|
|
51
|
-
initializer 'proscenium.configuration' do |app|
|
52
|
-
options = app.config.proscenium
|
53
|
-
options.include_paths = Set.new(APPLICATION_INCLUDE_PATHS) if options.include_paths.blank?
|
54
|
-
end
|
55
|
-
|
56
50
|
initializer 'proscenium.middleware' do |app|
|
57
51
|
app.middleware.insert_after ActionDispatch::Static, Middleware
|
58
52
|
app.middleware.insert_after ActionDispatch::Static, Rack::ETag, 'no-cache'
|
@@ -38,13 +38,14 @@ module Proscenium
|
|
38
38
|
class_attribute :lazy, default: false
|
39
39
|
|
40
40
|
class_attribute :loader
|
41
|
+
|
42
|
+
# @return [String] the URL path to the component manager.
|
43
|
+
class_attribute :manager, default: '/@proscenium/react-manager/index.jsx'
|
41
44
|
end
|
42
45
|
|
43
46
|
class_methods do
|
44
|
-
# Import only the component manager. The component itself is side loaded in the initializer,
|
45
|
-
# so that it can be lazy loaded based on the value of the `lazy` instance variable.
|
46
47
|
def sideload
|
47
|
-
Importer.import
|
48
|
+
Importer.import manager
|
48
49
|
Importer.sideload source_path, lazy: true
|
49
50
|
end
|
50
51
|
end
|
data/lib/proscenium/version.rb
CHANGED
data/lib/proscenium.rb
CHANGED
@@ -8,8 +8,7 @@ module Proscenium
|
|
8
8
|
FILE_EXTENSIONS = ['js', 'mjs', 'ts', 'jsx', 'tsx', 'css', 'js.map', 'mjs.map', 'jsx.map',
|
9
9
|
'ts.map', 'tsx.map', 'css.map'].freeze
|
10
10
|
|
11
|
-
|
12
|
-
'node_modules'].freeze
|
11
|
+
ALLOWED_DIRECTORIES = %w[app lib config vendor node_modules].freeze
|
13
12
|
|
14
13
|
# Environment variables that should always be passed to the builder.
|
15
14
|
DEFAULT_ENV_VARS = Set['RAILS_ENV', 'NODE_ENV'].freeze
|
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.11.0.pre.
|
4
|
+
version: 0.11.0.pre.7
|
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: 2023-09-
|
11
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|