proscenium 0.15.0.beta.7-arm64-darwin → 0.17.0-arm64-darwin
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 +64 -54
 - data/lib/proscenium/builder.rb +3 -3
 - data/lib/proscenium/ext/proscenium +0 -0
 - data/lib/proscenium/helper.rb +9 -1
 - data/lib/proscenium/importer.rb +2 -2
 - data/lib/proscenium/log_subscriber.rb +2 -2
 - data/lib/proscenium/middleware/esbuild.rb +1 -1
 - data/lib/proscenium/middleware.rb +1 -3
 - data/lib/proscenium/phlex/react_component.rb +2 -2
 - data/lib/proscenium/railtie.rb +1 -1
 - data/lib/proscenium/side_load.rb +1 -1
 - data/lib/proscenium/version.rb +1 -1
 - data/lib/proscenium.rb +7 -0
 - metadata +8 -9
 - data/lib/proscenium/middleware/url.rb +0 -16
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 937b6e0f9452ff63dda1b46b39fe120e592d0dfa0477f14b0df55e5a755c5321
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3fce8038c65d3c478983a62c4e108e885bc28b8dff6e01dba37e4cd237fc14dd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c8160f6c0bfd5362f0a3b35ffdd6d860e30701ab13111fcc1752688321196c5a73803150d3b617fa7f7d1297aedb8892d7374708d22b56e4909124dee04636a4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5138c19dc2ce1fba33dbf03b7c1f19f1c4de145f00f1aaa7048048ef926183f8abaf908c83d799520fa3eb5ec7dc29c2565c54fabd1f0481738d8b5bb382b7ec
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,13 +1,20 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Proscenium -  
     | 
| 
      
 1 
     | 
    
         
            +
            # Proscenium - Integrated Frontend Development for Rails
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            > 🗣️ prow · see · nee · uhm
         
     | 
| 
      
 4 
     | 
    
         
            +
            >
         
     | 
| 
      
 5 
     | 
    
         
            +
            > _noun_: **proscenium**
         
     | 
| 
      
 6 
     | 
    
         
            +
            >
         
     | 
| 
      
 7 
     | 
    
         
            +
            > - _the part of a theatre stage in front of the curtain._
         
     | 
| 
      
 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 (+ JSX), TypeScript (+TSX) and CSS in real time, on demand, and with zero configuration.
         
     | 
| 
       4 
10 
     | 
    
         | 
| 
       5 
11 
     | 
    
         
             
            **The highlights:**
         
     | 
| 
       6 
12 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            - Fast real-time bundling, tree-shaking, code-splitting and minification of Javascript (.js,.jsx), Typescript (.ts,.tsx) and CSS (.css).
         
     | 
| 
       8 
     | 
    
         
            -
            - NO JavaScript runtime needed - just the browser!
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Fast, real-time bundling, tree-shaking, code-splitting and minification of Javascript (.js,.jsx), Typescript (.ts,.tsx) and CSS (.css).
         
     | 
| 
      
 14 
     | 
    
         
            +
            - NO JavaScript runtime needed (eg. Node) - just the browser!
         
     | 
| 
       9 
15 
     | 
    
         
             
            - NO build step or pre-compilation.
         
     | 
| 
       10 
     | 
    
         
            -
            - NO additional process or server - Just run  
     | 
| 
      
 16 
     | 
    
         
            +
            - NO additional process or server - Just run `rails s`!
         
     | 
| 
      
 17 
     | 
    
         
            +
            - Transforms newer JavaScript and CSS syntax to older syntax for older browsers.
         
     | 
| 
       11 
18 
     | 
    
         
             
            - Deep integration with Rails.
         
     | 
| 
       12 
19 
     | 
    
         
             
            - Automatically side-load your layouts, views, and partials.
         
     | 
| 
       13 
20 
     | 
    
         
             
            - Import from NPM, URL's, and locally.
         
     | 
| 
         @@ -22,7 +29,6 @@ Proscenium treats your client-side code as first class citizens of your Rails ap 
     | 
|
| 
       22 
29 
     | 
    
         
             
            - [Client-Side Code Anywhere](#client-side-code-anywhere)
         
     | 
| 
       23 
30 
     | 
    
         
             
            - [Side Loading](#side-loading)
         
     | 
| 
       24 
31 
     | 
    
         
             
            - [Importing](#importing-assets)
         
     | 
| 
       25 
     | 
    
         
            -
              - [URL Imports](#url-imports)
         
     | 
| 
       26 
32 
     | 
    
         
             
              - [Local Imports](#local-imports)
         
     | 
| 
       27 
33 
     | 
    
         
             
            - [Import Maps](#import-maps)
         
     | 
| 
       28 
34 
     | 
    
         
             
            - [Source Maps](#source-maps)
         
     | 
| 
         @@ -70,7 +76,9 @@ Add this line to your Rails application's Gemfile, and you're good to go: 
     | 
|
| 
       70 
76 
     | 
    
         
             
            gem 'proscenium'
         
     | 
| 
       71 
77 
     | 
    
         
             
            ```
         
     | 
| 
       72 
78 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
            Please note that Proscenium is designed solely for use with Rails 
     | 
| 
      
 79 
     | 
    
         
            +
            Please note that Proscenium is designed solely for use with Rails.
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            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 bundled, transformed, and minified [in production] in real time.
         
     | 
| 
       74 
82 
     | 
    
         | 
| 
       75 
83 
     | 
    
         
             
            ## Client-Side Code Anywhere
         
     | 
| 
       76 
84 
     | 
    
         | 
| 
         @@ -82,23 +90,21 @@ Simply put your JS(X) and CSS anywhere you want, and they will be served by your 
     | 
|
| 
       82 
90 
     | 
    
         | 
| 
       83 
91 
     | 
    
         
             
            Using the examples above...
         
     | 
| 
       84 
92 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
            - `app/views/users/index.js` => `https:// 
     | 
| 
       86 
     | 
    
         
            -
            - `app/views/layouts/application.css` => `https:// 
     | 
| 
       87 
     | 
    
         
            -
            - `lib/utils.js` => `https:// 
     | 
| 
       88 
     | 
    
         
            -
            - `app/components/menu_component.jsx` => `https:// 
     | 
| 
       89 
     | 
    
         
            -
            - `config/properties.css` => `https:// 
     | 
| 
      
 93 
     | 
    
         
            +
            - `app/views/users/index.js` => `https://localhost:3000/app/views/users/index.js`
         
     | 
| 
      
 94 
     | 
    
         
            +
            - `app/views/layouts/application.css` => `https://localhost:3000/app/views/layouts/application.css`
         
     | 
| 
      
 95 
     | 
    
         
            +
            - `lib/utils.js` => `https://localhost:3000/lib/utils.js`
         
     | 
| 
      
 96 
     | 
    
         
            +
            - `app/components/menu_component.jsx` => `https://localhost:3000/app/components/menu_component.jsx`
         
     | 
| 
      
 97 
     | 
    
         
            +
            - `config/properties.css` => `https://localhost:3000/config/properties.css`
         
     | 
| 
       90 
98 
     | 
    
         | 
| 
       91 
99 
     | 
    
         
             
            ## Side Loading
         
     | 
| 
       92 
100 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
            Proscenium is best experienced when you side load your assets.
         
     | 
| 
      
 101 
     | 
    
         
            +
            Proscenium is best experienced when your assets are automtically side loaded.
         
     | 
| 
       96 
102 
     | 
    
         | 
| 
       97 
103 
     | 
    
         
             
            ### The Problem
         
     | 
| 
       98 
104 
     | 
    
         | 
| 
       99 
105 
     | 
    
         
             
            With Rails you would typically declaratively load your JavaScript and CSS assets using the `javascript_include_tag` and `stylesheet_link_tag` helpers.
         
     | 
| 
       100 
106 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
            For example, you may have top-level "application" CSS located in a file at `/app/assets/application.css`. Likewise, you may have some global JavaScript located in a file at `/app/ 
     | 
| 
      
 107 
     | 
    
         
            +
            For example, you may have top-level "application" CSS 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`.
         
     | 
| 
       102 
108 
     | 
    
         | 
| 
       103 
109 
     | 
    
         
             
            You would manually and declaratively include those two files in your application layout, something like this:
         
     | 
| 
       104 
110 
     | 
    
         | 
| 
         @@ -177,45 +183,55 @@ Now, in your layout and view, replace the `javascript_include_tag` and `styleshe 
     | 
|
| 
       177 
183 
     | 
    
         
             
            </html>
         
     | 
| 
       178 
184 
     | 
    
         
             
            ```
         
     | 
| 
       179 
185 
     | 
    
         | 
| 
       180 
     | 
    
         
            -
            On each page request, Proscenium will check if any of your views, layouts and partials have a
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
      
 186 
     | 
    
         
            +
            On each page request, Proscenium will check if any of your views, layouts and partials have a JS/TS/CSS file of the same name, and then include them wherever your placed the `include_assets` helper.
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
            Now you never have to remember to include your assets again. Just create them alongside your views, partials and layouts, and Proscenium will take care of the rest.
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
            Side loading is enabled by default, but you can disable it by setting `config.proscenium.side_load` to `false` in your `/config/application.rb`.
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
            There are also `include_stylesheets` and `include_javascripts` helpers to allow you to control where the CSS and JS assets are included in the HTML. These helpers should be used instead of `include_assets` if you want to control exactly where the assets are included.
         
     | 
| 
       183 
193 
     | 
    
         | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
            partials and layouts, and Proscenium will take care of the rest.
         
     | 
| 
      
 194 
     | 
    
         
            +
            ## Bundling
         
     | 
| 
       186 
195 
     | 
    
         | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
            to `false` in your `/config/application.rb`.
         
     | 
| 
      
 196 
     | 
    
         
            +
            To bundle a file means to inline any imported dependencies into the file itself. This process is recursive so dependencies of dependencies (and so on) will also be inlined.
         
     | 
| 
       189 
197 
     | 
    
         | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
            the CSS and JS assets are included in the HTML. These helpers should be used instead of
         
     | 
| 
       192 
     | 
    
         
            -
            `include_assets` if you want to control exactly where the assets are included.
         
     | 
| 
      
 198 
     | 
    
         
            +
            Proscenium will bundle by default, and in real time. So there is no separate build step or pre-compilation.
         
     | 
| 
       193 
199 
     | 
    
         | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
      
 200 
     | 
    
         
            +
            Proscenium supports importing JS, JSX, TS, TSX, CSS and SVG from NPM, by URL, your local app, and even from other Ruby Gems.
         
     | 
| 
       195 
201 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
      
 202 
     | 
    
         
            +
            Both static ([`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)) and dynamic ([`import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import)) imports are supported for JavaScript and TypeScript, and can be used to import JS, TS, JSX, TSX, JSON, CSS and SVG files.
         
     | 
| 
       197 
203 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
      
 204 
     | 
    
         
            +
            The [`@import`](https://developer.mozilla.org/en-US/docs/Web/CSS/@import) CSS at-rule is supported for CSS.
         
     | 
| 
       199 
205 
     | 
    
         | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
      
 206 
     | 
    
         
            +
            ### Non-analyzable imports
         
     | 
| 
       201 
207 
     | 
    
         | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
      
 208 
     | 
    
         
            +
            Import paths are currently only bundled if they are a string literal or a glob pattern. Other forms of import paths are not bundled, and are instead preserved verbatim in the generated output. This is because bundling is a compile-time operation and Proscenium doesn't support all forms of run-time path resolution.
         
     | 
| 
       203 
209 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
      
 210 
     | 
    
         
            +
            Here are some examples:
         
     | 
| 
       205 
211 
     | 
    
         | 
| 
       206 
212 
     | 
    
         
             
            ```js
         
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
      
 213 
     | 
    
         
            +
            // Analyzable imports (will be bundled)
         
     | 
| 
      
 214 
     | 
    
         
            +
            import "pkg";
         
     | 
| 
      
 215 
     | 
    
         
            +
            import("pkg");
         
     | 
| 
      
 216 
     | 
    
         
            +
            import(`./locale-${foo}.json`);
         
     | 
| 
       209 
217 
     | 
    
         | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
      
 218 
     | 
    
         
            +
            // Non-analyzable imports (will not be bundled)
         
     | 
| 
      
 219 
     | 
    
         
            +
            import(`pkg/${foo}`);
         
     | 
| 
       212 
220 
     | 
    
         
             
            ```
         
     | 
| 
       213 
221 
     | 
    
         | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
      
 222 
     | 
    
         
            +
            The way to work around non-analyzable imports is to mark the package containing this problematic code as [unbundled](#Unbundling) so that it's not included in the bundle. You will then need to ensure that a copy of the external package is available to your bundled code at run-time.
         
     | 
| 
       215 
223 
     | 
    
         | 
| 
       216 
224 
     | 
    
         
             
            ### Import from NPM (`node_modules`)
         
     | 
| 
       217 
225 
     | 
    
         | 
| 
       218 
     | 
    
         
            -
            Bare imports (imports not beginning with `./`, `/`, `https://`, `http://`) are fully supported, and will use your package manager of choice (eg, NPM, Yarn, pnpm) via the `package.json` file 
     | 
| 
      
 226 
     | 
    
         
            +
            Bare imports (imports not beginning with `./`, `/`, `https://`, `http://`) are fully supported, and will use your package manager of choice (eg, NPM, Yarn, pnpm) via the `package.json` file located at the root of your Rails app.
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
            Install the package you want to import using your package manager of choice...
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
            ```
         
     | 
| 
      
 231 
     | 
    
         
            +
            npm install react
         
     | 
| 
      
 232 
     | 
    
         
            +
            ```
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
            ...and then import it as you would any other package.
         
     | 
| 
       219 
235 
     | 
    
         | 
| 
       220 
236 
     | 
    
         
             
            ```js
         
     | 
| 
       221 
237 
     | 
    
         
             
            import React from "react";
         
     | 
| 
         @@ -223,26 +239,18 @@ import React from "react"; 
     | 
|
| 
       223 
239 
     | 
    
         | 
| 
       224 
240 
     | 
    
         
             
            ### Local Imports
         
     | 
| 
       225 
241 
     | 
    
         | 
| 
       226 
     | 
    
         
            -
            And of course you can import your own code, using relative or absolute paths (file extension is optional):
         
     | 
| 
      
 242 
     | 
    
         
            +
            And of course you can import your own code, using relative or absolute paths (file extension is optional, and absolute paths use your Rails root as the base):
         
     | 
| 
       227 
243 
     | 
    
         | 
| 
       228 
     | 
    
         
            -
            ```js 
     | 
| 
      
 244 
     | 
    
         
            +
            ```js
         
     | 
| 
       229 
245 
     | 
    
         
             
            import utils from "/lib/utils";
         
     | 
| 
       230 
     | 
    
         
            -
            ```
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
            ```js /lib/utils.js
         
     | 
| 
       233 
246 
     | 
    
         
             
            import constants from "./constants";
         
     | 
| 
      
 247 
     | 
    
         
            +
            import Header from "/app/components/header";
         
     | 
| 
       234 
248 
     | 
    
         
             
            ```
         
     | 
| 
       235 
249 
     | 
    
         | 
| 
       236 
     | 
    
         
            -
            ```css 
     | 
| 
      
 250 
     | 
    
         
            +
            ```css
         
     | 
| 
       237 
251 
     | 
    
         
             
            @import "/lib/reset";
         
     | 
| 
       238 
252 
     | 
    
         
             
            ```
         
     | 
| 
       239 
253 
     | 
    
         | 
| 
       240 
     | 
    
         
            -
            ```css /lib/reset.css
         
     | 
| 
       241 
     | 
    
         
            -
            body {
         
     | 
| 
       242 
     | 
    
         
            -
              /* some styles... */
         
     | 
| 
       243 
     | 
    
         
            -
            }
         
     | 
| 
       244 
     | 
    
         
            -
            ```
         
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
254 
     | 
    
         
             
            ### Unbundling
         
     | 
| 
       247 
255 
     | 
    
         | 
| 
       248 
256 
     | 
    
         
             
            Sometimes you don't want to bundle an import. For example, you want to ensure that only one instance of React is loaded. In this cases, you can use the `unbundle` prefix
         
     | 
| 
         @@ -253,7 +261,7 @@ import React from "unbundle:react"; 
     | 
|
| 
       253 
261 
     | 
    
         | 
| 
       254 
262 
     | 
    
         
             
            This only works any bare and local imports.
         
     | 
| 
       255 
263 
     | 
    
         | 
| 
       256 
     | 
    
         
            -
            You can also use the `unbundle` prefix in your import map, which ensures that all imports of a particular path is always unbundled:
         
     | 
| 
      
 264 
     | 
    
         
            +
            You can also use the `unbundle` prefix in your [import map](#import-maps), which ensures that all imports of a particular path is always unbundled:
         
     | 
| 
       257 
265 
     | 
    
         | 
| 
       258 
266 
     | 
    
         
             
            ```json
         
     | 
| 
       259 
267 
     | 
    
         
             
            {
         
     | 
| 
         @@ -411,11 +419,11 @@ import translations from "@proscenium/i18n"; 
     | 
|
| 
       411 
419 
     | 
    
         | 
| 
       412 
420 
     | 
    
         
             
            ## Javascript
         
     | 
| 
       413 
421 
     | 
    
         | 
| 
       414 
     | 
    
         
            -
            By default, Proscenium's output will take advantage of all modern JS features. 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.
         
     | 
| 
      
 422 
     | 
    
         
            +
            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.
         
     | 
| 
       415 
423 
     | 
    
         | 
| 
       416 
424 
     | 
    
         
             
            ### Tree Shaking
         
     | 
| 
       417 
425 
     | 
    
         | 
| 
       418 
     | 
    
         
            -
            Tree shaking is the term the JavaScript community uses for dead code elimination, a common compiler optimization that automatically removes unreachable code. Tree shaking is enabled by default in  
     | 
| 
      
 426 
     | 
    
         
            +
            Tree shaking is the term the JavaScript community uses for dead code elimination, a common compiler optimization that automatically removes unreachable code. Tree shaking is enabled by default in Proscenium.
         
     | 
| 
       419 
427 
     | 
    
         | 
| 
       420 
428 
     | 
    
         
             
            ```javascript
         
     | 
| 
       421 
429 
     | 
    
         
             
            function one() {
         
     | 
| 
         @@ -491,6 +499,8 @@ Note that by default, Proscenium's output will take advantage of all modern CSS 
     | 
|
| 
       491 
499 
     | 
    
         | 
| 
       492 
500 
     | 
    
         
             
            The new CSS nesting syntax is supported, and transformed into non-nested CSS for older browsers.
         
     | 
| 
       493 
501 
     | 
    
         | 
| 
      
 502 
     | 
    
         
            +
            Proscenium will also automatically insert vendor prefixes so that your CSS will work in older browsers.
         
     | 
| 
      
 503 
     | 
    
         
            +
             
     | 
| 
       494 
504 
     | 
    
         
             
            ### Importing CSS from JavaScript
         
     | 
| 
       495 
505 
     | 
    
         | 
| 
       496 
506 
     | 
    
         
             
            You can also import CSS from JavaScript. When you do this, Proscenium will automatically append each stylesheet to the document's head as a `<link>` element.
         
     | 
| 
         @@ -835,7 +845,7 @@ Proscenium brings back RJS! Any path ending in .rjs will be served from your Rai 
     | 
|
| 
       835 
845 
     | 
    
         | 
| 
       836 
846 
     | 
    
         
             
            Proscenium will serve files ending with any of these extension: `js,mjs,ts,css,jsx,tsx` from the following directories, and their sub-directories of your Rails application's root: `/app`, `/lib`, `/config`, `/node_modules`, `/vendor`.
         
     | 
| 
       837 
847 
     | 
    
         | 
| 
       838 
     | 
    
         
            -
            So a file at `/app/views/users/index.js` will be served from `https:// 
     | 
| 
      
 848 
     | 
    
         
            +
            So a file at `/app/views/users/index.js` will be served from `https://localhost:3000/app/views/users/index.js`.
         
     | 
| 
       839 
849 
     | 
    
         | 
| 
       840 
850 
     | 
    
         
             
            You can continue to access any file in the `/public` directory as you normally would. Proscenium will not process files in the `/public` directory.
         
     | 
| 
       841 
851 
     | 
    
         | 
    
        data/lib/proscenium/builder.rb
    CHANGED
    
    | 
         @@ -84,15 +84,15 @@ module Proscenium 
     | 
|
| 
       84 
84 
     | 
    
         
             
                end
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
                def self.build_to_path(path, root: nil, base_url: nil)
         
     | 
| 
       87 
     | 
    
         
            -
                  new(root 
     | 
| 
      
 87 
     | 
    
         
            +
                  new(root:, base_url:).build_to_path(path)
         
     | 
| 
       88 
88 
     | 
    
         
             
                end
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
90 
     | 
    
         
             
                def self.build_to_string(path, root: nil, base_url: nil)
         
     | 
| 
       91 
     | 
    
         
            -
                  new(root 
     | 
| 
      
 91 
     | 
    
         
            +
                  new(root:, base_url:).build_to_string(path)
         
     | 
| 
       92 
92 
     | 
    
         
             
                end
         
     | 
| 
       93 
93 
     | 
    
         | 
| 
       94 
94 
     | 
    
         
             
                def self.resolve(path, root: nil)
         
     | 
| 
       95 
     | 
    
         
            -
                  new(root: 
     | 
| 
      
 95 
     | 
    
         
            +
                  new(root:).resolve(path)
         
     | 
| 
       96 
96 
     | 
    
         
             
                end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
98 
     | 
    
         
             
                def initialize(root: nil, base_url: nil)
         
     | 
| 
         Binary file 
     | 
    
        data/lib/proscenium/helper.rb
    CHANGED
    
    | 
         @@ -15,10 +15,18 @@ module Proscenium 
     | 
|
| 
       15 
15 
     | 
    
         
             
                # building with Proscenium. It's important to note that `include_assets` will not call this, as
         
     | 
| 
       16 
16 
     | 
    
         
             
                # those asset paths all begin with a slash, which the Rails asset helpers do not pass through to
         
     | 
| 
       17 
17 
     | 
    
         
             
                # here.
         
     | 
| 
      
 18 
     | 
    
         
            +
                #
         
     | 
| 
      
 19 
     | 
    
         
            +
                # If the given `path` is a bare path (does not start with `/` or `./` or `../`), then we use
         
     | 
| 
      
 20 
     | 
    
         
            +
                # Rails default conventions, and serve CSS from /app/assets/stylesheets and JS from
         
     | 
| 
      
 21 
     | 
    
         
            +
                # /app/javascript.
         
     | 
| 
       18 
22 
     | 
    
         
             
                def compute_asset_path(path, options = {})
         
     | 
| 
       19 
23 
     | 
    
         
             
                  if %i[javascript stylesheet].include?(options[:type])
         
     | 
| 
      
 24 
     | 
    
         
            +
                    if !path.start_with?("./", "../")
         
     | 
| 
      
 25 
     | 
    
         
            +
                      path.prepend DEFAULT_RAILS_ASSET_PATHS[options[:type]]
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       20 
28 
     | 
    
         
             
                    result = Proscenium::Builder.build_to_path(path, base_url: request.base_url)
         
     | 
| 
       21 
     | 
    
         
            -
                    return result.split( 
     | 
| 
      
 29 
     | 
    
         
            +
                    return result.split("::").last.delete_prefix "public"
         
     | 
| 
       22 
30 
     | 
    
         
             
                  end
         
     | 
| 
       23 
31 
     | 
    
         | 
| 
       24 
32 
     | 
    
         
             
                  super
         
     | 
    
        data/lib/proscenium/importer.rb
    CHANGED
    
    | 
         @@ -25,7 +25,7 @@ module Proscenium 
     | 
|
| 
       25 
25 
     | 
    
         
             
                  #   Should be the actual asset file, eg. app.css, some/component.js.
         
     | 
| 
       26 
26 
     | 
    
         
             
                  # @param resolve [String] description of the file to resolve and import.
         
     | 
| 
       27 
27 
     | 
    
         
             
                  # @return [String] the digest of the imported file path if a css module (*.module.css).
         
     | 
| 
       28 
     | 
    
         
            -
                  def import(filepath = nil, resolve: nil, ** 
     | 
| 
      
 28 
     | 
    
         
            +
                  def import(filepath = nil, resolve: nil, **)
         
     | 
| 
       29 
29 
     | 
    
         
             
                    self.imported ||= {}
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                    filepath = Resolver.resolve(resolve) if !filepath && resolve
         
     | 
| 
         @@ -34,7 +34,7 @@ module Proscenium 
     | 
|
| 
       34 
34 
     | 
    
         
             
                    unless self.imported.key?(filepath)
         
     | 
| 
       35 
35 
     | 
    
         
             
                      # ActiveSupport::Notifications.instrument('sideload.proscenium', identifier: value)
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                      self.imported[filepath] = { ** 
     | 
| 
      
 37 
     | 
    
         
            +
                      self.imported[filepath] = { ** }
         
     | 
| 
       38 
38 
     | 
    
         
             
                      self.imported[filepath][:digest] = Utils.digest(filepath) if css_module
         
     | 
| 
       39 
39 
     | 
    
         
             
                    end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
         @@ -16,7 +16,7 @@ module Proscenium 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                  info do
         
     | 
| 
       19 
     | 
    
         
            -
                    message =  
     | 
| 
      
 19 
     | 
    
         
            +
                    message = "  #{color('[Proscenium]', nil, bold: true)} Building (to path) #{path}"
         
     | 
| 
       20 
20 
     | 
    
         
             
                    message << " (Duration: #{event.duration.round(1)}ms | " \
         
     | 
| 
       21 
21 
     | 
    
         
             
                               "Allocations: #{event.allocations}#{cached})"
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -27,7 +27,7 @@ module Proscenium 
     | 
|
| 
       27 
27 
     | 
    
         
             
                  path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                  info do
         
     | 
| 
       30 
     | 
    
         
            -
                    message =  
     | 
| 
      
 30 
     | 
    
         
            +
                    message = "  #{color('[Proscenium]', nil, bold: true)} Building #{path}"
         
     | 
| 
       31 
31 
     | 
    
         
             
                    message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  end
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
         @@ -11,14 +11,13 @@ module Proscenium 
     | 
|
| 
       11 
11 
     | 
    
         
             
                autoload :Esbuild
         
     | 
| 
       12 
12 
     | 
    
         
             
                autoload :Engines
         
     | 
| 
       13 
13 
     | 
    
         
             
                autoload :Runtime
         
     | 
| 
       14 
     | 
    
         
            -
                autoload :Url
         
     | 
| 
       15 
14 
     | 
    
         | 
| 
       16 
15 
     | 
    
         
             
                def initialize(app)
         
     | 
| 
       17 
16 
     | 
    
         
             
                  @app = app
         
     | 
| 
       18 
17 
     | 
    
         | 
| 
       19 
18 
     | 
    
         
             
                  chunks_path = Rails.public_path.join('assets').to_s
         
     | 
| 
       20 
19 
     | 
    
         
             
                  headers = Rails.application.config.public_file_server.headers || {}
         
     | 
| 
       21 
     | 
    
         
            -
                  @chunk_handler = ::ActionDispatch::FileHandler.new(chunks_path, headers: 
     | 
| 
      
 20 
     | 
    
         
            +
                  @chunk_handler = ::ActionDispatch::FileHandler.new(chunks_path, headers:)
         
     | 
| 
       22 
21 
     | 
    
         
             
                end
         
     | 
| 
       23 
22 
     | 
    
         | 
| 
       24 
23 
     | 
    
         
             
                def call(env)
         
     | 
| 
         @@ -41,7 +40,6 @@ module Proscenium 
     | 
|
| 
       41 
40 
     | 
    
         
             
                end
         
     | 
| 
       42 
41 
     | 
    
         | 
| 
       43 
42 
     | 
    
         
             
                def find_type(request)
         
     | 
| 
       44 
     | 
    
         
            -
                  return Url if request.path.match?(%r{^/https?%3A%2F%2F})
         
     | 
| 
       45 
43 
     | 
    
         
             
                  return Runtime if request.path.match?(%r{^/@proscenium/})
         
     | 
| 
       46 
44 
     | 
    
         
             
                  return Esbuild if Pathname.new(request.path).fnmatch?(app_path_glob, File::FNM_EXTGLOB)
         
     | 
| 
       47 
45 
     | 
    
         | 
| 
         @@ -25,8 +25,8 @@ module Proscenium 
     | 
|
| 
       25 
25 
     | 
    
         
             
                #   end
         
     | 
| 
       26 
26 
     | 
    
         
             
                #
         
     | 
| 
       27 
27 
     | 
    
         
             
                # @yield the given block to a `div` within the top level component div.
         
     | 
| 
       28 
     | 
    
         
            -
                def view_template(**attributes, & 
     | 
| 
       29 
     | 
    
         
            -
                  send 
     | 
| 
      
 28 
     | 
    
         
            +
                def view_template(**attributes, &)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  send(root_tag, **{ data: data_attributes }.deep_merge(attributes), &)
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         
             
            end
         
     | 
    
        data/lib/proscenium/railtie.rb
    CHANGED
    
    | 
         @@ -88,7 +88,7 @@ module Proscenium 
     | 
|
| 
       88 
88 
     | 
    
         
             
                    index = app.config.public_file_server.index_name || 'index'
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
90 
     | 
    
         
             
                    app.middleware.insert_after(ActionDispatch::Static, ActionDispatch::Static,
         
     | 
| 
       91 
     | 
    
         
            -
                                                root.join('public').to_s, index 
     | 
| 
      
 91 
     | 
    
         
            +
                                                root.join('public').to_s, index:, headers:)
         
     | 
| 
       92 
92 
     | 
    
         
             
                  end
         
     | 
| 
       93 
93 
     | 
    
         
             
                end
         
     | 
| 
       94 
94 
     | 
    
         
             
              end
         
     | 
    
        data/lib/proscenium/side_load.rb
    CHANGED
    
    | 
         @@ -76,7 +76,7 @@ module Proscenium 
     | 
|
| 
       76 
76 
     | 
    
         
             
                        next unless imports.key?(inpath)
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
                        if (import = imports[inpath]).delete(:lazy)
         
     | 
| 
       79 
     | 
    
         
            -
                          scripts[inpath] = import.merge(outpath: 
     | 
| 
      
 79 
     | 
    
         
            +
                          scripts[inpath] = import.merge(outpath:)
         
     | 
| 
       80 
80 
     | 
    
         
             
                        else
         
     | 
| 
       81 
81 
     | 
    
         
             
                          opts = import[:js].is_a?(Hash) ? import[:js] : {}
         
     | 
| 
       82 
82 
     | 
    
         
             
                          out << helpers.javascript_include_tag(outpath, extname: false, **opts)
         
     | 
    
        data/lib/proscenium/version.rb
    CHANGED
    
    
    
        data/lib/proscenium.rb
    CHANGED
    
    | 
         @@ -8,6 +8,13 @@ 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 
     | 
    
         
            +
              # Default paths for Rails assets. Used by the `compute_asset_path` helper to maintain Rails
         
     | 
| 
      
 12 
     | 
    
         
            +
              # default conventions of where JS and CSS files are located.
         
     | 
| 
      
 13 
     | 
    
         
            +
              DEFAULT_RAILS_ASSET_PATHS = {
         
     | 
| 
      
 14 
     | 
    
         
            +
                stylesheet: 'app/assets/stylesheets/',
         
     | 
| 
      
 15 
     | 
    
         
            +
                javascript: 'app/javascript/'
         
     | 
| 
      
 16 
     | 
    
         
            +
              }.freeze
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       11 
18 
     | 
    
         
             
              ALLOWED_DIRECTORIES = 'app,lib,config,vendor,node_modules'
         
     | 
| 
       12 
19 
     | 
    
         | 
| 
       13 
20 
     | 
    
         
             
              # Environment variables that should always be passed to the builder.
         
     | 
    
        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.17.0
         
     | 
| 
       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: 2024- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-10-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -16,7 +16,7 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - ">="
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version:  
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 7.1.0
         
     | 
| 
       20 
20 
     | 
    
         
             
                - - "<"
         
     | 
| 
       21 
21 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
22 
     | 
    
         
             
                    version: '8.0'
         
     | 
| 
         @@ -26,7 +26,7 @@ dependencies: 
     | 
|
| 
       26 
26 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
27 
     | 
    
         
             
                - - ">="
         
     | 
| 
       28 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
     | 
    
         
            -
                    version:  
     | 
| 
      
 29 
     | 
    
         
            +
                    version: 7.1.0
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - "<"
         
     | 
| 
       31 
31 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
32 
     | 
    
         
             
                    version: '8.0'
         
     | 
| 
         @@ -106,7 +106,7 @@ dependencies: 
     | 
|
| 
       106 
106 
     | 
    
         
             
                requirements:
         
     | 
| 
       107 
107 
     | 
    
         
             
                - - ">="
         
     | 
| 
       108 
108 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       109 
     | 
    
         
            -
                    version:  
     | 
| 
      
 109 
     | 
    
         
            +
                    version: 7.1.0
         
     | 
| 
       110 
110 
     | 
    
         
             
                - - "<"
         
     | 
| 
       111 
111 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       112 
112 
     | 
    
         
             
                    version: '8.0'
         
     | 
| 
         @@ -116,7 +116,7 @@ dependencies: 
     | 
|
| 
       116 
116 
     | 
    
         
             
                requirements:
         
     | 
| 
       117 
117 
     | 
    
         
             
                - - ">="
         
     | 
| 
       118 
118 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       119 
     | 
    
         
            -
                    version:  
     | 
| 
      
 119 
     | 
    
         
            +
                    version: 7.1.0
         
     | 
| 
       120 
120 
     | 
    
         
             
                - - "<"
         
     | 
| 
       121 
121 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       122 
122 
     | 
    
         
             
                    version: '8.0'
         
     | 
| 
         @@ -171,7 +171,6 @@ files: 
     | 
|
| 
       171 
171 
     | 
    
         
             
            - lib/proscenium/middleware/engines.rb
         
     | 
| 
       172 
172 
     | 
    
         
             
            - lib/proscenium/middleware/esbuild.rb
         
     | 
| 
       173 
173 
     | 
    
         
             
            - lib/proscenium/middleware/runtime.rb
         
     | 
| 
       174 
     | 
    
         
            -
            - lib/proscenium/middleware/url.rb
         
     | 
| 
       175 
174 
     | 
    
         
             
            - lib/proscenium/monkey.rb
         
     | 
| 
       176 
175 
     | 
    
         
             
            - lib/proscenium/phlex.rb
         
     | 
| 
       177 
176 
     | 
    
         
             
            - lib/proscenium/phlex/asset_inclusions.rb
         
     | 
| 
         @@ -214,14 +213,14 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       214 
213 
     | 
    
         
             
              requirements:
         
     | 
| 
       215 
214 
     | 
    
         
             
              - - ">="
         
     | 
| 
       216 
215 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       217 
     | 
    
         
            -
                  version: 2. 
     | 
| 
      
 216 
     | 
    
         
            +
                  version: 3.2.0
         
     | 
| 
       218 
217 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       219 
218 
     | 
    
         
             
              requirements:
         
     | 
| 
       220 
219 
     | 
    
         
             
              - - ">="
         
     | 
| 
       221 
220 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       222 
221 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       223 
222 
     | 
    
         
             
            requirements: []
         
     | 
| 
       224 
     | 
    
         
            -
            rubygems_version: 3.5. 
     | 
| 
      
 223 
     | 
    
         
            +
            rubygems_version: 3.5.21
         
     | 
| 
       225 
224 
     | 
    
         
             
            signing_key:
         
     | 
| 
       226 
225 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       227 
226 
     | 
    
         
             
            summary: The engine powering your Rails frontend
         
     | 
| 
         @@ -1,16 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Proscenium
         
     | 
| 
       4 
     | 
    
         
            -
              class Middleware
         
     | 
| 
       5 
     | 
    
         
            -
                # Handles requests for URL encoded URL's.
         
     | 
| 
       6 
     | 
    
         
            -
                class Url < Esbuild
         
     | 
| 
       7 
     | 
    
         
            -
                  private
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                  # @override [Esbuild] It's a URL, so always assume it is renderable (we won't actually know
         
     | 
| 
       10 
     | 
    
         
            -
                  #   until it's downloaded).
         
     | 
| 
       11 
     | 
    
         
            -
                  def renderable?
         
     | 
| 
       12 
     | 
    
         
            -
                    true
         
     | 
| 
       13 
     | 
    
         
            -
                  end
         
     | 
| 
       14 
     | 
    
         
            -
                end
         
     | 
| 
       15 
     | 
    
         
            -
              end
         
     | 
| 
       16 
     | 
    
         
            -
            end
         
     |