proscenium 0.18.0-x86_64-linux → 0.19.0.beta1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proscenium/builder.rb +34 -71
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/ext/proscenium.h +11 -32
- data/lib/proscenium/helper.rb +2 -2
- data/lib/proscenium/log_subscriber.rb +1 -1
- data/lib/proscenium/middleware/esbuild.rb +1 -2
- data/lib/proscenium/railtie.rb +1 -0
- data/lib/proscenium/resolver.rb +2 -2
- data/lib/proscenium/side_load.rb +2 -4
- data/lib/proscenium/ui/test.js +1 -1
- data/lib/proscenium/{libs → ui}/ujs/index.js +1 -1
- data/lib/proscenium/version.rb +1 -1
- metadata +10 -11
- data/lib/proscenium/libs/test.js +0 -1
- /data/lib/proscenium/{libs → ui}/custom_element.js +0 -0
- /data/lib/proscenium/{libs → ui}/react-manager/index.jsx +0 -0
- /data/lib/proscenium/{libs → ui}/react-manager/react.js +0 -0
- /data/lib/proscenium/{libs → ui}/stimulus-loading.js +0 -0
- /data/lib/proscenium/{libs → ui}/ujs/class.js +0 -0
- /data/lib/proscenium/{libs → ui}/ujs/data_confirm.js +0 -0
- /data/lib/proscenium/{libs → ui}/ujs/data_disable_with.js +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d2d60900c3ba2c866fc46ccee659cfd3560e05a542d4fd2a2962a217e29e0e2
|
4
|
+
data.tar.gz: d00d3d3dbbb1d7b215c109af0419eefc7ef477f1a1e2bf5a65c4de1e4755c4ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d22cc2f21be18701b64e4909fc4d94f7bfa8faacb3c911269cbf92c0234a9355e8b87ee92a3cbc1d97a944dc6d84add1acafc14fbb7f72fabb8193ba431dd09
|
7
|
+
data.tar.gz: e59ecc8f6fe8448398d7d902c5ce957e3d3c977ebcac8fdb0830cc6173503f3db6d4d5546b592d20336a94e4170aff158bcb9b8cf375fbce1b5b6feb55b992bd
|
data/lib/proscenium/builder.rb
CHANGED
@@ -7,6 +7,8 @@ module Proscenium
|
|
7
7
|
class Builder
|
8
8
|
class CompileError < StandardError; end
|
9
9
|
|
10
|
+
ENVIRONMENTS = { development: 1, test: 2, production: 3 }.freeze
|
11
|
+
|
10
12
|
class Result < FFI::Struct
|
11
13
|
layout :success, :bool,
|
12
14
|
:response, :string
|
@@ -19,45 +21,21 @@ module Proscenium
|
|
19
21
|
enum :environment, [:development, 1, :test, :production]
|
20
22
|
|
21
23
|
attach_function :build_to_string, [
|
22
|
-
:string,
|
23
|
-
:
|
24
|
-
:string, # Path to import map, relative to root
|
25
|
-
:string, # ENV variables as a JSON string
|
26
|
-
|
27
|
-
# Config
|
28
|
-
:string, # Rails application root
|
29
|
-
:string, # Proscenium gem root
|
30
|
-
:environment, # Rails environment as a Symbol
|
31
|
-
:bool, # Code splitting enabled?
|
32
|
-
:string, # Engine names and paths as a JSON string
|
33
|
-
:bool # Debugging enabled?
|
24
|
+
:string, # Path or entry point.
|
25
|
+
:pointer # Config as JSON.
|
34
26
|
], Result.by_value
|
35
27
|
|
36
28
|
attach_function :build_to_path, [
|
37
|
-
:string,
|
38
|
-
:
|
39
|
-
:string, # Path to import map, relative to root
|
40
|
-
:string, # ENV variables as a JSON string
|
41
|
-
|
42
|
-
# Config
|
43
|
-
:string, # Rails application root
|
44
|
-
:string, # Proscenium gem root
|
45
|
-
:environment, # Rails environment as a Symbol
|
46
|
-
:bool, # Code splitting enabled?
|
47
|
-
:string, # Engine names and paths as a JSON string
|
48
|
-
:bool # Debugging enabled?
|
29
|
+
:string, # Path or entry point. Multiple can be given by separating with a semi-colon
|
30
|
+
:pointer # Config as JSON.
|
49
31
|
], Result.by_value
|
50
32
|
|
51
33
|
attach_function :resolve, [
|
52
|
-
:string,
|
53
|
-
:
|
54
|
-
|
55
|
-
# Config
|
56
|
-
:string, # Rails application root
|
57
|
-
:string, # Proscenium gem root
|
58
|
-
:environment, # Rails environment as a Symbol
|
59
|
-
:bool # debugging enabled?
|
34
|
+
:string, # path or entry point
|
35
|
+
:pointer # Config as JSON.
|
60
36
|
], Result.by_value
|
37
|
+
|
38
|
+
attach_function :reset_config, [], :void
|
61
39
|
end
|
62
40
|
|
63
41
|
class BuildError < StandardError
|
@@ -83,21 +61,34 @@ module Proscenium
|
|
83
61
|
end
|
84
62
|
end
|
85
63
|
|
86
|
-
def self.build_to_path(path, root: nil
|
87
|
-
new(root
|
64
|
+
def self.build_to_path(path, root: nil)
|
65
|
+
new(root:).build_to_path(path)
|
88
66
|
end
|
89
67
|
|
90
|
-
def self.build_to_string(path, root: nil
|
91
|
-
new(root
|
68
|
+
def self.build_to_string(path, root: nil)
|
69
|
+
new(root:).build_to_string(path)
|
92
70
|
end
|
93
71
|
|
94
72
|
def self.resolve(path, root: nil)
|
95
73
|
new(root:).resolve(path)
|
96
74
|
end
|
97
75
|
|
98
|
-
|
99
|
-
|
100
|
-
|
76
|
+
# Intended for tests only.
|
77
|
+
def self.reset_config!
|
78
|
+
Request.reset_config
|
79
|
+
end
|
80
|
+
|
81
|
+
def initialize(root: nil)
|
82
|
+
@request_config = FFI::MemoryPointer.from_string({
|
83
|
+
RootPath: (root || Rails.root).to_s,
|
84
|
+
GemPath: gem_root,
|
85
|
+
Environment: ENVIRONMENTS.fetch(Rails.env.to_sym, 2),
|
86
|
+
Engines: engines,
|
87
|
+
EnvVars: env_vars,
|
88
|
+
CodeSplitting: Proscenium.config.code_splitting,
|
89
|
+
Bundle: Proscenium.config.bundle,
|
90
|
+
Debug: Proscenium.config.debug
|
91
|
+
}.to_json)
|
101
92
|
end
|
102
93
|
|
103
94
|
def build_to_path(path)
|
@@ -105,13 +96,7 @@ module Proscenium
|
|
105
96
|
identifier: path,
|
106
97
|
cached: Proscenium.cache.exist?(path)) do
|
107
98
|
Proscenium.cache.fetch path do
|
108
|
-
result = Request.build_to_path(path, @
|
109
|
-
@root.to_s,
|
110
|
-
gem_root,
|
111
|
-
Rails.env.to_sym,
|
112
|
-
Proscenium.config.code_splitting,
|
113
|
-
engines.to_json,
|
114
|
-
Proscenium.config.debug)
|
99
|
+
result = Request.build_to_path(path, @request_config)
|
115
100
|
|
116
101
|
raise BuildError, result[:response] unless result[:success]
|
117
102
|
|
@@ -122,13 +107,7 @@ module Proscenium
|
|
122
107
|
|
123
108
|
def build_to_string(path)
|
124
109
|
ActiveSupport::Notifications.instrument('build_to_string.proscenium', identifier: path) do
|
125
|
-
result = Request.build_to_string(path, @
|
126
|
-
@root.to_s,
|
127
|
-
gem_root,
|
128
|
-
Rails.env.to_sym,
|
129
|
-
Proscenium.config.code_splitting,
|
130
|
-
engines.to_json,
|
131
|
-
Proscenium.config.debug)
|
110
|
+
result = Request.build_to_string(path, @request_config)
|
132
111
|
|
133
112
|
raise BuildError, result[:response] unless result[:success]
|
134
113
|
|
@@ -138,10 +117,8 @@ module Proscenium
|
|
138
117
|
|
139
118
|
def resolve(path)
|
140
119
|
ActiveSupport::Notifications.instrument('resolve.proscenium', identifier: path) do
|
141
|
-
result = Request.resolve(path,
|
142
|
-
|
143
|
-
Rails.env.to_sym,
|
144
|
-
Proscenium.config.debug)
|
120
|
+
result = Request.resolve(path, @request_config)
|
121
|
+
|
145
122
|
raise ResolveError.new(path, result[:response]) unless result[:success]
|
146
123
|
|
147
124
|
result[:response]
|
@@ -168,20 +145,6 @@ module Proscenium
|
|
168
145
|
end
|
169
146
|
end
|
170
147
|
|
171
|
-
def import_map
|
172
|
-
return unless (path = Rails.root&.join('config'))
|
173
|
-
|
174
|
-
if (json = path.join('import_map.json')).exist?
|
175
|
-
return json.relative_path_from(@root).to_s
|
176
|
-
end
|
177
|
-
|
178
|
-
if (js = path.join('import_map.js')).exist?
|
179
|
-
return js.relative_path_from(@root).to_s
|
180
|
-
end
|
181
|
-
|
182
|
-
nil
|
183
|
-
end
|
184
|
-
|
185
148
|
def gem_root
|
186
149
|
Pathname.new(__dir__).join('..', '..').to_s
|
187
150
|
end
|
Binary file
|
@@ -82,49 +82,28 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
82
82
|
extern "C" {
|
83
83
|
#endif
|
84
84
|
|
85
|
+
extern void reset_config();
|
85
86
|
|
86
|
-
// Build the given `path`
|
87
|
+
// Build the given `path` using the `config`.
|
87
88
|
//
|
88
|
-
//
|
89
|
-
//
|
90
|
-
// - baseUrl - base URL of the Rails app. eg. https://example.com
|
91
|
-
// - importMap - Path to the import map relative to `root`.
|
92
|
-
// - envVars - JSON string of environment variables.
|
93
|
-
// Config:
|
94
|
-
// - root - The working directory.
|
95
|
-
// - env - The environment (1 = development, 2 = test, 3 = production)
|
96
|
-
// - codeSpitting?
|
97
|
-
// - debug?
|
89
|
+
// - path - The path to build relative to `root`.
|
90
|
+
// - config
|
98
91
|
//
|
99
|
-
extern struct Result build_to_string(char*
|
92
|
+
extern struct Result build_to_string(char* filePath, char* configJson);
|
100
93
|
|
101
94
|
// Build the given `path` in the `root`.
|
102
95
|
//
|
103
|
-
//
|
104
|
-
//
|
105
|
-
// with a semi-colon.
|
106
|
-
// - baseUrl - base URL of the Rails app. eg. https://example.com
|
107
|
-
// - importMap - Path to the import map relative to `root`.
|
108
|
-
// - envVars - JSON string of environment variables.
|
109
|
-
// Config:
|
110
|
-
// - root - The working directory.
|
111
|
-
// - env - The environment (1 = development, 2 = test, 3 = production)
|
112
|
-
// - codeSpitting?
|
113
|
-
// - debug?
|
96
|
+
// - path - The path to build relative to `root`.
|
97
|
+
// - config
|
114
98
|
//
|
115
|
-
extern struct Result build_to_path(char*
|
99
|
+
extern struct Result build_to_path(char* filePath, char* configJson);
|
116
100
|
|
117
101
|
// Resolve the given `path` relative to the `root`.
|
118
102
|
//
|
119
|
-
//
|
120
|
-
//
|
121
|
-
// - importMap - Path to the import map relative to `root`.
|
122
|
-
// Config
|
123
|
-
// - root - The working directory.
|
124
|
-
// - env - The environment (1 = development, 2 = test, 3 = production)
|
125
|
-
// - debug?
|
103
|
+
// - path - The path to build relative to `root`.
|
104
|
+
// - config
|
126
105
|
//
|
127
|
-
extern struct Result resolve(char*
|
106
|
+
extern struct Result resolve(char* filePath, char* configJson);
|
128
107
|
|
129
108
|
#ifdef __cplusplus
|
130
109
|
}
|
data/lib/proscenium/helper.rb
CHANGED
@@ -16,14 +16,14 @@ module Proscenium
|
|
16
16
|
# those asset paths all begin with a slash, which the Rails asset helpers do not pass through to
|
17
17
|
# here.
|
18
18
|
#
|
19
|
-
# If the given `path` is a bare path (does not start with
|
19
|
+
# If the given `path` is a bare path (does not start with `./` or `../`), then we use
|
20
20
|
# Rails default conventions, and serve CSS from /app/assets/stylesheets and JS from
|
21
21
|
# /app/javascript.
|
22
22
|
def compute_asset_path(path, options = {})
|
23
23
|
if %i[javascript stylesheet].include?(options[:type])
|
24
24
|
path.prepend DEFAULT_RAILS_ASSET_PATHS[options[:type]] unless path.start_with?('./', '../')
|
25
25
|
|
26
|
-
result = Proscenium::Builder.build_to_path(path
|
26
|
+
result = Proscenium::Builder.build_to_path(path)
|
27
27
|
return result.split('::').last.delete_prefix 'public'
|
28
28
|
end
|
29
29
|
|
@@ -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 = " #{color('[Proscenium]', nil, bold: true)} Building #{path}"
|
30
|
+
message = " #{color('[Proscenium]', nil, bold: true)} Building (to string) #{path}"
|
31
31
|
message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
32
32
|
end
|
33
33
|
end
|
@@ -20,8 +20,7 @@ module Proscenium
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def attempt
|
23
|
-
render_response Builder.build_to_string(path_to_build
|
24
|
-
base_url: @request.base_url)
|
23
|
+
render_response Builder.build_to_string(path_to_build)
|
25
24
|
rescue Builder::CompileError => e
|
26
25
|
raise self.class::CompileError, { file: @request.fullpath, detail: e.message }, caller
|
27
26
|
end
|
data/lib/proscenium/railtie.rb
CHANGED
data/lib/proscenium/resolver.rb
CHANGED
@@ -25,10 +25,10 @@ module Proscenium
|
|
25
25
|
"/#{path}"
|
26
26
|
elsif path.start_with?(Proscenium.ui_path.to_s)
|
27
27
|
path.delete_prefix Proscenium.root.join('lib').to_s
|
28
|
-
elsif (engine = Proscenium.config.engines.find { |e| path.start_with? "#{e.root}/" })
|
29
|
-
path.sub(/^#{engine.root}/, "/#{engine.engine_name}")
|
30
28
|
elsif path.start_with?("#{Rails.root}/")
|
31
29
|
path.delete_prefix Rails.root.to_s
|
30
|
+
elsif (engine = Proscenium.config.engines.find { |e| path.start_with? "#{e.root}/" })
|
31
|
+
path.sub(/^#{engine.root}/, "/#{engine.engine_name}")
|
32
32
|
else
|
33
33
|
Builder.resolve path
|
34
34
|
end
|
data/lib/proscenium/side_load.rb
CHANGED
@@ -41,8 +41,7 @@ module Proscenium
|
|
41
41
|
paths_to_build << x.delete_prefix('/')
|
42
42
|
end
|
43
43
|
|
44
|
-
result = Proscenium::Builder.build_to_path(paths_to_build.join(';')
|
45
|
-
base_url: helpers.request.base_url)
|
44
|
+
result = Proscenium::Builder.build_to_path(paths_to_build.join(';'))
|
46
45
|
|
47
46
|
out = []
|
48
47
|
result.split(';').each do |x|
|
@@ -77,8 +76,7 @@ module Proscenium
|
|
77
76
|
paths_to_build << x.delete_prefix('/')
|
78
77
|
end
|
79
78
|
|
80
|
-
result = Proscenium::Builder.build_to_path(paths_to_build.join(';')
|
81
|
-
base_url: helpers.request.base_url)
|
79
|
+
result = Proscenium::Builder.build_to_path(paths_to_build.join(';'))
|
82
80
|
|
83
81
|
included_js_comment = response_body.first.include?(JS_COMMENT)
|
84
82
|
included_lazy_comment = response_body.first.include?(LAZY_COMMENT)
|
data/lib/proscenium/ui/test.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
console.log("
|
1
|
+
console.log("@proscenium/ui/test.js");
|
@@ -2,7 +2,7 @@ export default async () => {
|
|
2
2
|
window.Proscenium = window.Proscenium || {};
|
3
3
|
|
4
4
|
if (!window.Proscenium.UJS) {
|
5
|
-
const classPath = "
|
5
|
+
const classPath = "/proscenium/ui/ujs/class.js";
|
6
6
|
const module = await import(classPath);
|
7
7
|
window.Proscenium.UJS = new module.default();
|
8
8
|
}
|
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.19.0.beta1
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -128,15 +128,6 @@ files:
|
|
128
128
|
- lib/proscenium/ext/proscenium.h
|
129
129
|
- lib/proscenium/helper.rb
|
130
130
|
- lib/proscenium/importer.rb
|
131
|
-
- lib/proscenium/libs/custom_element.js
|
132
|
-
- lib/proscenium/libs/react-manager/index.jsx
|
133
|
-
- lib/proscenium/libs/react-manager/react.js
|
134
|
-
- lib/proscenium/libs/stimulus-loading.js
|
135
|
-
- lib/proscenium/libs/test.js
|
136
|
-
- lib/proscenium/libs/ujs/class.js
|
137
|
-
- lib/proscenium/libs/ujs/data_confirm.js
|
138
|
-
- lib/proscenium/libs/ujs/data_disable_with.js
|
139
|
-
- lib/proscenium/libs/ujs/index.js
|
140
131
|
- lib/proscenium/log_subscriber.rb
|
141
132
|
- lib/proscenium/middleware.rb
|
142
133
|
- lib/proscenium/middleware/base.rb
|
@@ -162,7 +153,15 @@ files:
|
|
162
153
|
- lib/proscenium/ui/breadcrumbs/control.rb
|
163
154
|
- lib/proscenium/ui/breadcrumbs/mixins.css
|
164
155
|
- lib/proscenium/ui/component.rb
|
156
|
+
- lib/proscenium/ui/custom_element.js
|
157
|
+
- lib/proscenium/ui/react-manager/index.jsx
|
158
|
+
- lib/proscenium/ui/react-manager/react.js
|
159
|
+
- lib/proscenium/ui/stimulus-loading.js
|
165
160
|
- lib/proscenium/ui/test.js
|
161
|
+
- lib/proscenium/ui/ujs/class.js
|
162
|
+
- lib/proscenium/ui/ujs/data_confirm.js
|
163
|
+
- lib/proscenium/ui/ujs/data_disable_with.js
|
164
|
+
- lib/proscenium/ui/ujs/index.js
|
166
165
|
- lib/proscenium/utils.rb
|
167
166
|
- lib/proscenium/version.rb
|
168
167
|
- lib/proscenium/view_component.rb
|
data/lib/proscenium/libs/test.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
console.log("/@proscenium/test.js");
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|