proscenium 0.19.0-x86_64-linux → 0.20.0-x86_64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e686c9d55f815ad70fc17be7ad98bde1bfaf57dd426464a75fda4b3f08fd3d9d
4
- data.tar.gz: 362e72b47cdcb0743cff1ab94e3cc413f2b85e605225fbc2706342760958133a
3
+ metadata.gz: 8abd17f5b817ccc88619b694bfd517ace2b6d6948fabdc82706e4d56c22dd6e5
4
+ data.tar.gz: 685adeb95e985af0bf42e50c06b1451b02bdaf09a133035508e6b8e22e612b06
5
5
  SHA512:
6
- metadata.gz: 17a945e83e1e18faff56b408ef10245dec73b7baea589f41fc5125d7febb89f88463c09b2a868889ee8275879961b2e04cf3b9ef6c6632f1612504aa7d4aa2ae
7
- data.tar.gz: 889ed2b063887281c9aa1e51c28f5c7aad1bc8f400bf5090e7121b0fc6718c9e4584b9c5d5320a99a8029c4cccd1255fffaefa761f648920d879ea45463c390d
6
+ metadata.gz: 19476deb400030a0f1f29f8174280a301a6bf643f1b00ca85830aea77e2d851a7e411d94bc4172c350c7e9c90069ccaabc518400f499205d8abb26a5efc35ca2
7
+ data.tar.gz: c1ec939319766a120a0295f0640ba4d54dcfe6f943cda9151981b7ca8575e8f328558002d672840cdd45859aa04ffc781328ad70230c94949bed9d452f2cbfb1
data/README.md CHANGED
@@ -415,13 +415,17 @@ if (typeof proscenium.env?.UNKNOWN !== "undefined") {
415
415
 
416
416
  ## i18n
417
417
 
418
- Basic support is provided for importing your Rails locale files from `config/locales/*.yml`, exporting them as JSON.
418
+ Support is provided for importing your Rails locale files from `config/locales/*.yml`, exporting them as JSON.
419
419
 
420
420
  ```js
421
421
  import translations from "proscenium/i18n";
422
422
  // translations.en.*
423
423
  ```
424
424
 
425
+ If you have multiple locale files, they will be merged together. into one json object.
426
+
427
+ Note that because it is assumed that you will be consuming these translations in the browser, all keys are converted to camelCase, as per the JavaScript conventions.
428
+
425
429
  ## Javascript
426
430
 
427
431
  By default, Proscenium's output will take advantage of all modern JS features from the ES2022 spec and earlier. For example, `a !== void 0 && a !== null ? a : b` will become `a ?? b` when minifying (enabled by default in production), which makes use of syntax from the ES2020 version of JavaScript. Any syntax feature that is not supported by ES2020 will be transformed into older JavaScript syntax that is more widely supported.
Binary file
@@ -98,7 +98,7 @@ module Proscenium
98
98
  end
99
99
 
100
100
  # Ensures extensions with more than one dot are handled correctly.
101
- filepath = filepath.sub_ext('')
101
+ filepath = filepath.sub_ext('').sub_ext('')
102
102
 
103
103
  sideloaded = []
104
104
 
@@ -13,10 +13,6 @@ module Proscenium
13
13
 
14
14
  def initialize(app)
15
15
  @app = app
16
-
17
- chunks_path = Rails.public_path.join('assets').to_s
18
- headers = Rails.application.config.public_file_server.headers || {}
19
- @chunk_handler = ::ActionDispatch::FileHandler.new(chunks_path, headers:)
20
16
  end
21
17
 
22
18
  def call(env)
@@ -24,23 +20,19 @@ module Proscenium
24
20
 
25
21
  return @app.call(env) if !request.get? && !request.head?
26
22
 
23
+ # If this is a request for an asset chunk, we want to serve it with a very long
24
+ # cache lifetime, since these are content-hashed and will never change.
27
25
  if request.path.match?(%r{^/_asset_chunks/})
28
- response = Rack::Response[*@chunk_handler.attempt(request.env)]
29
- response.etag = request.path.match(/-\$([a-z0-9]+)\$/i)[1]
30
-
31
- if Proscenium.config.cache_query_string && Proscenium.config.cache_max_age
32
- response.cache! Proscenium.config.cache_max_age
33
- end
34
-
35
- if request.fresh?(response)
36
- response.status = 304
37
- response.body = []
38
- end
39
-
40
- return response.finish
26
+ ::ActionDispatch::FileHandler.new(
27
+ Rails.public_path.join('assets').to_s,
28
+ headers: {
29
+ 'Cache-Control' => "public, max-age=#{100.years}, immutable",
30
+ 'etag' => request.path.match(/-\$([a-z0-9]+)\$/i)[1]
31
+ }
32
+ ).attempt(env) || @app.call(env)
33
+ else
34
+ attempt(request) || @app.call(env)
41
35
  end
42
-
43
- attempt(request) || @app.call(env)
44
36
  end
45
37
 
46
38
  private
@@ -9,11 +9,11 @@ module Proscenium
9
9
  result = super
10
10
  return result if !view.controller || !Proscenium.config.side_load
11
11
 
12
- to_sideload = if template.respond_to?(:virtual_path) &&
12
+ to_sideload = if template.respond_to?(:identifier) &&
13
13
  template.respond_to?(:type) && template.type == :html
14
14
  template
15
15
  end
16
- if to_sideload
16
+ if to_sideload && view.controller.respond_to?(:sideload_assets_options)
17
17
  options = view.controller.sideload_assets_options
18
18
  layout = find_layout(layout_name, locals.keys, [formats.first])
19
19
  sideload_template_assets layout, view.controller, options if layout
@@ -40,7 +40,7 @@ module Proscenium
40
40
  options[k] = controller.instance_eval(&options[k]) if options[k].is_a?(Proc)
41
41
  end
42
42
 
43
- Importer.sideload Rails.root.join("app/views/#{tpl.virtual_path}"), **options
43
+ Importer.sideload Pathname.new(tpl.identifier), **options
44
44
  end
45
45
  end
46
46
 
@@ -52,8 +52,9 @@ module Proscenium
52
52
 
53
53
  return result if !view.controller || !Proscenium.config.side_load
54
54
 
55
- if template.respond_to?(:virtual_path) &&
56
- template.respond_to?(:type) && template.type == :html
55
+ if template.respond_to?(:identifier) &&
56
+ template.respond_to?(:type) && template.type == :html &&
57
+ view.controller.respond_to?(:sideload_assets_options)
57
58
  options = view.controller.sideload_assets_options
58
59
  sideload_template_assets layout, options if layout
59
60
  sideload_template_assets template, options
@@ -79,7 +80,7 @@ module Proscenium
79
80
  options[k] = controller.instance_eval(&options[k]) if options[k].is_a?(Proc)
80
81
  end
81
82
 
82
- Importer.sideload Rails.root.join("app/views/#{tpl.virtual_path}"), **options
83
+ Importer.sideload Pathname.new(tpl.identifier), **options
83
84
  end
84
85
  end
85
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
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.20.0
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: 2025-09-08 00:00:00.000000000 Z
11
+ date: 2025-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi