proscenium 0.11.0.pre.6-x86_64-linux → 0.11.0.pre.7-x86_64-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/middleware.rb +3 -4
- data/lib/proscenium/phlex.rb +1 -0
- data/lib/proscenium/railtie.rb +0 -6
- 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: 88c960e2cb342e9d27c84cfc7f14545e9c900876d64c7ae27db96e9c470d387f
|
4
|
+
data.tar.gz: 18c2090d81ccfb1d012d4c8c2a5a72ef66d76555eb3def406dddd17726264238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63ab8a8d80c739cbafaf8f2f5f3b51eb321a856fc5aed3e4aaf5d92b7574b8d0310ce8b476cf7faa09bc104a3365895c67789b70cb86ac8ea61a4cc542e8a644
|
7
|
+
data.tar.gz: e301f752d5a149daf30c11a4c0de268c37a1a5af69761cb92721c8d1850dd25aa43fa895c3fcda566bea2794c6ce9db0a7b353f63567272ab628498ace7df3ee
|
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
|
@@ -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'
|
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: x86_64-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
|