homura-runtime 0.2.26 → 0.2.27

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: 961609130fd819224d263b877755bd615b98c27ec2677bb3842aaeeed13a131b
4
- data.tar.gz: 4412446fe4defcfb5e65cbafc19f53c2bbdb7461a5e835a2a7fa7a09bf6da38e
3
+ metadata.gz: 17f9647265dd18252adf1bcfc4f73951db2b8c3300bf8e8fceb2e4a28d18ddd0
4
+ data.tar.gz: 0af103cb85483f3d2ecc3164579c0d8b784c2c0ece8cc8d584dd50735796cbb2
5
5
  SHA512:
6
- metadata.gz: 36b7a90afec547e760a751bf2dcfe1a3ef5a9718d64f31d00d740f9715291a5ce869c9845d3fe7d8b5aa6f99f9787254d77d4197a20fc0095106dcc6bc6959a1
7
- data.tar.gz: fa08804d6bfcc39032f75889de9066105c46ceccecb7c91a9b2126bffe8db05af8ccf3dfaf02d6da9795cae82dbc987a55a61e86cf676a1aff8a06a3de342ef8
6
+ metadata.gz: 911fee8fad91bdf26588b4f926c2edcae0d6f523dd43dfc571c8767a53acfc9b03214041e8f840d248072e16888cf3841dcb6ab67ae1d10d10b7d6f31772219d
7
+ data.tar.gz: 6c39b38063e532c3206ab0ebe027c234654908161d7e25934f618e26ebcd3efacd4b15a5baf2642e9f7d11cfec50d2e9ad40979c9b5ea0a89511d88547cb341e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.27 (2026-04-29)
4
+
5
+ - `Rack::Handler::CloudflareWorkers.run` now goes through
6
+ `ensure_dispatcher_installed!` instead of duplicating the JS
7
+ install snippet. Single source of truth for the dispatcher
8
+ installation; `@dispatcher_installed` correctly tracks the state
9
+ even when `run` is the first caller. Functionally identical from
10
+ the user's point of view (dispatcher ends up in `globalThis`
11
+ either way) — Copilot review on PR #34 spotted the duplication.
12
+
3
13
  ## 0.2.26 (2026-04-29)
4
14
 
5
15
  - `Rack::Handler::CloudflareWorkers#call`: when `@app` is nil, fall
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudflareWorkers
4
- VERSION = '0.2.26'
4
+ VERSION = '0.2.27'
5
5
  end
@@ -126,7 +126,7 @@ module Rack
126
126
 
127
127
  def self.run(app, **_options)
128
128
  @app = app
129
- install_dispatcher
129
+ ensure_dispatcher_installed!
130
130
  app
131
131
  end
132
132
 
@@ -190,18 +190,13 @@ module Rack
190
190
  class << self
191
191
  private
192
192
 
193
+ # Legacy alias, kept so out-of-tree code calling
194
+ # `Rack::Handler::CloudflareWorkers.send(:install_dispatcher)`
195
+ # keeps working. New code should go through
196
+ # `ensure_dispatcher_installed!` (it's idempotent and tracks
197
+ # state via `@dispatcher_installed`).
193
198
  def install_dispatcher
194
- handler = self
195
- `
196
- globalThis.__HOMURA_RACK_DISPATCH__ = async function(req, env, ctx, body_text) {
197
- return await #{handler}.$call(req, env, ctx, body_text == null ? "" : body_text);
198
- };
199
- (function () {
200
- var g = globalThis;
201
- g.__OPAL_WORKERS__ = g.__OPAL_WORKERS__ || {};
202
- g.__OPAL_WORKERS__.rack = g.__HOMURA_RACK_DISPATCH__;
203
- })();
204
- `
199
+ ensure_dispatcher_installed!
205
200
  end
206
201
 
207
202
  # Build a Rack-compliant env Hash from a Cloudflare Workers Request.
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.26
4
+ version: 0.2.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuhiro Homma