proscenium 0.11.0.pre.3-arm64-darwin → 0.11.0.pre.4-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/lib/proscenium/builder.rb +9 -4
 - data/lib/proscenium/ext/proscenium +0 -0
 - data/lib/proscenium/ext/proscenium.h +2 -2
 - data/lib/proscenium/middleware/base.rb +5 -5
 - data/lib/proscenium/middleware/esbuild.rb +1 -1
 - data/lib/proscenium/middleware/runtime.rb +2 -2
 - data/lib/proscenium/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9d396409a9c799e4b50a26c0c126f38d747909d6132f6283bf568480260aaf24
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 036de19a63f087265b8d3af8643cbd6df08d24584cb061705437deb97814bde8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4c1c4c1ac0fc6d669f58b04f970e09d69b010f439149dfc6433d67a45659b8716b691a8b54387b665bb3b6e4c16c5b55c91211ad5181b9898b88526cef4690b0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 90eec5d84086dc9134fec6264e90f7312e440f90837f1c97954c82075ef86c69f4ff414f68b5f3e630e87795515400ff4ff7ece2d6244f0e7f0f4550220eec33
         
     | 
    
        data/lib/proscenium/builder.rb
    CHANGED
    
    | 
         @@ -25,7 +25,8 @@ module Proscenium 
     | 
|
| 
       25 
25 
     | 
    
         
             
                    :string,      # ENV variables as a JSON string
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
                    # Config
         
     | 
| 
       28 
     | 
    
         
            -
                    :string,      # root
         
     | 
| 
      
 28 
     | 
    
         
            +
                    :string,      # Rails application root
         
     | 
| 
      
 29 
     | 
    
         
            +
                    :string,      # Proscenium gem root
         
     | 
| 
       29 
30 
     | 
    
         
             
                    :environment, # Rails environment as a Symbol
         
     | 
| 
       30 
31 
     | 
    
         
             
                    :bool,        # code splitting enabled?
         
     | 
| 
       31 
32 
     | 
    
         
             
                    :bool         # debugging enabled?
         
     | 
| 
         @@ -36,7 +37,8 @@ module Proscenium 
     | 
|
| 
       36 
37 
     | 
    
         
             
                    :string,      # path to import map, relative to root
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
39 
     | 
    
         
             
                    # Config
         
     | 
| 
       39 
     | 
    
         
            -
                    :string,      # root
         
     | 
| 
      
 40 
     | 
    
         
            +
                    :string,      # Rails application root
         
     | 
| 
      
 41 
     | 
    
         
            +
                    :string,      # Proscenium gem root
         
     | 
| 
       40 
42 
     | 
    
         
             
                    :environment, # Rails environment as a Symbol
         
     | 
| 
       41 
43 
     | 
    
         
             
                    :bool         # debugging enabled?
         
     | 
| 
       42 
44 
     | 
    
         
             
                  ], Result.by_value
         
     | 
| 
         @@ -73,10 +75,11 @@ module Proscenium 
     | 
|
| 
       73 
75 
     | 
    
         
             
                  @base_url = base_url
         
     | 
| 
       74 
76 
     | 
    
         
             
                end
         
     | 
| 
       75 
77 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                def build(path)
         
     | 
| 
      
 78 
     | 
    
         
            +
                def build(path) # rubocop:disable Metrics/AbcSize
         
     | 
| 
       77 
79 
     | 
    
         
             
                  ActiveSupport::Notifications.instrument('build.proscenium', identifier: path) do
         
     | 
| 
       78 
80 
     | 
    
         
             
                    result = Request.build(path, @base_url, import_map, env_vars.to_json,
         
     | 
| 
       79 
81 
     | 
    
         
             
                                           @root.to_s,
         
     | 
| 
      
 82 
     | 
    
         
            +
                                           Pathname.new(__dir__).join('..', '..').to_s,
         
     | 
| 
       80 
83 
     | 
    
         
             
                                           Rails.env.to_sym,
         
     | 
| 
       81 
84 
     | 
    
         
             
                                           Proscenium.config.code_splitting,
         
     | 
| 
       82 
85 
     | 
    
         
             
                                           Proscenium.config.debug)
         
     | 
| 
         @@ -89,7 +92,9 @@ module Proscenium 
     | 
|
| 
       89 
92 
     | 
    
         | 
| 
       90 
93 
     | 
    
         
             
                def resolve(path)
         
     | 
| 
       91 
94 
     | 
    
         
             
                  ActiveSupport::Notifications.instrument('resolve.proscenium', identifier: path) do
         
     | 
| 
       92 
     | 
    
         
            -
                    result = Request.resolve(path, import_map, @root.to_s, 
     | 
| 
      
 95 
     | 
    
         
            +
                    result = Request.resolve(path, import_map, @root.to_s,
         
     | 
| 
      
 96 
     | 
    
         
            +
                                             Pathname.new(__dir__).join('..', '..').to_s,
         
     | 
| 
      
 97 
     | 
    
         
            +
                                             Rails.env.to_sym,
         
     | 
| 
       93 
98 
     | 
    
         
             
                                             Proscenium.config.debug)
         
     | 
| 
       94 
99 
     | 
    
         
             
                    raise ResolveError.new(path, result[:response]) unless result[:success]
         
     | 
| 
       95 
100 
     | 
    
         | 
| 
         Binary file 
     | 
| 
         @@ -97,7 +97,7 @@ extern "C" { 
     | 
|
| 
       97 
97 
     | 
    
         
             
            //	- codeSpitting?
         
     | 
| 
       98 
98 
     | 
    
         
             
            //	- debug?
         
     | 
| 
       99 
99 
     | 
    
         
             
            //
         
     | 
| 
       100 
     | 
    
         
            -
            extern struct Result build(char* filepath, char* baseUrl, char* importMap, char* envVars, char*  
     | 
| 
      
 100 
     | 
    
         
            +
            extern struct Result build(char* filepath, char* baseUrl, char* importMap, char* envVars, char* appRoot, char* gemPath, unsigned int env, GoUint8 codeSplitting, GoUint8 debug);
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
            // Resolve the given `path` relative to the `root`.
         
     | 
| 
       103 
103 
     | 
    
         
             
            //
         
     | 
| 
         @@ -109,7 +109,7 @@ extern struct Result build(char* filepath, char* baseUrl, char* importMap, char* 
     | 
|
| 
       109 
109 
     | 
    
         
             
            //	- env - The environment (1 = development, 2 = test, 3 = production)
         
     | 
| 
       110 
110 
     | 
    
         
             
            //	- debug?
         
     | 
| 
       111 
111 
     | 
    
         
             
            //
         
     | 
| 
       112 
     | 
    
         
            -
            extern struct Result resolve(char* path, char* importMap, char*  
     | 
| 
      
 112 
     | 
    
         
            +
            extern struct Result resolve(char* path, char* importMap, char* appRoot, char* gemPath, unsigned int env, GoUint8 debug);
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
114 
     | 
    
         
             
            #ifdef __cplusplus
         
     | 
| 
       115 
115 
     | 
    
         
             
            }
         
     | 
| 
         @@ -53,22 +53,22 @@ module Proscenium 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  def file_readable?
         
     | 
| 
       54 
54 
     | 
    
         
             
                    return false unless (path = clean_path(sourcemap? ? real_path[0...-4] : real_path))
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                    file_stat = File.stat( 
     | 
| 
      
 56 
     | 
    
         
            +
                    file_stat = File.stat(root_for_readable.join(path.delete_prefix('/').b).to_s)
         
     | 
| 
       57 
57 
     | 
    
         
             
                  rescue SystemCallError
         
     | 
| 
       58 
58 
     | 
    
         
             
                    false
         
     | 
| 
       59 
59 
     | 
    
         
             
                  else
         
     | 
| 
       60 
60 
     | 
    
         
             
                    file_stat.file? && file_stat.readable?
         
     | 
| 
       61 
61 
     | 
    
         
             
                  end
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
      
 63 
     | 
    
         
            +
                  def root_for_readable
         
     | 
| 
      
 64 
     | 
    
         
            +
                    Rails.root
         
     | 
| 
      
 65 
     | 
    
         
            +
                  end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       63 
67 
     | 
    
         
             
                  def clean_path(file)
         
     | 
| 
       64 
68 
     | 
    
         
             
                    path = Rack::Utils.unescape_path file.chomp('/').delete_prefix('/')
         
     | 
| 
       65 
69 
     | 
    
         
             
                    Rack::Utils.clean_path_info path if Rack::Utils.valid_path? path
         
     | 
| 
       66 
70 
     | 
    
         
             
                  end
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                  def root
         
     | 
| 
       69 
     | 
    
         
            -
                    @root ||= Rails.root.to_s
         
     | 
| 
       70 
     | 
    
         
            -
                  end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
72 
     | 
    
         
             
                  def content_type
         
     | 
| 
       73 
73 
     | 
    
         
             
                    case ::File.extname(path_to_build)
         
     | 
| 
       74 
74 
     | 
    
         
             
                    when '.js', '.mjs', '.ts', '.tsx', '.jsx' then 'application/javascript'
         
     | 
| 
         @@ -20,7 +20,7 @@ module Proscenium 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                  def attempt
         
     | 
| 
       23 
     | 
    
         
            -
                    render_response Proscenium::Builder.build(path_to_build, root: root,
         
     | 
| 
      
 23 
     | 
    
         
            +
                    render_response Proscenium::Builder.build(path_to_build, root: Rails.root.to_s,
         
     | 
| 
       24 
24 
     | 
    
         
             
                                                                             base_url: @request.base_url)
         
     | 
| 
       25 
25 
     | 
    
         
             
                  rescue Proscenium::Builder::CompileError => e
         
     | 
| 
       26 
26 
     | 
    
         
             
                    raise self.class::CompileError, { file: @request.fullpath, detail: e.message }, caller
         
     | 
    
        data/lib/proscenium/version.rb
    CHANGED