proscenium 0.19.0.beta20-aarch64-linux → 0.20.1-aarch64-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/README.md +26 -16
- data/lib/proscenium/builder.rb +1 -0
- data/lib/proscenium/css_module/transformer.rb +1 -1
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/helper.rb +0 -12
- data/lib/proscenium/importer.rb +1 -1
- data/lib/proscenium/middleware.rb +11 -19
- data/lib/proscenium/monkey.rb +11 -6
- data/lib/proscenium/side_load.rb +2 -2
- data/lib/proscenium/version.rb +1 -1
- 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: 28ed5747f1236ed671362608d6b583222e16caa7470ea346b36022b5d5a39bb1
         | 
| 4 | 
            +
              data.tar.gz: 46da7b18e904838d58c1b254fe682a241edc063ab42a03b104217f74fff43f29
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 505967944874552217043231ae8995bd4fbff5268c3586ebc0b7b9cf61c2cd186e5bf9d467ed4b654e0e4eb2e0b4a44e61e85827dbbdc8064efbd5e26536ae21
         | 
| 7 | 
            +
              data.tar.gz: af7dc7cff7cae2cd668c65399cd779f1d7c5e141749cd8ab66d0aff2e06212da36e5a7a3a4a8c5611d5e68c566f62f0c578e498b81c0ec84943789116de980ba
         | 
    
        data/README.md
    CHANGED
    
    | @@ -6,17 +6,17 @@ | |
| 6 6 | 
             
            >
         | 
| 7 7 | 
             
            > - _the part of a theatre stage in front of the curtain._
         | 
| 8 8 |  | 
| 9 | 
            -
            **_Proscenium_** treats your frontend and client-side code as first class citizens of your Rails app, and assumes a "fast by default" internet. It bundles and minifies JavaScript (+ | 
| 9 | 
            +
            **_Proscenium_** treats your frontend and client-side code as first class citizens of your Rails app, and assumes a "fast by default" internet. It bundles and minifies JavaScript (+JSX), TypeScript (+TSX) and CSS in real time, on demand, and with zero configuration.
         | 
| 10 10 |  | 
| 11 11 | 
             
            **The highlights:**
         | 
| 12 12 |  | 
| 13 13 | 
             
            - Fast, real-time bundling, tree-shaking, code-splitting and minification of Javascript (.js,.jsx), Typescript (.ts,.tsx) and CSS (.css).
         | 
| 14 14 | 
             
            - NO JavaScript runtime needed (eg. Node) - just the browser!
         | 
| 15 15 | 
             
            - NO build step or pre-compilation.
         | 
| 16 | 
            -
            - NO additional process or server - Just run `rails  | 
| 16 | 
            +
            - NO additional process or server - Just run `rails server`!
         | 
| 17 17 | 
             
            - Transforms newer JavaScript and CSS syntax to older syntax for older browsers.
         | 
| 18 18 | 
             
            - Deep integration with Rails.
         | 
| 19 | 
            -
            - Automatically side-load your layouts, views, and partials.
         | 
| 19 | 
            +
            - Automatically side-load JS and CSS for your layouts, views, and partials.
         | 
| 20 20 | 
             
            - Import from NPM, URL's, and locally.
         | 
| 21 21 | 
             
            - Server-side import map support.
         | 
| 22 22 | 
             
            - CSS Modules & mixins.
         | 
| @@ -75,15 +75,15 @@ gem 'proscenium' | |
| 75 75 |  | 
| 76 76 | 
             
            Please note that Proscenium is designed solely for use with Rails.
         | 
| 77 77 |  | 
| 78 | 
            -
            Now if you start your Rails app, you can open any front end code (JS, CSS, etc.). For example, a file at `app/assets/stylesheets/application.css` can be accessed at `https://localhost:3000/app/assets/stylesheets/application.css`, which will be  | 
| 78 | 
            +
            Now if you start your Rails app, you can open any front end code (JS, CSS, etc.). For example, a file at `app/assets/stylesheets/application.css` can be accessed at `https://localhost:3000/app/assets/stylesheets/application.css`, which will be transformed, bundled, and minified [in production] in real time.
         | 
| 79 79 |  | 
| 80 80 | 
             
            ## Client-Side Code Anywhere
         | 
| 81 81 |  | 
| 82 | 
            -
            Proscenium believes that your frontend code is just as important as your backend code, and is not an afterthought - they should be first class citizens of your Rails app. So instead of having to throw all your JS and CSS into a "app/assets" directory, and then requiring a separate process to compile or bundle,  | 
| 82 | 
            +
            Proscenium believes that your frontend code is just as important as your backend code, and is not an afterthought - they should be first class citizens of your Rails app. So instead of having to throw all your JS and CSS into a "app/assets" directory, and then requiring a separate process to compile or bundle, you can simply put them wherever you want within your app, and just run Rails!
         | 
| 83 83 |  | 
| 84 84 | 
             
            For example, if you have some JS that is required by your `app/views/users/index.html.erb` view, just create a JS file alongside it at `app/views/users/index.js`. Or if you have some CSS that is used by your entire application, put it in `app/views/layouts/application.css` and load it alongside your layout. Maybe you have a few JS utility functions, so put them in `lib/utils.js`.
         | 
| 85 85 |  | 
| 86 | 
            -
            Simply put your JS(X) and CSS anywhere you want, and they will be served by your Rails app from the location where you placed them.
         | 
| 86 | 
            +
            Simply put your JS(X) and CSS anywhere you want, and they will be served by your Rails app from the same location where you placed them.
         | 
| 87 87 |  | 
| 88 88 | 
             
            Using the examples above...
         | 
| 89 89 |  | 
| @@ -95,15 +95,15 @@ Using the examples above... | |
| 95 95 |  | 
| 96 96 | 
             
            ## Side Loading
         | 
| 97 97 |  | 
| 98 | 
            -
            Proscenium is best experienced when your assets are  | 
| 98 | 
            +
            Proscenium is best experienced when your assets are automatically side loaded.
         | 
| 99 99 |  | 
| 100 100 | 
             
            ### The Problem
         | 
| 101 101 |  | 
| 102 | 
            -
            With Rails you would typically  | 
| 102 | 
            +
            With Rails you would typically load your JavaScript and CSS assets declaratively using the `javascript_include_tag` and `stylesheet_link_tag` helpers.
         | 
| 103 103 |  | 
| 104 | 
            -
            For example, you may have top-level "application"  | 
| 104 | 
            +
            For example, you may have top-level "application" styles located in a file at `/app/assets/stylesheets/application.css`. Likewise, you may have some global JavaScript located in a file at `/app/javascript/application.js`.
         | 
| 105 105 |  | 
| 106 | 
            -
            You would manually and declaratively include those two files in your  | 
| 106 | 
            +
            You would manually and declaratively include those two files in each of your layouts, something like this:
         | 
| 107 107 |  | 
| 108 108 | 
             
            ```erb
         | 
| 109 109 | 
             
            <%# /app/views/layouts/application.html.erb %>
         | 
| @@ -141,7 +141,9 @@ The main problem is that you have to keep track of all these assets, and make su | |
| 141 141 |  | 
| 142 142 | 
             
            When side loading your JavaScript, Typescript and CSS with Proscenium, they are automatically included alongside your views, partials, layouts, and components, and only when needed.
         | 
| 143 143 |  | 
| 144 | 
            -
            Side loading works by looking for a JS/TS/CSS file with the same name as your view, partial, layout or component. For example, if you have a view at `app/views/users/index.html.erb`, then Proscenium will look for a JS | 
| 144 | 
            +
            Side loading works by looking for a JS/TS/CSS file with the same name as your view, partial, layout or component. For example, if you have a view at `app/views/users/index.html.erb`, then Proscenium will look for a JS and CSS file at `app/views/users/index.js` (or TypeScript with a .ts extension) and `app/views/users/index.css`. If it finds one, it will automatically include it in the HTML for that view. And only for that view.
         | 
| 145 | 
            +
             | 
| 146 | 
            +
            This allows you to keep your assets organized alongside the views, partials, and components that use them, without having to manually track and include them. It also means only the assets that are needed are included.
         | 
| 145 147 |  | 
| 146 148 | 
             
            JSX is also supported for JavaScript and Typescript. Simply use the `.jsx` or `.tsx` extension instead of `.js` or `.ts`.
         | 
| 147 149 |  | 
| @@ -272,6 +274,14 @@ Then just import as normal: | |
| 272 274 | 
             
            import React from "react";
         | 
| 273 275 | 
             
            ```
         | 
| 274 276 |  | 
| 277 | 
            +
            Or if you don't want any bundling at all, simply turn it off application-wide:
         | 
| 278 | 
            +
             | 
| 279 | 
            +
            ```ruby
         | 
| 280 | 
            +
            config.proscenium.bundle = false
         | 
| 281 | 
            +
            ```
         | 
| 282 | 
            +
             | 
| 283 | 
            +
            This will mean every asset and import will be loaded independently.
         | 
| 284 | 
            +
             | 
| 275 285 | 
             
            ## Import Maps
         | 
| 276 286 |  | 
| 277 287 | 
             
            > **[WIP]**
         | 
| @@ -405,13 +415,17 @@ if (typeof proscenium.env?.UNKNOWN !== "undefined") { | |
| 405 415 |  | 
| 406 416 | 
             
            ## i18n
         | 
| 407 417 |  | 
| 408 | 
            -
             | 
| 418 | 
            +
            Support is provided for importing your Rails locale files from `config/locales/*.yml`, exporting them as JSON.
         | 
| 409 419 |  | 
| 410 420 | 
             
            ```js
         | 
| 411 421 | 
             
            import translations from "proscenium/i18n";
         | 
| 412 422 | 
             
            // translations.en.*
         | 
| 413 423 | 
             
            ```
         | 
| 414 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 | 
            +
             | 
| 415 429 | 
             
            ## Javascript
         | 
| 416 430 |  | 
| 417 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.
         | 
| @@ -441,8 +455,6 @@ one(); | |
| 441 455 |  | 
| 442 456 | 
             
            ### Code Splitting
         | 
| 443 457 |  | 
| 444 | 
            -
            > Available in `>=0.10.0`.
         | 
| 445 | 
            -
             | 
| 446 458 | 
             
            [Side loaded](#side-loading) assets are automatically code split. This means that if you have a file that is imported and used imported several times, and by different files, it will be split off into a separate file.
         | 
| 447 459 |  | 
| 448 460 | 
             
            As an example:
         | 
| @@ -682,8 +694,6 @@ console.log(version); | |
| 682 694 |  | 
| 683 695 | 
             
            ## Cache Busting
         | 
| 684 696 |  | 
| 685 | 
            -
            > _COMING SOON_
         | 
| 686 | 
            -
             | 
| 687 697 | 
             
            By default, all assets are not cached by the browser. But if in production, you populate the `REVISION` env variable, all CSS and JS URL's will be appended with its value as a query string, and the `Cache-Control` response header will be set to `public` and a max-age of 30 days.
         | 
| 688 698 |  | 
| 689 699 | 
             
            For example, if you set `REVISION=v1`, URL's will be appended with `?v1`: `/my/imported/file.js?v1`.
         | 
    
        data/lib/proscenium/builder.rb
    CHANGED
    
    
| @@ -70,7 +70,7 @@ module Proscenium | |
| 70 70 | 
             
                  digest = Importer.import(resolved_path)
         | 
| 71 71 |  | 
| 72 72 | 
             
                  transformed_path = ''
         | 
| 73 | 
            -
                  transformed_path = "__#{resolved_path[1..].gsub(%r{[ | 
| 73 | 
            +
                  transformed_path = "__#{resolved_path[1..].gsub(%r{[@/.+]}, '-')}" if Rails.env.development?
         | 
| 74 74 | 
             
                  transformed_name = name.to_s
         | 
| 75 75 | 
             
                  transformed_name = if transformed_name.start_with?('_')
         | 
| 76 76 | 
             
                                       "_#{transformed_name[1..]}-#{digest}#{transformed_path}"
         | 
| Binary file | 
    
        data/lib/proscenium/helper.rb
    CHANGED
    
    | @@ -40,18 +40,6 @@ module Proscenium | |
| 40 40 | 
             
                                        .map { |name, _| name }.join(' ')
         | 
| 41 41 | 
             
                end
         | 
| 42 42 |  | 
| 43 | 
            -
                # @param name [String,Symbol,Array<String,Symbol>]
         | 
| 44 | 
            -
                # @param path [Pathname] the path to the CSS file to use for the transformation.
         | 
| 45 | 
            -
                # @return [String] the transformed CSS module names concatenated as a string.
         | 
| 46 | 
            -
                def class_names(*names, path: nil)
         | 
| 47 | 
            -
                  names = names.flatten.compact
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                  return if names.empty?
         | 
| 50 | 
            -
             | 
| 51 | 
            -
                  path ||= Pathname.new(@lookup_context.find(@virtual_path).identifier).sub_ext('')
         | 
| 52 | 
            -
                  CssModule::Transformer.new(path).class_names(*names).map { |name, _| name }.join(' ')
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
             | 
| 55 43 | 
             
                def include_assets
         | 
| 56 44 | 
             
                  include_stylesheets + include_javascripts
         | 
| 57 45 | 
             
                end
         | 
    
        data/lib/proscenium/importer.rb
    CHANGED
    
    
| @@ -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 | 
            -
                     | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 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
         | 
    
        data/lib/proscenium/monkey.rb
    CHANGED
    
    | @@ -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?(: | 
| 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
         | 
| @@ -24,6 +24,8 @@ module Proscenium | |
| 24 24 | 
             
                  end
         | 
| 25 25 |  | 
| 26 26 | 
             
                  def sideload_template_assets(tpl, controller, options)
         | 
| 27 | 
            +
                    return unless (tpl_path = Pathname.new(tpl.identifier)).file?
         | 
| 28 | 
            +
             | 
| 27 29 | 
             
                    options = {} if options.nil?
         | 
| 28 30 | 
             
                    options = { js: options, css: options } unless options.is_a?(Hash)
         | 
| 29 31 |  | 
| @@ -40,7 +42,7 @@ module Proscenium | |
| 40 42 | 
             
                      options[k] = controller.instance_eval(&options[k]) if options[k].is_a?(Proc)
         | 
| 41 43 | 
             
                    end
         | 
| 42 44 |  | 
| 43 | 
            -
                    Importer.sideload  | 
| 45 | 
            +
                    Importer.sideload tpl_path, **options
         | 
| 44 46 | 
             
                  end
         | 
| 45 47 | 
             
                end
         | 
| 46 48 |  | 
| @@ -52,8 +54,9 @@ module Proscenium | |
| 52 54 |  | 
| 53 55 | 
             
                    return result if !view.controller || !Proscenium.config.side_load
         | 
| 54 56 |  | 
| 55 | 
            -
                    if template.respond_to?(: | 
| 56 | 
            -
                       template.respond_to?(:type) && template.type == :html
         | 
| 57 | 
            +
                    if template.respond_to?(:identifier) &&
         | 
| 58 | 
            +
                       template.respond_to?(:type) && template.type == :html &&
         | 
| 59 | 
            +
                       view.controller.respond_to?(:sideload_assets_options)
         | 
| 57 60 | 
             
                      options = view.controller.sideload_assets_options
         | 
| 58 61 | 
             
                      sideload_template_assets layout, options if layout
         | 
| 59 62 | 
             
                      sideload_template_assets template, options
         | 
| @@ -63,6 +66,8 @@ module Proscenium | |
| 63 66 | 
             
                  end
         | 
| 64 67 |  | 
| 65 68 | 
             
                  def sideload_template_assets(tpl, options)
         | 
| 69 | 
            +
                    return unless (tpl_path = Pathname.new(tpl.identifier)).file?
         | 
| 70 | 
            +
             | 
| 66 71 | 
             
                    options = {} if options.nil?
         | 
| 67 72 | 
             
                    options = { js: options, css: options } unless options.is_a?(Hash)
         | 
| 68 73 |  | 
| @@ -79,7 +84,7 @@ module Proscenium | |
| 79 84 | 
             
                      options[k] = controller.instance_eval(&options[k]) if options[k].is_a?(Proc)
         | 
| 80 85 | 
             
                    end
         | 
| 81 86 |  | 
| 82 | 
            -
                    Importer.sideload  | 
| 87 | 
            +
                    Importer.sideload tpl_path, **options
         | 
| 83 88 | 
             
                  end
         | 
| 84 89 | 
             
                end
         | 
| 85 90 | 
             
              end
         | 
    
        data/lib/proscenium/side_load.rb
    CHANGED
    
    | @@ -134,7 +134,7 @@ module Proscenium | |
| 134 134 | 
             
                    # in the ancestry is also sideloaded in addition to the regular CSS files. This is because
         | 
| 135 135 | 
             
                    # the CSS module digest will be different for each file, so we only sideload the first CSS
         | 
| 136 136 | 
             
                    # module.
         | 
| 137 | 
            -
                    css_imports.each do |it|
         | 
| 137 | 
            +
                    css_imports.each do |it| # rubocop:disable Style/ItAssignment
         | 
| 138 138 | 
             
                      break if Importer.sideload_css_module(it, **options).present?
         | 
| 139 139 | 
             
                    end
         | 
| 140 140 |  | 
| @@ -143,7 +143,7 @@ module Proscenium | |
| 143 143 | 
             
                    # The reason why we sideload CSS after JS is because the order of CSS is important.
         | 
| 144 144 | 
             
                    # Basically, the layout should be loaded before the view so that CSS cascading works in the
         | 
| 145 145 | 
             
                    # right direction.
         | 
| 146 | 
            -
                    css_imports.reverse_each do |it|
         | 
| 146 | 
            +
                    css_imports.reverse_each do |it| # rubocop:disable Style/ItAssignment
         | 
| 147 147 | 
             
                      Importer.sideload_css it, **options
         | 
| 148 148 | 
             
                    end
         | 
| 149 149 | 
             
                  end
         | 
    
        data/lib/proscenium/version.rb
    CHANGED
    
    
    
        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. | 
| 4 | 
            +
              version: 0.20.1
         | 
| 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: 2025-07 | 
| 11 | 
            +
            date: 2025-10-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: ffi
         |