barefoot_js 0.30.6 → 0.31.0
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/lib/barefoot_js.rb +28 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16a94ca9d10a5a06547d4ab8b9202fdb39b4b9bccd16473b3b9a69835dbdd57e
|
|
4
|
+
data.tar.gz: fb79cead577937d0c7cd473824258a5be4058ec46b6bdf1a8711c8927064e964
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 862d285890c6570fd5ccf27157ac77d511d4194c6f52fcdf64a1c71c6aa3d90a410339af1d7920265a6cb1fe6030925969f18bb326e01fd90b01155544e45d69
|
|
7
|
+
data.tar.gz: 912b702fb84e5cef2f9535f79455bf30b9e6553252e98c65703bd0f617bfd85753c2a0786f33baeea02ee9d7e6adb1b08e3b256535d140cbacb2c955fe72a837
|
data/lib/barefoot_js.rb
CHANGED
|
@@ -68,6 +68,8 @@ module BarefootJS
|
|
|
68
68
|
bf_accessor :backend
|
|
69
69
|
bf_accessor :_scripts, default: -> { [] }
|
|
70
70
|
bf_accessor :_script_seen, default: -> { {} }
|
|
71
|
+
bf_accessor :_preloads, default: -> { [] }
|
|
72
|
+
bf_accessor :_preload_seen, default: -> { {} }
|
|
71
73
|
bf_accessor :_scope_id
|
|
72
74
|
bf_accessor :_is_child, default: -> { false }
|
|
73
75
|
bf_accessor :_bf_parent
|
|
@@ -217,8 +219,28 @@ module BarefootJS
|
|
|
217
219
|
_scripts.push(path)
|
|
218
220
|
end
|
|
219
221
|
|
|
222
|
+
# Register a `<link rel="modulepreload">` hint (mirrors `register_script`
|
|
223
|
+
# exactly: same dedup-by-path set, same insertion-order array, same
|
|
224
|
+
# lifetime/reset semantics, same no-output-string return so the compiled
|
|
225
|
+
# ERB template's `<% bf.register_preload(...) %>` produces no bytes
|
|
226
|
+
# where it sits). The `<link>` itself is only ever emitted by `scripts`
|
|
227
|
+
# below, never here -- a preload registration must never inject a node
|
|
228
|
+
# into a component's own template output (see the previous attempt's
|
|
229
|
+
# regression this guards against).
|
|
230
|
+
def register_preload(path)
|
|
231
|
+
return if _preload_seen.key?(path)
|
|
232
|
+
|
|
233
|
+
_preload_seen[path] = true
|
|
234
|
+
_preloads.push(path)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Emits preload hints BEFORE script tags -- a hint that arrives after
|
|
238
|
+
# the script it describes is useless. Same escaping (none; paths are
|
|
239
|
+
# caller-trusted resolved URLs) as the script tags below.
|
|
220
240
|
def scripts
|
|
221
|
-
|
|
241
|
+
preload_tags = _preloads.map { |path| %(<link rel="modulepreload" crossorigin href="#{path}">) }
|
|
242
|
+
script_tags = _scripts.map { |path| %(<script type="module" src="#{path}"></script>) }
|
|
243
|
+
(preload_tags + script_tags).join("\n")
|
|
222
244
|
end
|
|
223
245
|
|
|
224
246
|
# -----------------------------------------------------------------
|
|
@@ -255,8 +277,9 @@ module BarefootJS
|
|
|
255
277
|
# Bulk registration from build manifest
|
|
256
278
|
# -----------------------------------------------------------------
|
|
257
279
|
#
|
|
258
|
-
# `
|
|
259
|
-
#
|
|
280
|
+
# `vite build` (via `@barefootjs/erb/vite`'s `barefoot()` plugin) emits
|
|
281
|
+
# dist/templates/manifest.json describing every component the page
|
|
282
|
+
# might invoke. This walks that manifest and
|
|
260
283
|
# registers one child renderer per UI registry entry (`ui/<name>/index`
|
|
261
284
|
# -> slot key `<name>`), seeding each child's template vars from the
|
|
262
285
|
# manifest's statically-derived `ssrDefaults` (prop destructure
|
|
@@ -300,6 +323,8 @@ module BarefootJS
|
|
|
300
323
|
child_bf._child_renderers(parent._child_renderers)
|
|
301
324
|
child_bf._scripts(parent._scripts)
|
|
302
325
|
child_bf._script_seen(parent._script_seen)
|
|
326
|
+
child_bf._preloads(parent._preloads)
|
|
327
|
+
child_bf._preload_seen(parent._preload_seen)
|
|
303
328
|
|
|
304
329
|
extra =
|
|
305
330
|
if sig_init
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: barefoot_js
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.31.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kobaken
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tzinfo
|