proscenium 0.11.0.pre.2-aarch64-linux → 0.11.0.pre.6-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df58b9b5428045322cb5c63ffdf6579b083f48f1ff4e022d1a91f753a0f76497
4
- data.tar.gz: 3e54efcfb03d339675a73b499506b40a2812504085582431b971d76dee0fe064
3
+ metadata.gz: '008293b5da564933883b85ffe39d9f6d948760762e6d7fbcc6115fa593376a10'
4
+ data.tar.gz: 7f5343566a82e436972579d5220bbc77c999bfeebe05685a1d30538ab11ff9ff
5
5
  SHA512:
6
- metadata.gz: 4496444e1258bae6440b050d3f82753544b0591696d32149b4a0544fefe63beb12e312bc655481ca3fdabc3b6bc183a44e657ab6e13d5fade4d00d7508c6f2db
7
- data.tar.gz: b02138ec0f5833a50ab7e043ad47eeb8e5a505737517ea843bdd6b42694818bc79a46477c38dc9831311a2f7d78908d34df17048f2698131bd8d0d22f63f27f0
6
+ metadata.gz: 6d92a7cf3bceb5c0bd994096460723ef72def8bc11dba20a051acc9f49e54bbe5263a03c2495b8f9562376b8e9752f9368a8ac4d486a8177103423c4bb6a6a21
7
+ data.tar.gz: 28ccb5fb2a41913d9bee692b25497db690c7d597d60e62373287f4f95a47e243999ad191c021ccb186d30c1be4382586cf963abfd2b4a0dfafaef0f21889dcd2
@@ -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, Rails.env.to_sym,
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* root, unsigned int env, GoUint8 codeSplitting, GoUint8 debug);
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* root, unsigned int env, GoUint8 debug);
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
  }
@@ -31,27 +31,31 @@ function init() {
31
31
  "prosceniumComponentForwardChildren" in element.dataset &&
32
32
  element.innerHTML !== "";
33
33
 
34
- Promise.all([react, Component]).then(([r, c]) => {
35
- if (proscenium.env.RAILS_ENV === "development") {
36
- console.groupCollapsed(
37
- `[proscenium/react/manager] 🔥 %o mounted!`,
38
- path
39
- );
40
- console.log("props: %o", props);
41
- console.groupEnd();
42
- }
34
+ Promise.all([react, Component])
35
+ .then(([r, c]) => {
36
+ if (proscenium.env.RAILS_ENV === "development") {
37
+ console.groupCollapsed(
38
+ `[proscenium/react/manager] 🔥 %o mounted!`,
39
+ path
40
+ );
41
+ console.log("props: %o", props);
42
+ console.groupEnd();
43
+ }
43
44
 
44
- let component;
45
- if (forwardChildren) {
46
- component = r.createElement(c.default, props, element.innerHTML);
47
- } else if (children) {
48
- component = r.createElement(c.default, props, children);
49
- } else {
50
- component = r.createElement(c.default, props);
51
- }
45
+ let component;
46
+ if (forwardChildren) {
47
+ component = r.createElement(c.default, props, element.innerHTML);
48
+ } else if (children) {
49
+ component = r.createElement(c.default, props, children);
50
+ } else {
51
+ component = r.createElement(c.default, props);
52
+ }
52
53
 
53
- r.createRoot(element).render(component);
54
- });
54
+ r.createRoot(element).render(component);
55
+ })
56
+ .catch((error) => {
57
+ console.error("[proscenium/react/manager] %o - %o", path, error);
58
+ });
55
59
  }
56
60
 
57
61
  Array.from(elements, (element) => {
@@ -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(Pathname(root).join(path.delete_prefix('/').b).to_s)
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
@@ -10,8 +10,8 @@ module Proscenium
10
10
  '/lib/proscenium/libs')).to_s
11
11
  end
12
12
 
13
- def root
14
- @root ||= Proscenium::Railtie.root.to_s
13
+ def root_for_readable
14
+ Proscenium::Railtie.root
15
15
  end
16
16
  end
17
17
  end
@@ -38,13 +38,14 @@ module Proscenium
38
38
  class_attribute :lazy, default: false
39
39
 
40
40
  class_attribute :loader
41
+
42
+ # @return [String] the URL path to the component manager.
43
+ class_attribute :manager, default: '/@proscenium/react-manager/index.jsx'
41
44
  end
42
45
 
43
46
  class_methods do
44
- # Import only the component manager. The component itself is side loaded in the initializer,
45
- # so that it can be lazy loaded based on the value of the `lazy` instance variable.
46
47
  def sideload
47
- Importer.import resolve: '@proscenium/react-manager/index.jsx'
48
+ Importer.import manager
48
49
  Importer.sideload source_path, lazy: true
49
50
  end
50
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.11.0.pre.2'
4
+ VERSION = '0.11.0.pre.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proscenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0.pre.2
4
+ version: 0.11.0.pre.6
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: 2023-09-12 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport