homura-runtime 0.2.21 → 0.2.23
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/exe/homura-build +32 -11
- data/lib/cloudflare_workers/build_support.rb +7 -1
- data/lib/cloudflare_workers/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: b404ba5cef20ed67d0b7f882c21a4f22b49bb0594e3175cec2137498764bafe9
|
|
4
|
+
data.tar.gz: 99dd3e6a2849a57d146c8d8f46b7cd01f805dc1712b858445c06bf5761dcb18a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97e9d3a324ffe6545b080ce483c1b4446ed14937d3cc70dcf6852e793002d9a246fc9a9ef557b687a42f9cf5903bb85ee2faf6a80fef42f0ca22d7661d9a7074
|
|
7
|
+
data.tar.gz: 7b930885e9bad1526363d9b9f5c2940ba71a8f9f65f073352d17c4e679b8039a9f25e3d44653df723ef9204fd90ad17c9db7e15789ec0050d747f8892ca05b17
|
data/exe/homura-build
CHANGED
|
@@ -77,10 +77,13 @@ options[:assets_namespace] ||= CloudflareWorkers::BuildSupport.standalone_namesp
|
|
|
77
77
|
|
|
78
78
|
if options[:standalone]
|
|
79
79
|
Dir.chdir(root) { require 'bundler/setup' }
|
|
80
|
-
|
|
80
|
+
# Both .mjs glue files and the entrypoint live under `build/` from
|
|
81
|
+
# 0.2.23 on. write_entrypoint! resolves these as project-root
|
|
82
|
+
# relative paths and computes the entrypoint-relative import spec.
|
|
83
|
+
options[:setup_import] ||= 'build/cf-runtime/setup-node-crypto.mjs'
|
|
81
84
|
options[:bundle_import] ||= options[:opal_output]
|
|
82
|
-
options[:worker_module_import] ||= 'cf-runtime/worker_module.mjs'
|
|
83
|
-
options[:entrypoint_out] ||= 'worker.entrypoint.mjs'
|
|
85
|
+
options[:worker_module_import] ||= 'build/cf-runtime/worker_module.mjs'
|
|
86
|
+
options[:entrypoint_out] ||= 'build/worker.entrypoint.mjs'
|
|
84
87
|
else
|
|
85
88
|
options[:setup_import] ||= 'gems/homura-runtime/runtime/setup-node-crypto.mjs'
|
|
86
89
|
options[:bundle_import] ||= options[:opal_output]
|
|
@@ -245,14 +248,32 @@ else
|
|
|
245
248
|
],
|
|
246
249
|
chdir: root
|
|
247
250
|
)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
251
|
+
# auto-await pass: project layouts that don't have an `app/`
|
|
252
|
+
# directory (e.g. a single-file classic Sinatra example with a
|
|
253
|
+
# top-level `app.rb`) are still valid — feed the lone file to
|
|
254
|
+
# auto-await so its `db.execute` / `kv.get` / etc. still get
|
|
255
|
+
# `__await__` inserted.
|
|
256
|
+
if root.join('app').directory?
|
|
257
|
+
run!(
|
|
258
|
+
[
|
|
259
|
+
'ruby', CloudflareWorkersBuild.exe_path('auto-await').to_s,
|
|
260
|
+
'--input', 'app',
|
|
261
|
+
'--output', 'build/auto_await/app'
|
|
262
|
+
],
|
|
263
|
+
chdir: root
|
|
264
|
+
)
|
|
265
|
+
elsif root.join('app.rb').file?
|
|
266
|
+
run!(
|
|
267
|
+
[
|
|
268
|
+
'ruby', CloudflareWorkersBuild.exe_path('auto-await').to_s,
|
|
269
|
+
'--input', 'app.rb',
|
|
270
|
+
'--output', 'build/auto_await/app.rb'
|
|
271
|
+
],
|
|
272
|
+
chdir: root
|
|
273
|
+
)
|
|
274
|
+
else
|
|
275
|
+
warn 'homura build: no app/ directory or top-level app.rb — skipping auto-await'
|
|
276
|
+
end
|
|
256
277
|
|
|
257
278
|
opal_in = Pathname(resolve_opal_input(root, options[:opal_input]))
|
|
258
279
|
opal_out = Pathname(options[:opal_output])
|
|
@@ -44,7 +44,13 @@ module CloudflareWorkers
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def ensure_standalone_runtime(project_root, current_file: __FILE__, loaded_specs: Gem.loaded_specs)
|
|
47
|
-
|
|
47
|
+
# The homura runtime needs two .mjs glue files alongside the
|
|
48
|
+
# generated `worker.entrypoint.mjs`. Until 0.2.22 we wrote them
|
|
49
|
+
# to `cf-runtime/` at the project root, which made every Ruby
|
|
50
|
+
# repo carry two opaque JS files in source control. Hide them
|
|
51
|
+
# under `build/cf-runtime/` so the build artifact tree owns
|
|
52
|
+
# them — `build/` is already in the example .gitignore template.
|
|
53
|
+
target_dir = Pathname(project_root).join('build', 'cf-runtime')
|
|
48
54
|
FileUtils.mkdir_p(target_dir)
|
|
49
55
|
|
|
50
56
|
%w[setup-node-crypto.mjs worker_module.mjs].each do |name|
|