proscenium 0.21.3-x86_64-linux → 0.21.5-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 +4 -4
- data/lib/proscenium/builder.rb +6 -9
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/ext/proscenium.h +1 -1
- data/lib/proscenium/log_subscriber.rb +1 -1
- data/lib/proscenium/middleware/base.rb +12 -1
- data/lib/proscenium/middleware/esbuild.rb +1 -1
- data/lib/proscenium/middleware/silence_request.rb +31 -0
- data/lib/proscenium/middleware.rb +4 -16
- data/lib/proscenium/railtie.rb +8 -1
- data/lib/proscenium/templates/rescues/build_error.html.erb +2 -2
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium.rb +5 -3
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 25f6246c18b9d369a2204c9a41f7b495bb9b109e5bfed0ad47410f11c21e6201
         | 
| 4 | 
            +
              data.tar.gz: 55f1fb615d66307431644cb3fe91aabf299ac23554e88845a15b2d40a1104cfb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5eabc36f8d7ed51c862ec572472eb1af249fc46d16cfea1c7b0412540836c357174e64c7fb6cda9af836c697b0437dcc5c0be5cd0bf6b76cf6b2c013f30c538f
         | 
| 7 | 
            +
              data.tar.gz: 90fc06d003d7e14570ac3c3172160b9d5cc18207af1077a0d134e3000011f4661193785813b5d93637b2db76a4fdaa8d3725d994c064f63f96faad99ff4f4f9d
         | 
    
        data/lib/proscenium/builder.rb
    CHANGED
    
    | @@ -23,6 +23,7 @@ module Proscenium | |
| 23 23 |  | 
| 24 24 | 
             
                  attach_function :build_to_string, [
         | 
| 25 25 | 
             
                    :string, # Path or entry point.
         | 
| 26 | 
            +
                    :string, # cache_query_string.
         | 
| 26 27 | 
             
                    :pointer # Config as JSON.
         | 
| 27 28 | 
             
                  ], Result.by_value
         | 
| 28 29 |  | 
| @@ -58,8 +59,8 @@ module Proscenium | |
| 58 59 | 
             
                  end
         | 
| 59 60 | 
             
                end
         | 
| 60 61 |  | 
| 61 | 
            -
                def self.build_to_string(path, root: nil)
         | 
| 62 | 
            -
                  new(root:).build_to_string(path)
         | 
| 62 | 
            +
                def self.build_to_string(path, cache_query_string: '', root: nil)
         | 
| 63 | 
            +
                  new(root:).build_to_string(path, cache_query_string:)
         | 
| 63 64 | 
             
                end
         | 
| 64 65 |  | 
| 65 66 | 
             
                def self.resolve(path, root: nil)
         | 
| @@ -81,14 +82,14 @@ module Proscenium | |
| 81 82 | 
             
                    RubyGems: Proscenium::BundledGems.paths,
         | 
| 82 83 | 
             
                    Bundle: Proscenium.config.bundle,
         | 
| 83 84 | 
             
                    Aliases: Proscenium.config.aliases,
         | 
| 84 | 
            -
                    QueryString: cache_query_string,
         | 
| 85 | 
            +
                    QueryString: Proscenium.config.cache_query_string.presence || '',
         | 
| 85 86 | 
             
                    Debug: Proscenium.config.debug
         | 
| 86 87 | 
             
                  }.to_json)
         | 
| 87 88 | 
             
                end
         | 
| 88 89 |  | 
| 89 | 
            -
                def build_to_string(path)
         | 
| 90 | 
            +
                def build_to_string(path, cache_query_string: '')
         | 
| 90 91 | 
             
                  ActiveSupport::Notifications.instrument('build.proscenium', identifier: path) do
         | 
| 91 | 
            -
                    result = Request.build_to_string(path, @request_config)
         | 
| 92 | 
            +
                    result = Request.build_to_string(path, cache_query_string, @request_config)
         | 
| 92 93 |  | 
| 93 94 | 
             
                    raise BuildError, result[:response] unless result[:success]
         | 
| 94 95 |  | 
| @@ -115,10 +116,6 @@ module Proscenium | |
| 115 116 | 
             
                  ENV.slice(*Proscenium.config.env_vars + Proscenium::DEFAULT_ENV_VARS)
         | 
| 116 117 | 
             
                end
         | 
| 117 118 |  | 
| 118 | 
            -
                def cache_query_string
         | 
| 119 | 
            -
                  Proscenium.config.cache_query_string.presence || ''
         | 
| 120 | 
            -
                end
         | 
| 121 | 
            -
             | 
| 122 119 | 
             
                def gem_root
         | 
| 123 120 | 
             
                  Pathname.new(__dir__).join('..', '..').to_s
         | 
| 124 121 | 
             
                end
         | 
| Binary file | 
| @@ -90,7 +90,7 @@ extern void reset_config(); | |
| 90 90 | 
             
            // - path - The path to build relative to `root`.
         | 
| 91 91 | 
             
            // - config
         | 
| 92 92 | 
             
            //
         | 
| 93 | 
            -
            extern struct Result build_to_string(char* filePath, char* configJson);
         | 
| 93 | 
            +
            extern struct Result build_to_string(char* filePath, char* cacheQueryString, char* configJson);
         | 
| 94 94 |  | 
| 95 95 | 
             
            // Resolve the given `path` relative to the `root`.
         | 
| 96 96 | 
             
            //
         | 
| @@ -20,7 +20,7 @@ module Proscenium | |
| 20 20 | 
             
                  path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
         | 
| 21 21 |  | 
| 22 22 | 
             
                  info do
         | 
| 23 | 
            -
                    message = "#{color('[Proscenium]', nil, bold: true)} Building /#{path}"
         | 
| 23 | 
            +
                    message = "  #{color('[Proscenium]', nil, bold: true)} Building /#{path}"
         | 
| 24 24 | 
             
                    message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
         | 
| 25 25 | 
             
                  end
         | 
| 26 26 | 
             
                end
         | 
| @@ -40,6 +40,17 @@ module Proscenium | |
| 40 40 | 
             
                    @path_to_build ||= @request.path[1..]
         | 
| 41 41 | 
             
                  end
         | 
| 42 42 |  | 
| 43 | 
            +
                  def cache_query_string
         | 
| 44 | 
            +
                    @cache_query_string ||= begin
         | 
| 45 | 
            +
                      params = @request.query_parameters
         | 
| 46 | 
            +
                      if params.one? && params.first[0] != '' && params.first[1].nil?
         | 
| 47 | 
            +
                        params.keys.first
         | 
| 48 | 
            +
                      else
         | 
| 49 | 
            +
                        Proscenium.config.cache_query_string
         | 
| 50 | 
            +
                      end
         | 
| 51 | 
            +
                    end.presence || ''
         | 
| 52 | 
            +
                  end
         | 
| 53 | 
            +
             | 
| 43 54 | 
             
                  def sourcemap?
         | 
| 44 55 | 
             
                    @request.path.ends_with?('.map')
         | 
| 45 56 | 
             
                  end
         | 
| @@ -86,7 +97,7 @@ module Proscenium | |
| 86 97 | 
             
                    response.content_type = content_type
         | 
| 87 98 | 
             
                    response.etag = result[:content_hash]
         | 
| 88 99 |  | 
| 89 | 
            -
                    if  | 
| 100 | 
            +
                    if !cache_query_string.blank? && Proscenium.config.cache_max_age
         | 
| 90 101 | 
             
                      response.cache! Proscenium.config.cache_max_age
         | 
| 91 102 | 
             
                    end
         | 
| 92 103 |  | 
| @@ -20,7 +20,7 @@ module Proscenium | |
| 20 20 | 
             
                  end
         | 
| 21 21 |  | 
| 22 22 | 
             
                  def attempt
         | 
| 23 | 
            -
                    render_response Builder.build_to_string(path_to_build)
         | 
| 23 | 
            +
                    render_response Builder.build_to_string(path_to_build, cache_query_string:)
         | 
| 24 24 | 
             
                  rescue Builder::CompileError => e
         | 
| 25 25 | 
             
                    raise self.class::CompileError, { file: @request.fullpath, detail: e.message }, caller
         | 
| 26 26 | 
             
                  end
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'active_support/logger_silence'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module Proscenium
         | 
| 6 | 
            +
              class Middleware::SilenceRequest
         | 
| 7 | 
            +
                def initialize(app)
         | 
| 8 | 
            +
                  @app = app
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def call(env)
         | 
| 12 | 
            +
                  request = ActionDispatch::Request.new(env)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  if (request.get? || request.head?) && proscenium_request?(request)
         | 
| 15 | 
            +
                    Rails.logger.silence { @app.call(env) }
         | 
| 16 | 
            +
                  else
         | 
| 17 | 
            +
                    @app.call(env)
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                private
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def proscenium_request?(request)
         | 
| 24 | 
            +
                  return true if request.path.match?(CHUNKS_PATH)
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  pathname = Pathname.new(request.path)
         | 
| 27 | 
            +
                  pathname.fnmatch?(GEMS_PATH_GLOB, File::FNM_EXTGLOB) ||
         | 
| 28 | 
            +
                    pathname.fnmatch?(APP_PATH_GLOB, File::FNM_EXTGLOB)
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
| @@ -4,12 +4,12 @@ module Proscenium | |
| 4 4 | 
             
              class Middleware
         | 
| 5 5 | 
             
                extend ActiveSupport::Autoload
         | 
| 6 6 |  | 
| 7 | 
            -
                # Error when the build command fails.
         | 
| 8 7 | 
             
                class BuildError < StandardError; end
         | 
| 9 8 |  | 
| 10 9 | 
             
                autoload :Base
         | 
| 11 10 | 
             
                autoload :Esbuild
         | 
| 12 11 | 
             
                autoload :RubyGems
         | 
| 12 | 
            +
                autoload :SilenceRequest
         | 
| 13 13 |  | 
| 14 14 | 
             
                def initialize(app)
         | 
| 15 15 | 
             
                  @app = app
         | 
| @@ -22,7 +22,7 @@ module Proscenium | |
| 22 22 |  | 
| 23 23 | 
             
                  # If this is a request for an asset chunk, we want to serve it with a very long
         | 
| 24 24 | 
             
                  # cache lifetime, since these are content-hashed and will never change.
         | 
| 25 | 
            -
                  if request.path.match?( | 
| 25 | 
            +
                  if request.path.match?(CHUNKS_PATH)
         | 
| 26 26 | 
             
                    ::ActionDispatch::FileHandler.new(
         | 
| 27 27 | 
             
                      Rails.public_path.join('assets').to_s,
         | 
| 28 28 | 
             
                      headers: {
         | 
| @@ -46,23 +46,11 @@ module Proscenium | |
| 46 46 | 
             
                def find_type(request)
         | 
| 47 47 | 
             
                  pathname = Pathname.new(request.path)
         | 
| 48 48 |  | 
| 49 | 
            -
                  if pathname.fnmatch?( | 
| 49 | 
            +
                  if pathname.fnmatch?(GEMS_PATH_GLOB, File::FNM_EXTGLOB)
         | 
| 50 50 | 
             
                    RubyGems
         | 
| 51 | 
            -
                  elsif pathname.fnmatch?( | 
| 51 | 
            +
                  elsif pathname.fnmatch?(APP_PATH_GLOB, File::FNM_EXTGLOB)
         | 
| 52 52 | 
             
                    Esbuild
         | 
| 53 53 | 
             
                  end
         | 
| 54 54 | 
             
                end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                def app_path_glob
         | 
| 57 | 
            -
                  "/{#{Proscenium::ALLOWED_DIRECTORIES}}/**.{#{file_extensions}}"
         | 
| 58 | 
            -
                end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                def gems_path_glob
         | 
| 61 | 
            -
                  "/node_modules/@rubygems/**.{#{file_extensions}}"
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                def file_extensions
         | 
| 65 | 
            -
                  @file_extensions ||= FILE_EXTENSIONS.join(',')
         | 
| 66 | 
            -
                end
         | 
| 67 55 | 
             
              end
         | 
| 68 56 | 
             
            end
         | 
    
        data/lib/proscenium/railtie.rb
    CHANGED
    
    | @@ -46,7 +46,10 @@ module Proscenium | |
| 46 46 | 
             
                end
         | 
| 47 47 |  | 
| 48 48 | 
             
                initializer 'proscenium.middleware' do |app|
         | 
| 49 | 
            -
                   | 
| 49 | 
            +
                  unless config.proscenium.logging
         | 
| 50 | 
            +
                    app.middleware.insert_before Rails::Rack::Logger, Proscenium::Middleware::SilenceRequest
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
                  app.middleware.insert_before ActionDispatch::ActionableExceptions, Proscenium::Middleware
         | 
| 50 53 | 
             
                end
         | 
| 51 54 |  | 
| 52 55 | 
             
                initializer 'proscenium.sideloading' do
         | 
| @@ -62,5 +65,9 @@ module Proscenium | |
| 62 65 | 
             
                    ActionView::PartialRenderer.prepend Monkey::PartialRenderer
         | 
| 63 66 | 
             
                  end
         | 
| 64 67 | 
             
                end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                rake_tasks do
         | 
| 70 | 
            +
                  load 'proscenium/railties/compile.rake'
         | 
| 71 | 
            +
                end
         | 
| 65 72 | 
             
              end
         | 
| 66 73 | 
             
            end
         | 
| @@ -19,8 +19,8 @@ | |
| 19 19 |  | 
| 20 20 | 
             
            <%= @exception.error['location']['line'].to_s.rjust 5 %> │    <%= @exception.error['location']['line_text'] %>
         | 
| 21 21 | 
             
                  │    <%= (@exception.error['location']['length'] > 1 ? "~" * @exception.error['location']['length'] : "^").rjust(@exception.error['location']['column'] + @exception.error['location']['length']) %>
         | 
| 22 | 
            -
            <%- if @exception.error['location']['suggestion'].present?  | 
| 23 | 
            -
            <% else %> <%- end  | 
| 22 | 
            +
            <%- if @exception.error['location']['suggestion'].present? %>    + │    <%= @exception.error['location']['suggestion'].rjust(@exception.error['location']['column'] + 1) %>
         | 
| 23 | 
            +
            <% else %> <%- end %>
         | 
| 24 24 | 
             
            </pre>
         | 
| 25 25 | 
             
                  </div>
         | 
| 26 26 | 
             
                </div>
         | 
    
        data/lib/proscenium/version.rb
    CHANGED
    
    
    
        data/lib/proscenium.rb
    CHANGED
    
    | @@ -5,9 +5,6 @@ require 'active_support' | |
| 5 5 | 
             
            module Proscenium
         | 
| 6 6 | 
             
              extend ActiveSupport::Autoload
         | 
| 7 7 |  | 
| 8 | 
            -
              FILE_EXTENSIONS = ['js', 'mjs', 'ts', 'jsx', 'tsx', 'css', 'js.map', 'mjs.map', 'jsx.map',
         | 
| 9 | 
            -
                                 'ts.map', 'tsx.map', 'css.map'].freeze
         | 
| 10 | 
            -
             | 
| 11 8 | 
             
              # Default paths for Rails assets. Used by the `compute_asset_path` helper to maintain Rails
         | 
| 12 9 | 
             
              # default conventions of where JS and CSS files are located.
         | 
| 13 10 | 
             
              DEFAULT_RAILS_ASSET_PATHS = {
         | 
| @@ -15,7 +12,12 @@ module Proscenium | |
| 15 12 | 
             
                javascript: 'app/javascript/'
         | 
| 16 13 | 
             
              }.freeze
         | 
| 17 14 |  | 
| 15 | 
            +
              FILE_EXTENSIONS = ['js', 'mjs', 'ts', 'jsx', 'tsx', 'css', 'js.map', 'mjs.map', 'jsx.map',
         | 
| 16 | 
            +
                                 'ts.map', 'tsx.map', 'css.map'].freeze
         | 
| 18 17 | 
             
              ALLOWED_DIRECTORIES = 'app,lib,config,vendor,node_modules'
         | 
| 18 | 
            +
              APP_PATH_GLOB = "/{#{ALLOWED_DIRECTORIES}}/**.{#{FILE_EXTENSIONS.join(',')}}".freeze
         | 
| 19 | 
            +
              GEMS_PATH_GLOB = "/node_modules/@rubygems/**.{#{FILE_EXTENSIONS.join(',')}}".freeze
         | 
| 20 | 
            +
              CHUNKS_PATH = %r{^/_asset_chunks/}
         | 
| 19 21 |  | 
| 20 22 | 
             
              # Environment variables that should always be passed to the builder.
         | 
| 21 23 | 
             
              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.21. | 
| 4 | 
            +
              version: 0.21.5
         | 
| 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-10- | 
| 11 | 
            +
            date: 2025-10-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: ffi
         | 
| @@ -70,6 +70,7 @@ files: | |
| 70 70 | 
             
            - lib/proscenium/middleware/base.rb
         | 
| 71 71 | 
             
            - lib/proscenium/middleware/esbuild.rb
         | 
| 72 72 | 
             
            - lib/proscenium/middleware/ruby_gems.rb
         | 
| 73 | 
            +
            - lib/proscenium/middleware/silence_request.rb
         | 
| 73 74 | 
             
            - lib/proscenium/monkey.rb
         | 
| 74 75 | 
             
            - lib/proscenium/railtie.rb
         | 
| 75 76 | 
             
            - lib/proscenium/react-manager/index.jsx
         |