homura-runtime 0.2.5 → 0.2.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 37cf4aa4a816991923d004144655459aef2da15445ee0c23aaf94105e36e892d
|
|
4
|
+
data.tar.gz: ceae9042b8c7613d03f12be573977846838888d74429e829c01b6328f81f2286
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96c093338500d78dde842fc48fe28807749e9ccb68e4fb3157e34fa81e95ae54e75b65b7d6708b38d60e782670553ff4b007aa40f73c8ad2fda4a2d6b9d38d91
|
|
7
|
+
data.tar.gz: 44967c5dfb3edf5b3bfbb52d4f9e8c6e996436de41121b8324f74aad07c694ef133b725906b156d35df10abf023242003236d1cd955846a8a86d3030bc0d5561
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.6 (2026-04-24)
|
|
4
|
+
|
|
5
|
+
- Remove the shipped `cloudflare-workers-build` filename entirely and keep the
|
|
6
|
+
build implementation under `exe/homura-build`, matching the `homura build`
|
|
7
|
+
public surface.
|
|
8
|
+
- Make `homura build --with-db` imply the consumer-safe standalone path so D1 /
|
|
9
|
+
Sequel apps do not need to remember both flags.
|
|
10
|
+
- Let `compile-assets` succeed for an empty `public/` directory and improve the
|
|
11
|
+
auto-await analyzer so async local helper methods are awaited at their call
|
|
12
|
+
sites.
|
|
13
|
+
|
|
3
14
|
## 0.2.5 (2026-04-23)
|
|
4
15
|
|
|
5
16
|
- Load Workers-only `zlib`, `tempfile`, and `tilt` shims via `require_relative`
|
|
@@ -27,14 +38,14 @@
|
|
|
27
38
|
|
|
28
39
|
## 0.2.0 (2026-04-23)
|
|
29
40
|
|
|
30
|
-
- Remove the old
|
|
41
|
+
- Remove the old standalone build executable and expose the
|
|
31
42
|
build pipeline through `homura build`.
|
|
32
43
|
- Keep the internal build implementation in the runtime gem while letting the
|
|
33
44
|
single `homura` CLI dispatch to it.
|
|
34
45
|
|
|
35
46
|
## 0.1.6 (2026-04-23)
|
|
36
47
|
|
|
37
|
-
- Teach `
|
|
48
|
+
- Teach `homura build --standalone --with-db` to add the packaged
|
|
38
49
|
`sequel-d1` gem `vendor/` directory to the Opal load path before the gem's
|
|
39
50
|
`lib/`, so `require 'sequel'` resolves to the bundled Opal-compatible Sequel
|
|
40
51
|
subset instead of the CRuby gem.
|
|
@@ -43,7 +54,7 @@
|
|
|
43
54
|
|
|
44
55
|
- Make `auto-await` emit rewritten files for existing hand-written `.__await__`
|
|
45
56
|
usage when the only missing piece is `# await: true`.
|
|
46
|
-
- Make `
|
|
57
|
+
- Make `homura build --standalone` restore `cf-runtime/` from the
|
|
47
58
|
packaged gem and derive standalone template/asset namespaces from the project
|
|
48
59
|
name by default, with explicit override flags when needed.
|
|
49
60
|
- Reject unsupported ERB yield forms like `<% yield %>` and `yield(arg)` with
|
|
@@ -68,12 +79,12 @@
|
|
|
68
79
|
|
|
69
80
|
- Package the runtime's Opal compile-time vendor shims (`digest`, `zlib`,
|
|
70
81
|
`tempfile`, `tilt`, `rubygems/version`) inside the gem.
|
|
71
|
-
- Teach `
|
|
82
|
+
- Teach `homura build --standalone` to add packaged gem `vendor/`
|
|
72
83
|
directories to the Opal load path, so published gems no longer depend on the
|
|
73
84
|
monorepo root `vendor/`.
|
|
74
85
|
## 0.1.1 (2026-04-23)
|
|
75
86
|
|
|
76
|
-
- Fix `
|
|
87
|
+
- Fix `homura build --standalone` and `exe/auto-await` to resolve only
|
|
77
88
|
the published gem names `homura-runtime` / `sinatra-homura`.
|
|
78
89
|
- Add regression coverage for gem name resolution and Gemfile path detection.
|
|
79
90
|
|
data/exe/compile-assets
CHANGED
|
@@ -82,10 +82,6 @@ end
|
|
|
82
82
|
ns = options[:namespace]
|
|
83
83
|
|
|
84
84
|
files = Dir.glob(File.join(public_dir, '**', '*')).select { |f| File.file?(f) }.sort
|
|
85
|
-
if files.empty?
|
|
86
|
-
warn 'compile-assets: directory is empty'
|
|
87
|
-
exit 1
|
|
88
|
-
end
|
|
89
85
|
|
|
90
86
|
out_path = options[:output]
|
|
91
87
|
FileUtils.mkdir_p(File.dirname(out_path))
|
|
@@ -69,6 +69,8 @@ OptionParser.new do |o|
|
|
|
69
69
|
o.on('--assets-namespace NAME', 'Standalone assets module name (default: project-derived)') { |n| options[:assets_namespace] = n }
|
|
70
70
|
end.parse!
|
|
71
71
|
|
|
72
|
+
options[:standalone] = true if options[:with_db]
|
|
73
|
+
|
|
72
74
|
root = Pathname(options[:root]).expand_path
|
|
73
75
|
options[:templates_namespace] ||= CloudflareWorkers::BuildSupport.standalone_namespace(root, 'Templates') if options[:standalone]
|
|
74
76
|
options[:assets_namespace] ||= CloudflareWorkers::BuildSupport.standalone_namespace(root, 'Assets') if options[:standalone]
|
|
@@ -113,7 +115,7 @@ def run_opal_homura!(root, opal_input, opal_output)
|
|
|
113
115
|
env = { 'OPAL_PREFORK_DISABLE' => '1' }
|
|
114
116
|
out_err, status = Open3.capture2e(env, *argv, chdir: root.to_s)
|
|
115
117
|
File.write(stderr_log, out_err)
|
|
116
|
-
abort(
|
|
118
|
+
abort("homura build: opal failed (see #{stderr_log})") unless status.success?
|
|
117
119
|
end
|
|
118
120
|
|
|
119
121
|
def homura_vendor_from_gemfile(project_root)
|
|
@@ -132,7 +134,7 @@ def run_opal_standalone!(root, opal_input, opal_output, with_db:)
|
|
|
132
134
|
env = { 'OPAL_PREFORK_DISABLE' => '1' }
|
|
133
135
|
out_err, status = Open3.capture2e(env, *argv, chdir: root.to_s)
|
|
134
136
|
File.write(stderr_log, out_err)
|
|
135
|
-
abort(
|
|
137
|
+
abort("homura build: opal failed (see #{stderr_log})") unless status.success?
|
|
136
138
|
end
|
|
137
139
|
|
|
138
140
|
def write_entrypoint!(root, out_path, setup:, bundle:, worker_mod:)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'parser/current'
|
|
4
4
|
require 'parser/source/tree_rewriter'
|
|
5
|
+
require 'set'
|
|
5
6
|
|
|
6
7
|
module CloudflareWorkers
|
|
7
8
|
module AutoAwait
|
|
@@ -12,6 +13,7 @@ module CloudflareWorkers
|
|
|
12
13
|
@await_nodes = []
|
|
13
14
|
@env = {}
|
|
14
15
|
@method_returns = {}
|
|
16
|
+
@async_local_methods = Set.new
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
def process(source, filename = '(auto-await)')
|
|
@@ -19,14 +21,22 @@ module CloudflareWorkers
|
|
|
19
21
|
buffer.source = source
|
|
20
22
|
parser = Parser::CurrentRuby.new
|
|
21
23
|
ast = parser.parse(buffer)
|
|
22
|
-
@
|
|
23
|
-
@
|
|
24
|
-
|
|
24
|
+
@method_returns = {}
|
|
25
|
+
@async_local_methods = Set.new
|
|
26
|
+
|
|
27
|
+
analyze_pass(ast)
|
|
28
|
+
analyze_pass(ast)
|
|
25
29
|
[buffer, @await_nodes]
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
private
|
|
29
33
|
|
|
34
|
+
def analyze_pass(ast)
|
|
35
|
+
@await_nodes = []
|
|
36
|
+
@env = {}
|
|
37
|
+
process_node(ast)
|
|
38
|
+
end
|
|
39
|
+
|
|
30
40
|
def process_node(node)
|
|
31
41
|
return unless node.is_a?(Parser::AST::Node)
|
|
32
42
|
|
|
@@ -72,6 +82,7 @@ module CloudflareWorkers
|
|
|
72
82
|
def process_def(node)
|
|
73
83
|
method_name = node.children[0]
|
|
74
84
|
saved_env = @env
|
|
85
|
+
before_awaits = @await_nodes.length
|
|
75
86
|
@env = @registry.helper_factories.dup
|
|
76
87
|
|
|
77
88
|
node.children[1..-1].each { |child| process_node(child) if child.is_a?(Parser::AST::Node) }
|
|
@@ -79,6 +90,10 @@ module CloudflareWorkers
|
|
|
79
90
|
body = node.children[2]
|
|
80
91
|
return_cls = infer_class(body)
|
|
81
92
|
@method_returns[method_name] = return_cls if return_cls
|
|
93
|
+
body_source = node.loc.expression&.source.to_s
|
|
94
|
+
if @await_nodes.length > before_awaits || body_source.include?('.__await__')
|
|
95
|
+
@async_local_methods << method_name
|
|
96
|
+
end
|
|
82
97
|
|
|
83
98
|
@env = saved_env
|
|
84
99
|
end
|
|
@@ -119,6 +134,7 @@ module CloudflareWorkers
|
|
|
119
134
|
# Receiver-less calls (implicit self) — check helpers.
|
|
120
135
|
helpers = @registry.async_helpers[method_name]
|
|
121
136
|
return true if helpers && !helpers.empty?
|
|
137
|
+
return true if @async_local_methods.include?(method_name)
|
|
122
138
|
false
|
|
123
139
|
end
|
|
124
140
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: homura-runtime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kazuhiro Homma
|
|
@@ -48,11 +48,11 @@ extra_rdoc_files: []
|
|
|
48
48
|
files:
|
|
49
49
|
- CHANGELOG.md
|
|
50
50
|
- README.md
|
|
51
|
-
- bin/cloudflare-workers-build
|
|
52
51
|
- docs/ARCHITECTURE.md
|
|
53
52
|
- exe/auto-await
|
|
54
53
|
- exe/compile-assets
|
|
55
54
|
- exe/compile-erb
|
|
55
|
+
- exe/homura-build
|
|
56
56
|
- lib/cloudflare_workers.rb
|
|
57
57
|
- lib/cloudflare_workers/ai.rb
|
|
58
58
|
- lib/cloudflare_workers/async_registry.rb
|