proscenium 0.11.0.pre.6-arm64-darwin → 0.11.0.pre.7-arm64-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 +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: 6d2a8d1e6399504416c64f479d6a8f64a0709ea3de1709f4ac0f810a17f01bfe
|
4
|
+
data.tar.gz: f9b8d09284eedcb5d641e7953f8d0cddb1dae44f861bb1a5c613ad036d956cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 740af4c4b5b17492e44048ed5d9de7286b8a44f991c226ebb8d6b2b1245561747ba87a29ba6283366893a45457c26ad54a140e7ca462949720fc49226e728ca5
|
7
|
+
data.tar.gz: dce0e163a53a6cafe296cfcceeca3586cb81680de8eb80b0bd1608524759cc7ae5e1a4f5520ab672605ff6f563b223fe7f2ef2be21335bf06917f4c3fa3fa773
|
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: arm64-darwin
|
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
|