@barefootjs/erb 0.34.0 → 0.35.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.
- package/dist/adapter/erb-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +1 -1
- package/dist/index.js +2 -4
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +10 -2
- package/lib/barefoot_js.rb +16 -0
- package/package.json +5 -5
- package/src/adapter/erb-adapter.ts +4 -3
- package/src/render-divergences.ts +1 -4
- package/src/test-render.ts +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erb-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/erb-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAMP,yBAAyB,EAC1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EAgChB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,UAAU,EAAuD,MAAM,iBAAiB,CAAA;AAGtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAgClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAoBvD,qBAAa,UAAW,SAAQ,WAAY,YAAW,aAAa,CAAC,YAAY,CAAC;IAChF,IAAI,SAAQ;IACZ,SAAS,SAAS;IAClB,qBAAqB,UAAO;IAE5B;;;;;;OAMG;IACH,kBAAkB,EAAE,yB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AAC,kBAAkB,CAyKlC;IAED;;;OAGG;IACH,OAAO,CAAC,kBAAkB,CAAI;IAE9B;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IA0B3B,8EAA8E;IAC9E,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,gBAAgB;IAqCxB,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAMjD;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAMD;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IA8B5B,OAAO,CAAC,iCAAiC;IAkCzC;;;;;;;OAOG;IACH,OAAO,CAAC,gCAAgC;IAmBxC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GAYlB;IAED;;;;OAIG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,uBAAuB;IAyD/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAI9B;uEACmE;IACnE,OAAO,CAAC,kBAAkB;IAI1B;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAexB,iFAAiF;IACjF,OAAO,CAAC,2BAA2B;CAGpC;AAED,eAAO,MAAM,UAAU,YAAmB,CAAA"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -188788,7 +188788,7 @@ ${whenTrue}
|
|
|
188788
188788
|
const prevScope = this.scope;
|
|
188789
188789
|
this.scope = prevScope.enterLoopRow(loop);
|
|
188790
188790
|
const renderedChildren = this.renderChildren(loop.children);
|
|
188791
|
-
const children = loop.bodyIsItemConditional && loop.key ? `<%= bf.comment("loop-i:" + bf.
|
|
188791
|
+
const children = loop.bodyIsItemConditional && loop.key ? `<%= bf.comment("loop-i:" + bf.escape_comment_key(${this.convertExpressionToRuby(loop.key)})) %>
|
|
188792
188792
|
${renderedChildren}` : renderedChildren;
|
|
188793
188793
|
const lines = [];
|
|
188794
188794
|
lines.push(`<%= bf.comment("loop:${loop.markerId}") %>`);
|
package/dist/index.js
CHANGED
|
@@ -188788,7 +188788,7 @@ ${whenTrue}
|
|
|
188788
188788
|
const prevScope = this.scope;
|
|
188789
188789
|
this.scope = prevScope.enterLoopRow(loop);
|
|
188790
188790
|
const renderedChildren = this.renderChildren(loop.children);
|
|
188791
|
-
const children = loop.bodyIsItemConditional && loop.key ? `<%= bf.comment("loop-i:" + bf.
|
|
188791
|
+
const children = loop.bodyIsItemConditional && loop.key ? `<%= bf.comment("loop-i:" + bf.escape_comment_key(${this.convertExpressionToRuby(loop.key)})) %>
|
|
188792
188792
|
${renderedChildren}` : renderedChildren;
|
|
188793
188793
|
const lines = [];
|
|
188794
188794
|
lines.push(`<%= bf.comment("loop:${loop.markerId}") %>`);
|
|
@@ -189262,9 +189262,7 @@ var conformancePins = {
|
|
|
189262
189262
|
"namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
|
|
189263
189263
|
};
|
|
189264
189264
|
// src/render-divergences.ts
|
|
189265
|
-
var renderDivergences = {
|
|
189266
|
-
"aliased-loop-source": "A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) throws `undefined method 'length' for nil (NoMethodError)` on real Ruby ERB — the seeded loop data is keyed by the signal's real name (`items`), and the alias hop is never resolved when deciding what to seed under `items__alias`. This is the SSR-side twin of #2778 (fixed for the CSR client-JS template in the same PR that added this fixture) — that fix only touches client-JS emission, not SSR data-seeding. Tracked at https://github.com/piconic-ai/barefootjs/issues/2813; graduate by resolving the alias hop at SSR-seeding time using the same `resolveAliasOrigin`/`resolveGetterAliases` mechanism #2778 introduced, rather than a third alias-hop walker."
|
|
189267
|
-
};
|
|
189265
|
+
var renderDivergences = {};
|
|
189268
189266
|
export {
|
|
189269
189267
|
renderDivergences,
|
|
189270
189268
|
erbAdapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,iBAAsB,CAAA"}
|
package/dist/vite.js
CHANGED
|
@@ -2274,6 +2274,12 @@ class BindingScope {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
2276
|
|
|
2277
|
+
// ../jsx/src/ir-to-client-js/safe-html.ts
|
|
2278
|
+
function safeHtml(expr) {
|
|
2279
|
+
return expr;
|
|
2280
|
+
}
|
|
2281
|
+
var EMPTY_MARKUP = safeHtml("''");
|
|
2282
|
+
|
|
2277
2283
|
// ../jsx/src/ir-to-client-js/html-template.ts
|
|
2278
2284
|
var VOID_ELEMENTS = new Set([
|
|
2279
2285
|
"area",
|
|
@@ -2560,6 +2566,7 @@ var CLIENT_EXPORTS = new Set([
|
|
|
2560
2566
|
"isSSRPortal",
|
|
2561
2567
|
"findSiblingSlot",
|
|
2562
2568
|
"cleanupPortalPlaceholder",
|
|
2569
|
+
"trackPosition",
|
|
2563
2570
|
"createSearchParams",
|
|
2564
2571
|
"queryHref",
|
|
2565
2572
|
"formatDate",
|
|
@@ -2620,7 +2627,8 @@ var BROWSER_ONLY_CLIENT_APIS = new Set([
|
|
|
2620
2627
|
"createPortal",
|
|
2621
2628
|
"isSSRPortal",
|
|
2622
2629
|
"findSiblingSlot",
|
|
2623
|
-
"cleanupPortalPlaceholder"
|
|
2630
|
+
"cleanupPortalPlaceholder",
|
|
2631
|
+
"trackPosition"
|
|
2624
2632
|
]);
|
|
2625
2633
|
var REACTIVE_PRIMITIVES = new Set([
|
|
2626
2634
|
"createSignal",
|
|
@@ -6662,7 +6670,7 @@ ${whenTrue}
|
|
|
6662
6670
|
const prevScope = this.scope;
|
|
6663
6671
|
this.scope = prevScope.enterLoopRow(loop);
|
|
6664
6672
|
const renderedChildren = this.renderChildren(loop.children);
|
|
6665
|
-
const children = loop.bodyIsItemConditional && loop.key ? `<%= bf.comment("loop-i:" + bf.
|
|
6673
|
+
const children = loop.bodyIsItemConditional && loop.key ? `<%= bf.comment("loop-i:" + bf.escape_comment_key(${this.convertExpressionToRuby(loop.key)})) %>
|
|
6666
6674
|
${renderedChildren}` : renderedChildren;
|
|
6667
6675
|
const lines = [];
|
|
6668
6676
|
lines.push(`<%= bf.comment("loop:${loop.markerId}") %>`);
|
package/lib/barefoot_js.rb
CHANGED
|
@@ -184,6 +184,22 @@ module BarefootJS
|
|
|
184
184
|
"<!--bf-#{text}-->"
|
|
185
185
|
end
|
|
186
186
|
|
|
187
|
+
# Neutralize a value for splicing into `comment`'s HTML comment content
|
|
188
|
+
# (#2795 follow-up). `comment` itself does no escaping -- fine for every
|
|
189
|
+
# other caller (marker IDs like "cond-start:s0", "loop:l0", ...), which
|
|
190
|
+
# are entirely compiler-generated, but the whole-item-conditional loop's
|
|
191
|
+
# "loop-i:<key>" anchor carries a user-controlled key. Standard HTML
|
|
192
|
+
# escaping doesn't help inside a comment -- only the literal sequence
|
|
193
|
+
# "-->" terminates it early, and &/</>/"/' are not special there. The
|
|
194
|
+
# key's exact text doesn't need to round-trip (the client's
|
|
195
|
+
# mapArrayAnchored matches items positionally and by its own
|
|
196
|
+
# JS-computed key, never by re-parsing the anchor Comment.nodeValue), so
|
|
197
|
+
# replacing every "-" with the visually-similar U+2010 is sufficient and
|
|
198
|
+
# needs no decoding.
|
|
199
|
+
def escape_comment_key(value)
|
|
200
|
+
string(value).gsub('-', '‐')
|
|
201
|
+
end
|
|
202
|
+
|
|
187
203
|
# Map a JS-boolean-shaped value to the JS `String(bool)` form. See
|
|
188
204
|
# BarefootJS.pm's `bool_str` docstring for the boolean-only contract --
|
|
189
205
|
# callers must have already classified the expression as boolean-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/erb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "ERB (Embedded Ruby) adapter for BarefootJS — compiles IR to .erb templates and ships the Ruby rendering backend; runs under any Rack app (Sinatra, Rails)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"directory": "packages/adapter-erb"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@barefootjs/shared": "0.
|
|
57
|
+
"@barefootjs/shared": "0.35.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@barefootjs/jsx": ">=0.2.0",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
74
|
-
"@barefootjs/jsx": "0.
|
|
75
|
-
"@barefootjs/vite": "0.
|
|
76
|
-
"@barefootjs/client": "0.
|
|
74
|
+
"@barefootjs/jsx": "0.35.0",
|
|
75
|
+
"@barefootjs/vite": "0.35.0",
|
|
76
|
+
"@barefootjs/client": "0.35.0",
|
|
77
77
|
"typescript": "^5.0.0",
|
|
78
78
|
"vite": "^6.0.0"
|
|
79
79
|
}
|
|
@@ -1037,11 +1037,12 @@ export class ErbAdapter extends BaseAdapter implements IRNodeEmitter<ErbRenderCt
|
|
|
1037
1037
|
// `<!--bf-loop-i:KEY-->` anchor before each item's (possibly empty)
|
|
1038
1038
|
// conditional content so the client's `mapArrayAnchored` can hydrate
|
|
1039
1039
|
// every SSR-rendered item by its anchor. `bf.comment` prepends `bf-`,
|
|
1040
|
-
// so `"loop-i:" + KEY` yields `<!--bf-loop-i:KEY-->`. `bf.
|
|
1041
|
-
//
|
|
1040
|
+
// so `"loop-i:" + KEY` yields `<!--bf-loop-i:KEY-->`. `bf.escape_comment_key`
|
|
1041
|
+
// (#2795 follow-up) both stringifies KEY and neutralizes `-` so it can't
|
|
1042
|
+
// spell `-->` and close the comment early — see its doc in `barefoot_js.rb`.
|
|
1042
1043
|
const children =
|
|
1043
1044
|
loop.bodyIsItemConditional && loop.key
|
|
1044
|
-
? `<%= bf.comment("loop-i:" + bf.
|
|
1045
|
+
? `<%= bf.comment("loop-i:" + bf.escape_comment_key(${this.convertExpressionToRuby(loop.key)})) %>\n${renderedChildren}`
|
|
1045
1046
|
: renderedChildren
|
|
1046
1047
|
|
|
1047
1048
|
const lines: string[] = []
|
|
@@ -15,7 +15,4 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
15
15
|
// at value position and the runtime evaluator's `object-literal` case
|
|
16
16
|
// now merges it, so the seed classifies `derived` and SSRs identically
|
|
17
17
|
// to Hono.
|
|
18
|
-
export const renderDivergences: RenderDivergences = {
|
|
19
|
-
'aliased-loop-source':
|
|
20
|
-
'A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) throws `undefined method \'length\' for nil (NoMethodError)` on real Ruby ERB — the seeded loop data is keyed by the signal\'s real name (`items`), and the alias hop is never resolved when deciding what to seed under `items__alias`. This is the SSR-side twin of #2778 (fixed for the CSR client-JS template in the same PR that added this fixture) — that fix only touches client-JS emission, not SSR data-seeding. Tracked at https://github.com/piconic-ai/barefootjs/issues/2813; graduate by resolving the alias hop at SSR-seeding time using the same `resolveAliasOrigin`/`resolveGetterAliases` mechanism #2778 introduced, rather than a third alias-hop walker.',
|
|
21
|
-
}
|
|
18
|
+
export const renderDivergences: RenderDivergences = {}
|
package/src/test-render.ts
CHANGED
|
@@ -618,6 +618,20 @@ function buildRubyProps(
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
// #2813: `extractSsrDefaults` can seed an entry under a name that is
|
|
622
|
+
// none of `propsParams` / `signals` / `memos` above — a bare local-const
|
|
623
|
+
// alias of a signal/memo getter (`const items__alias = items`,
|
|
624
|
+
// `ssr-defaults.ts`) seeds `items__alias` alongside `items`. Production
|
|
625
|
+
// hands the whole manifest-derived stash straight through
|
|
626
|
+
// (`deriveStashFromDefaults` IS the production seeding mechanism here,
|
|
627
|
+
// not a harness stand-in), so any leftover `derivedProps` key must be
|
|
628
|
+
// copied into `obj` too, or this harness would silently omit what
|
|
629
|
+
// production actually provides, mismeasuring this conformance case.
|
|
630
|
+
for (const [name, value] of Object.entries(derivedProps)) {
|
|
631
|
+
if (Object.prototype.hasOwnProperty.call(obj, name)) continue
|
|
632
|
+
obj[name] = value
|
|
633
|
+
}
|
|
634
|
+
|
|
621
635
|
const needsSearchParams = importsSearchParams(ir.metadata)
|
|
622
636
|
|
|
623
637
|
return { obj, needsSearchParams, userProps }
|