@barefootjs/rust 0.34.0 → 0.35.1
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/index.js +1 -1
- package/dist/adapter/minijinja-adapter.d.ts.map +1 -1
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +38 -30
- package/package.json +5 -5
- package/runtime/src/runtime.rs +14 -0
- package/src/__tests__/minijinja-adapter-unit.test.ts +2 -2
- package/src/adapter/minijinja-adapter.ts +4 -1
- package/src/conformance-pins.ts +13 -7
- package/src/render-divergences.ts +1 -4
- package/src/test-render.ts +14 -0
package/dist/adapter/index.js
CHANGED
|
@@ -188692,7 +188692,7 @@ ${whenTrue}
|
|
|
188692
188692
|
const preambleLines = (loop.preamble?.declarations ?? []).map((d) => `{% set ${minijinjaIdent(d.name)} = ${this.convertExpressionToJinja(d.raw, d.valueParsed)} %}`);
|
|
188693
188693
|
const childrenUnderLoop = this.renderChildren(loop.children);
|
|
188694
188694
|
this.inLoop = prevInLoop;
|
|
188695
|
-
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.
|
|
188695
|
+
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.escape_comment_key(${this.convertExpressionToJinja(loop.key)})) | safe }}
|
|
188696
188696
|
${childrenUnderLoop}` : childrenUnderLoop;
|
|
188697
188697
|
this.scope = prevScope;
|
|
188698
188698
|
const lines = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minijinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/minijinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAwE7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -188692,7 +188692,7 @@ ${whenTrue}
|
|
|
188692
188692
|
const preambleLines = (loop.preamble?.declarations ?? []).map((d) => `{% set ${minijinjaIdent(d.name)} = ${this.convertExpressionToJinja(d.raw, d.valueParsed)} %}`);
|
|
188693
188693
|
const childrenUnderLoop = this.renderChildren(loop.children);
|
|
188694
188694
|
this.inLoop = prevInLoop;
|
|
188695
|
-
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.
|
|
188695
|
+
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.escape_comment_key(${this.convertExpressionToJinja(loop.key)})) | safe }}
|
|
188696
188696
|
${childrenUnderLoop}` : childrenUnderLoop;
|
|
188697
188697
|
this.scope = prevScope;
|
|
188698
188698
|
const lines = [];
|
|
@@ -189239,14 +189239,12 @@ var conformancePins = {
|
|
|
189239
189239
|
"filter-nested-find-predicate": [{ code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2320" }],
|
|
189240
189240
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
189241
189241
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
189242
|
-
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error"
|
|
189243
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error"
|
|
189244
|
-
"namespace-import-primitive": [{ code: "BF013", severity: "error"
|
|
189242
|
+
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error" }],
|
|
189243
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error" }],
|
|
189244
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error" }]
|
|
189245
189245
|
};
|
|
189246
189246
|
// src/render-divergences.ts
|
|
189247
|
-
var renderDivergences = {
|
|
189248
|
-
"aliased-loop-source": "A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) SSRs an empty `<ul>` through real minijinja — 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."
|
|
189249
|
-
};
|
|
189247
|
+
var renderDivergences = {};
|
|
189250
189248
|
export {
|
|
189251
189249
|
renderDivergences,
|
|
189252
189250
|
minijinjaAdapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,iBAAsB,CAAA"}
|
package/dist/vite.js
CHANGED
|
@@ -8,7 +8,7 @@ import { devModuleUrl, loadManifest, resolveDevOrigin, resolveScriptAssets, toPo
|
|
|
8
8
|
import ts25 from "typescript";
|
|
9
9
|
|
|
10
10
|
// ../jsx/src/analyzer.ts
|
|
11
|
-
import
|
|
11
|
+
import ts11 from "typescript";
|
|
12
12
|
|
|
13
13
|
// ../jsx/src/expression-parser.ts
|
|
14
14
|
import ts from "typescript";
|
|
@@ -2326,6 +2326,12 @@ class BindingScope {
|
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
2328
|
|
|
2329
|
+
// ../jsx/src/ir-to-client-js/safe-html.ts
|
|
2330
|
+
function safeHtml(expr) {
|
|
2331
|
+
return expr;
|
|
2332
|
+
}
|
|
2333
|
+
var EMPTY_MARKUP = safeHtml("''");
|
|
2334
|
+
|
|
2329
2335
|
// ../jsx/src/ir-to-client-js/html-template.ts
|
|
2330
2336
|
var VOID_ELEMENTS = new Set([
|
|
2331
2337
|
"area",
|
|
@@ -2383,14 +2389,17 @@ function freshCounters() {
|
|
|
2383
2389
|
}
|
|
2384
2390
|
|
|
2385
2391
|
// ../jsx/src/analyzer-context.ts
|
|
2386
|
-
import
|
|
2392
|
+
import ts10 from "typescript";
|
|
2387
2393
|
|
|
2388
2394
|
// ../jsx/src/strip-types.ts
|
|
2389
2395
|
import ts8 from "typescript";
|
|
2390
2396
|
|
|
2397
|
+
// ../jsx/src/reactivity-checker.ts
|
|
2398
|
+
import ts9 from "typescript";
|
|
2399
|
+
|
|
2391
2400
|
// ../jsx/src/analyzer-context.ts
|
|
2392
|
-
var _typePrinter =
|
|
2393
|
-
var _blankTypeSourceFile =
|
|
2401
|
+
var _typePrinter = ts10.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
2402
|
+
var _blankTypeSourceFile = ts10.createSourceFile("__bf_types__.ts", "", ts10.ScriptTarget.Latest);
|
|
2394
2403
|
|
|
2395
2404
|
// ../jsx/src/errors.ts
|
|
2396
2405
|
var ErrorCodes = {
|
|
@@ -2612,6 +2621,7 @@ var CLIENT_EXPORTS = new Set([
|
|
|
2612
2621
|
"isSSRPortal",
|
|
2613
2622
|
"findSiblingSlot",
|
|
2614
2623
|
"cleanupPortalPlaceholder",
|
|
2624
|
+
"trackPosition",
|
|
2615
2625
|
"createSearchParams",
|
|
2616
2626
|
"queryHref",
|
|
2617
2627
|
"formatDate",
|
|
@@ -2622,46 +2632,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
2622
2632
|
const ids = new Set;
|
|
2623
2633
|
const boundNames = new Set;
|
|
2624
2634
|
function addBindingNames(name, out) {
|
|
2625
|
-
if (
|
|
2635
|
+
if (ts11.isIdentifier(name))
|
|
2626
2636
|
out.push(name.text);
|
|
2627
|
-
else if (
|
|
2637
|
+
else if (ts11.isObjectBindingPattern(name))
|
|
2628
2638
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
2629
|
-
else if (
|
|
2639
|
+
else if (ts11.isArrayBindingPattern(name))
|
|
2630
2640
|
name.elements.forEach((e) => {
|
|
2631
|
-
if (!
|
|
2641
|
+
if (!ts11.isOmittedExpression(e))
|
|
2632
2642
|
addBindingNames(e.name, out);
|
|
2633
2643
|
});
|
|
2634
2644
|
}
|
|
2635
2645
|
function visit(n) {
|
|
2636
|
-
if (
|
|
2646
|
+
if (ts11.isTypeNode(n))
|
|
2637
2647
|
return;
|
|
2638
|
-
if (
|
|
2648
|
+
if (ts11.isIdentifier(n)) {
|
|
2639
2649
|
const parent = n.parent;
|
|
2640
|
-
if (parent &&
|
|
2650
|
+
if (parent && ts11.isPropertyAccessExpression(parent) && parent.name === n)
|
|
2641
2651
|
return;
|
|
2642
|
-
if (parent &&
|
|
2652
|
+
if (parent && ts11.isPropertyAssignment(parent) && parent.name === n)
|
|
2643
2653
|
return;
|
|
2644
|
-
if (parent &&
|
|
2654
|
+
if (parent && ts11.isParameter(parent) && parent.name === n)
|
|
2645
2655
|
return;
|
|
2646
|
-
if (parent &&
|
|
2656
|
+
if (parent && ts11.isVariableDeclaration(parent) && parent.name === n)
|
|
2647
2657
|
return;
|
|
2648
2658
|
if (boundNames.has(n.text))
|
|
2649
2659
|
return;
|
|
2650
2660
|
ids.add(n.text);
|
|
2651
2661
|
return;
|
|
2652
2662
|
}
|
|
2653
|
-
if (
|
|
2663
|
+
if (ts11.isArrowFunction(n)) {
|
|
2654
2664
|
const params = [];
|
|
2655
2665
|
for (const p of n.parameters)
|
|
2656
2666
|
addBindingNames(p.name, params);
|
|
2657
2667
|
for (const name of params)
|
|
2658
2668
|
boundNames.add(name);
|
|
2659
|
-
|
|
2669
|
+
ts11.forEachChild(n, visit);
|
|
2660
2670
|
for (const name of params)
|
|
2661
2671
|
boundNames.delete(name);
|
|
2662
2672
|
return;
|
|
2663
2673
|
}
|
|
2664
|
-
|
|
2674
|
+
ts11.forEachChild(n, visit);
|
|
2665
2675
|
}
|
|
2666
2676
|
visit(node);
|
|
2667
2677
|
return ids;
|
|
@@ -2672,7 +2682,8 @@ var BROWSER_ONLY_CLIENT_APIS = new Set([
|
|
|
2672
2682
|
"createPortal",
|
|
2673
2683
|
"isSSRPortal",
|
|
2674
2684
|
"findSiblingSlot",
|
|
2675
|
-
"cleanupPortalPlaceholder"
|
|
2685
|
+
"cleanupPortalPlaceholder",
|
|
2686
|
+
"trackPosition"
|
|
2676
2687
|
]);
|
|
2677
2688
|
var REACTIVE_PRIMITIVES = new Set([
|
|
2678
2689
|
"createSignal",
|
|
@@ -2734,7 +2745,7 @@ function preambleAnalysisTemplateText(p) {
|
|
|
2734
2745
|
}
|
|
2735
2746
|
|
|
2736
2747
|
// ../jsx/src/module-exports.ts
|
|
2737
|
-
import
|
|
2748
|
+
import ts12 from "typescript";
|
|
2738
2749
|
function formatParamWithType(p) {
|
|
2739
2750
|
const rest = p.isRest ? "..." : "";
|
|
2740
2751
|
const optional = p.optional ? "?" : "";
|
|
@@ -2769,21 +2780,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
2769
2780
|
const assigned = new Set;
|
|
2770
2781
|
if (candidates.size === 0)
|
|
2771
2782
|
return assigned;
|
|
2772
|
-
const sf =
|
|
2783
|
+
const sf = ts12.createSourceFile("bf-assignment-scan.tsx", bodyText, ts12.ScriptTarget.Latest, false, ts12.ScriptKind.TSX);
|
|
2773
2784
|
const record = (target) => {
|
|
2774
|
-
if (
|
|
2785
|
+
if (ts12.isIdentifier(target) && candidates.has(target.text)) {
|
|
2775
2786
|
assigned.add(target.text);
|
|
2776
2787
|
}
|
|
2777
2788
|
};
|
|
2778
2789
|
const visit = (node) => {
|
|
2779
|
-
if (
|
|
2790
|
+
if (ts12.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
2780
2791
|
record(node.left);
|
|
2781
|
-
} else if ((
|
|
2792
|
+
} else if ((ts12.isPrefixUnaryExpression(node) || ts12.isPostfixUnaryExpression(node)) && (node.operator === ts12.SyntaxKind.PlusPlusToken || node.operator === ts12.SyntaxKind.MinusMinusToken)) {
|
|
2782
2793
|
record(node.operand);
|
|
2783
2794
|
}
|
|
2784
|
-
|
|
2795
|
+
ts12.forEachChild(node, visit);
|
|
2785
2796
|
};
|
|
2786
|
-
|
|
2797
|
+
ts12.forEachChild(sf, visit);
|
|
2787
2798
|
return assigned;
|
|
2788
2799
|
}
|
|
2789
2800
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -2806,12 +2817,9 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
2806
2817
|
return reachable;
|
|
2807
2818
|
}
|
|
2808
2819
|
function isAssignmentOperator(kind) {
|
|
2809
|
-
return kind >=
|
|
2820
|
+
return kind >= ts12.SyntaxKind.FirstAssignment && kind <= ts12.SyntaxKind.LastAssignment;
|
|
2810
2821
|
}
|
|
2811
2822
|
|
|
2812
|
-
// ../jsx/src/reactivity-checker.ts
|
|
2813
|
-
import ts12 from "typescript";
|
|
2814
|
-
|
|
2815
2823
|
// ../jsx/src/free-refs.ts
|
|
2816
2824
|
import ts13 from "typescript";
|
|
2817
2825
|
var _bindingMapCache = new WeakMap;
|
|
@@ -6600,7 +6608,7 @@ ${whenTrue}
|
|
|
6600
6608
|
const preambleLines = (loop.preamble?.declarations ?? []).map((d) => `{% set ${minijinjaIdent(d.name)} = ${this.convertExpressionToJinja(d.raw, d.valueParsed)} %}`);
|
|
6601
6609
|
const childrenUnderLoop = this.renderChildren(loop.children);
|
|
6602
6610
|
this.inLoop = prevInLoop;
|
|
6603
|
-
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.
|
|
6611
|
+
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.escape_comment_key(${this.convertExpressionToJinja(loop.key)})) | safe }}
|
|
6604
6612
|
${childrenUnderLoop}` : childrenUnderLoop;
|
|
6605
6613
|
this.scope = prevScope;
|
|
6606
6614
|
const lines = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/rust",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "minijinja (Rust) adapter for BarefootJS — compiles IR to .j2 templates and ships a Rust rendering runtime (packages/adapter-rust/runtime/); runs under any Rust web framework (axum, etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"directory": "packages/adapter-rust"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@barefootjs/shared": "0.
|
|
57
|
+
"@barefootjs/shared": "0.35.1"
|
|
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.1",
|
|
75
|
+
"@barefootjs/vite": "0.35.1",
|
|
76
|
+
"@barefootjs/client": "0.35.1",
|
|
77
77
|
"typescript": "^5.0.0",
|
|
78
78
|
"vite": "^6.0.0"
|
|
79
79
|
}
|
package/runtime/src/runtime.rs
CHANGED
|
@@ -1416,6 +1416,20 @@ impl Object for BfInstance {
|
|
|
1416
1416
|
|
|
1417
1417
|
// -- Comment markers -------------------------------------------
|
|
1418
1418
|
"comment" => Ok(safe(format!("<!--bf-{}-->", js_string(a(0))))),
|
|
1419
|
+
// Neutralize a value for splicing into `comment`'s HTML comment
|
|
1420
|
+
// content (#2795 follow-up). `comment` itself does no escaping --
|
|
1421
|
+
// fine for every other caller (marker IDs like "cond-start:s0",
|
|
1422
|
+
// "loop:l0", ...), which are entirely compiler-generated, but the
|
|
1423
|
+
// whole-item-conditional loop's "loop-i:<key>" anchor carries a
|
|
1424
|
+
// user-controlled key. Standard HTML escaping doesn't help inside
|
|
1425
|
+
// a comment -- only the literal sequence "-->" terminates it
|
|
1426
|
+
// early, and &/</>/"/' are not special there. The key's exact
|
|
1427
|
+
// text doesn't need to round-trip (the client's mapArrayAnchored
|
|
1428
|
+
// matches items positionally and by its own JS-computed key,
|
|
1429
|
+
// never by re-parsing the anchor Comment.nodeValue), so replacing
|
|
1430
|
+
// every "-" with the visually-similar U+2010 is sufficient and
|
|
1431
|
+
// needs no decoding.
|
|
1432
|
+
"escape_comment_key" => Ok(MjValue::from(js_string(a(0)).replace('-', "‐"))),
|
|
1419
1433
|
"bool_str" => Ok(MjValue::from(js_bool_str(js_truthy(a(0))))),
|
|
1420
1434
|
"text_start" => Ok(safe(format!("<!--bf:{}-->", js_string(a(0))))),
|
|
1421
1435
|
"text_end" => Ok(safe("<!--/-->".to_string())),
|
|
@@ -550,8 +550,8 @@ function Widget({ values }: { values: number[] }) {
|
|
|
550
550
|
return <ul>{values.map((label) => (label > 0 ? <li key={label}>{label}</li> : null))}</ul>
|
|
551
551
|
}
|
|
552
552
|
`)
|
|
553
|
-
expect(template).toContain('bf.comment("loop-i:" ~ bf.
|
|
554
|
-
expect(template).not.toContain("bf.comment(\"loop-i:\" ~ bf.
|
|
553
|
+
expect(template).toContain('bf.comment("loop-i:" ~ bf.escape_comment_key(label))')
|
|
554
|
+
expect(template).not.toContain("bf.comment(\"loop-i:\" ~ bf.escape_comment_key('x'))")
|
|
555
555
|
})
|
|
556
556
|
|
|
557
557
|
test('a loop param shadowing an outer const resolves to the row value inside a .map() preamble local initializer', () => {
|
|
@@ -1037,9 +1037,12 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
1037
1037
|
// client's `mapArrayAnchored` can hydrate every SSR-rendered item by its
|
|
1038
1038
|
// anchor. Still under the row scope (see above) — `loop.key` is a
|
|
1039
1039
|
// per-row expression.
|
|
1040
|
+
// `bf.escape_comment_key` (#2795 follow-up) both stringifies the key and
|
|
1041
|
+
// neutralizes `-` so it can't spell `-->` and close the comment early —
|
|
1042
|
+
// see its doc in `runtime.rs`.
|
|
1040
1043
|
const bodyChildren =
|
|
1041
1044
|
loop.bodyIsItemConditional && loop.key
|
|
1042
|
-
? `{{ bf.comment("loop-i:" ~ bf.
|
|
1045
|
+
? `{{ bf.comment("loop-i:" ~ bf.escape_comment_key(${this.convertExpressionToJinja(loop.key)})) | safe }}\n${childrenUnderLoop}`
|
|
1043
1046
|
: childrenUnderLoop
|
|
1044
1047
|
this.scope = prevScope
|
|
1045
1048
|
|
package/src/conformance-pins.ts
CHANGED
|
@@ -61,18 +61,24 @@ export const conformancePins: ConformancePins = {
|
|
|
61
61
|
// above is refused.
|
|
62
62
|
'date-method-uncatalogued': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2356' }],
|
|
63
63
|
'rich-prop-client-read': [{ code: 'BF049', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2648' }],
|
|
64
|
-
//
|
|
64
|
+
// A ternary or array literal LITERALLY WRAPPING JSX at a non-children prop
|
|
65
65
|
// position (e.g. `header={cond ? <a/> : <b/>}`) is refused ahead of
|
|
66
66
|
// `adapter.generate()` in the shared jsx-to-ir.ts phase, so it is pinned
|
|
67
67
|
// identically on every adapter (including Hono) — same reasoning as
|
|
68
|
-
// `rich-prop-client-read` above.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
68
|
+
// `rich-prop-client-read` above. This is the permanent, intended behavior
|
|
69
|
+
// (formerly tracked as #2667, closed): the issue's own acceptance criteria
|
|
70
|
+
// treated a loud refusal as fully resolving the silent-divergence bug, so
|
|
71
|
+
// no open issue tracks further work here.
|
|
72
|
+
'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error' }],
|
|
73
|
+
'jsx-element-prop-array': [{ code: 'BF021', severity: 'error' }],
|
|
74
|
+
// A reactive primitive invoked through a namespace import
|
|
72
75
|
// (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
|
|
73
76
|
// that the analyzer's checker-less fast path cannot recognize refuses
|
|
74
77
|
// loudly (BF013) instead of silently dropping the declaration — fired
|
|
75
78
|
// in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
|
|
76
|
-
// so all nine adapters (including Hono) pin this identically.
|
|
77
|
-
|
|
79
|
+
// so all nine adapters (including Hono) pin this identically. A compile
|
|
80
|
+
// that supplies a shared `ts.Program` (e.g. via `@barefootjs/vite`)
|
|
81
|
+
// resolves the primitive normally and never reaches this refusal (formerly
|
|
82
|
+
// tracked as #2771, closed) — no open issue tracks further work.
|
|
83
|
+
'namespace-import-primitive': [{ code: 'BF013', severity: 'error' }],
|
|
78
84
|
}
|
|
@@ -17,7 +17,4 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
17
17
|
// at value position and the runtime evaluator's `object-literal` case
|
|
18
18
|
// now merges it, so the seed classifies `derived` and SSRs identically
|
|
19
19
|
// to Hono.
|
|
20
|
-
export const renderDivergences: RenderDivergences = {
|
|
21
|
-
'aliased-loop-source':
|
|
22
|
-
'A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) SSRs an empty `<ul>` through real minijinja — 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.',
|
|
23
|
-
}
|
|
20
|
+
export const renderDivergences: RenderDivergences = {}
|
package/src/test-render.ts
CHANGED
|
@@ -519,6 +519,20 @@ function buildVars(
|
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
// #2813: `extractSsrDefaults` can seed an entry under a name that is
|
|
523
|
+
// none of `propsParams` / `signals` / `memos` above — a bare local-const
|
|
524
|
+
// alias of a signal/memo getter (`const items__alias = items`,
|
|
525
|
+
// `ssr-defaults.ts`) seeds `items__alias` alongside `items`. Production
|
|
526
|
+
// hands the whole manifest-derived stash straight through
|
|
527
|
+
// (`deriveStashFromDefaults` IS the production seeding mechanism here,
|
|
528
|
+
// not a harness stand-in), so any leftover `derivedProps` key must be
|
|
529
|
+
// copied too, or this harness would silently omit what production
|
|
530
|
+
// actually provides, mismeasuring this conformance case.
|
|
531
|
+
for (const [name, value] of Object.entries(derivedProps)) {
|
|
532
|
+
if (Object.prototype.hasOwnProperty.call(vars, name)) continue
|
|
533
|
+
vars[name] = value
|
|
534
|
+
}
|
|
535
|
+
|
|
522
536
|
return vars
|
|
523
537
|
}
|
|
524
538
|
|