homura-runtime 0.3.1 → 0.3.3
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/CHANGELOG.md +19 -0
- data/README.md +3 -3
- data/exe/compile-assets +2 -2
- data/exe/compile-erb +5 -7
- data/lib/homura/runtime/build_support.rb +19 -2
- data/lib/homura/runtime/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: '0560163955bb2302ec43a0942488960bbcd22b083bff564a88160ce3cdf3c3f0'
|
|
4
|
+
data.tar.gz: 27fa38a9b0a34bc406505c9cd1eb04076b2ea205d9dc761cc0fd54b209e411cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb0bf570d2a2412cb4b5320b756a4f60798ee523efe6b47bf952b136844e44c82aebb54a0d1ef701e649621d7e90ac74e4a0721fdaeb0e42f2bffe7df9e8186f
|
|
7
|
+
data.tar.gz: 129eb1515972a777f3f511213f30c1abb458f5450c527a68a4a38e5bda9aff41151f90f72f29e8054008819b3c67edaa8740ef9e93e786811cc317a20efbf761
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.3 (2026-05-02)
|
|
4
|
+
|
|
5
|
+
- Make standalone Rack-only builds work without `sinatra-homura` in the
|
|
6
|
+
bundle. `BuildSupport.standalone_load_paths` now treats Sinatra load
|
|
7
|
+
paths as optional while keeping the existing Sinatra app path unchanged.
|
|
8
|
+
- Keep generated empty ERB registries Sinatra-free. Apps with no `.erb`
|
|
9
|
+
templates no longer emit the Sinatra ERB hook, so a Rack-only app can
|
|
10
|
+
compile with `homura-runtime` alone.
|
|
11
|
+
- Guard static-asset middleware auto-installation so the generated asset
|
|
12
|
+
bundle only calls `Sinatra::Base.use` when a real Sinatra app is loaded.
|
|
13
|
+
|
|
14
|
+
## 0.3.2 (2026-04-30)
|
|
15
|
+
|
|
16
|
+
- README: replace the leftover `require 'cloudflare_workers'` line and
|
|
17
|
+
the `gem 'opal-homura', '= 1.8.3.rc1.3'` pin with the canonical
|
|
18
|
+
`require 'homura/runtime'` and `= 1.8.3.rc1.5` shipped on RubyGems.
|
|
19
|
+
- README support-matrix Opal row updated to `= 1.8.3.rc1.5` to match.
|
|
20
|
+
- No code changes vs. 0.3.1.
|
|
21
|
+
|
|
3
22
|
## 0.3.1 (2026-04-29)
|
|
4
23
|
|
|
5
24
|
- Fix `release-gems.yml` `Resolve gem target` step: now reads
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Core Ruby + Module Worker glue for [Opal](https://opalrb.com/) on [Cloudflare Wo
|
|
|
5
5
|
## What you get
|
|
6
6
|
|
|
7
7
|
- `require 'opal_patches'` — additive patches for Opal corelib vs real-world gems (Rack, etc.).
|
|
8
|
-
- `require '
|
|
8
|
+
- `require 'homura/runtime'` — Rack handler, Cloudflare bindings, multipart, queue, Durable Objects, etc. Sinatra apps using `sinatra-homura` get this required automatically; explicit consumers (non-Sinatra Rack apps) call it themselves.
|
|
9
9
|
- `runtime/worker_module.mjs` — fetch / scheduled / queue / DO adapters (**no Opal bundle import**).
|
|
10
10
|
- `runtime/worker.mjs` — thin bootstrap (crypto shim → bundle → `worker_module`) for legacy layouts.
|
|
11
11
|
- `runtime/setup-node-crypto.mjs` — `node:crypto` on `globalThis` before the Opal bundle loads.
|
|
@@ -14,7 +14,7 @@ Core Ruby + Module Worker glue for [Opal](https://opalrb.com/) on [Cloudflare Wo
|
|
|
14
14
|
|
|
15
15
|
## Quick start (homura monorepo)
|
|
16
16
|
|
|
17
|
-
1. `Gemfile`: `gem 'homura-runtime',
|
|
17
|
+
1. `Gemfile`: `gem 'homura-runtime', '~> 0.3'` and `gem 'opal-homura', '= 1.8.3.rc1.5', require: 'opal'` (in the homura monorepo dev workspace, `path: 'gems/homura-runtime'` is also supported).
|
|
18
18
|
2. `bundle exec homura build` — in generated standalone apps, writes `build/hello.no-exit.mjs` plus root-level `build/worker.entrypoint.mjs`; in the monorepo it writes `build/worker.entrypoint.mjs`.
|
|
19
19
|
3. `wrangler.toml`: generated apps use `main = "build/worker.entrypoint.mjs"` and `compatibility_flags = ["nodejs_compat"]`.
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ Core Ruby + Module Worker glue for [Opal](https://opalrb.com/) on [Cloudflare Wo
|
|
|
25
25
|
| Ruby | 3.4.x |
|
|
26
26
|
| Node | ≥ 20 |
|
|
27
27
|
| Wrangler | ^3.99 |
|
|
28
|
-
| Opal | = 1.8.3.rc1.
|
|
28
|
+
| Opal | = 1.8.3.rc1.5 |
|
|
29
29
|
|
|
30
30
|
## Wrangler config
|
|
31
31
|
|
data/exe/compile-assets
CHANGED
|
@@ -151,8 +151,8 @@ File.open(out_path, 'w') do |io|
|
|
|
151
151
|
|
|
152
152
|
io.puts <<~RUBY
|
|
153
153
|
|
|
154
|
-
# Auto-install the middleware on Sinatra::Base if Sinatra is loaded.
|
|
155
|
-
if defined?(::Sinatra::Base)
|
|
154
|
+
# Auto-install the middleware on Sinatra::Base if a real Sinatra app is loaded.
|
|
155
|
+
if defined?(::Sinatra::Base) && ::Sinatra::Base.respond_to?(:use)
|
|
156
156
|
::Sinatra::Base.use #{ns}::Middleware
|
|
157
157
|
end
|
|
158
158
|
RUBY
|
data/exe/compile-erb
CHANGED
|
@@ -515,11 +515,9 @@ template_root = positional.find { |a| File.directory?(a) } || options[:input_dir
|
|
|
515
515
|
write_file = !options[:stdout] && (positional.empty? || options[:output])
|
|
516
516
|
out_path = options[:output]
|
|
517
517
|
|
|
518
|
-
# An app with zero ERB templates
|
|
519
|
-
#
|
|
520
|
-
#
|
|
521
|
-
# at runtime instead of silently disappearing, and so the build
|
|
522
|
-
# pipeline doesn't fail when there is nothing to compile.
|
|
518
|
+
# An app with zero ERB templates is valid, including Rack-only apps
|
|
519
|
+
# that do not ship sinatra-homura at all. Emit the empty registry, but
|
|
520
|
+
# skip the Sinatra hook so `homura-runtime` remains Sinatra-free.
|
|
523
521
|
if inputs.empty?
|
|
524
522
|
warn "compile-erb: no .erb files under #{options[:input_dir]}/ — writing empty registry"
|
|
525
523
|
end
|
|
@@ -529,11 +527,11 @@ if write_file
|
|
|
529
527
|
File.open(out_path, 'w') do |io|
|
|
530
528
|
emit_header(io, namespace)
|
|
531
529
|
emit_templates(io, inputs, namespace, template_root)
|
|
532
|
-
emit_sinatra_patch(io, namespace)
|
|
530
|
+
emit_sinatra_patch(io, namespace) unless inputs.empty?
|
|
533
531
|
end
|
|
534
532
|
warn "compile-erb: wrote #{out_path} (#{inputs.size} templates)"
|
|
535
533
|
else
|
|
536
534
|
emit_header($stdout, namespace)
|
|
537
535
|
emit_templates($stdout, inputs, namespace, template_root)
|
|
538
|
-
emit_sinatra_patch($stdout, namespace)
|
|
536
|
+
emit_sinatra_patch($stdout, namespace) unless inputs.empty?
|
|
539
537
|
end
|
|
@@ -39,6 +39,23 @@ module HomuraRuntime
|
|
|
39
39
|
nil
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
def maybe_gem_lib(name, loaded_specs: Gem.loaded_specs)
|
|
43
|
+
spec = loaded_spec(name, loaded_specs: loaded_specs)
|
|
44
|
+
return nil unless spec
|
|
45
|
+
|
|
46
|
+
File.join(spec.full_gem_path, 'lib')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def maybe_gem_vendor(name, loaded_specs: Gem.loaded_specs)
|
|
50
|
+
spec = loaded_spec(name, loaded_specs: loaded_specs)
|
|
51
|
+
return nil unless spec
|
|
52
|
+
|
|
53
|
+
vendor = File.join(spec.full_gem_path, 'vendor')
|
|
54
|
+
return vendor if Dir.exist?(vendor)
|
|
55
|
+
|
|
56
|
+
nil
|
|
57
|
+
end
|
|
58
|
+
|
|
42
59
|
def runtime_file(*names, current_file: __FILE__, loaded_specs: Gem.loaded_specs)
|
|
43
60
|
runtime_root(current_file: current_file, loaded_specs: loaded_specs).join('runtime', *names)
|
|
44
61
|
end
|
|
@@ -71,8 +88,8 @@ module HomuraRuntime
|
|
|
71
88
|
[
|
|
72
89
|
gem_lib(RUNTIME_GEM_NAME, loaded_specs: loaded_specs),
|
|
73
90
|
gem_vendor(RUNTIME_GEM_NAME, loaded_specs: loaded_specs),
|
|
74
|
-
|
|
75
|
-
|
|
91
|
+
maybe_gem_lib(SINATRA_GEM_NAME, loaded_specs: loaded_specs),
|
|
92
|
+
maybe_gem_vendor(SINATRA_GEM_NAME, loaded_specs: loaded_specs)
|
|
76
93
|
].compact.each do |path|
|
|
77
94
|
load_paths << path
|
|
78
95
|
end
|