@barefootjs/jinja 0.18.4 → 0.18.7
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/expr/array-method.d.ts.map +1 -1
- package/dist/adapter/expr/emitters.d.ts +2 -2
- package/dist/adapter/expr/emitters.d.ts.map +1 -1
- package/dist/adapter/index.js +120 -20
- package/dist/adapter/jinja-adapter.d.ts +49 -0
- package/dist/adapter/jinja-adapter.d.ts.map +1 -1
- package/dist/adapter/lib/constants.d.ts.map +1 -1
- package/dist/adapter/lib/static-value.d.ts +15 -0
- package/dist/adapter/lib/static-value.d.ts.map +1 -0
- package/dist/build.js +120 -20
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +122 -37
- package/dist/render-divergences.d.ts.map +1 -1
- package/package.json +3 -3
- package/python/barefootjs/runtime.py +64 -6
- package/python/tests/test_helper_vectors.py +6 -0
- package/python/tests/test_template_primitives.py +45 -0
- package/src/__tests__/jinja-adapter-unit.test.ts +141 -0
- package/src/adapter/expr/array-method.ts +19 -0
- package/src/adapter/expr/emitters.ts +19 -6
- package/src/adapter/jinja-adapter.ts +164 -13
- package/src/adapter/lib/constants.ts +3 -0
- package/src/adapter/lib/static-value.ts +41 -0
- package/src/conformance-pins.ts +24 -30
- package/src/render-divergences.ts +4 -16
- package/src/test-render.ts +13 -142
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-method.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/array-method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAA;AAGxB,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,EAAE,EAClB,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B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AI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,GAAG,IAAI,CAKf;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,GAAG,IAAI,CAKf;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,GAAG,MAAM,CASxE;AAGD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,EACvC,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,CAmBR"}
|
|
@@ -77,7 +77,7 @@ export declare class JinjaFilterEmitter implements ParsedExprEmitter {
|
|
|
77
77
|
constructor(param: string, localVarMap: Map<string, string>, isStringName?: (n: string) => boolean, onUnsupported?: ((message: string, reason?: string) => void) | undefined);
|
|
78
78
|
identifier(name: string): string;
|
|
79
79
|
literal(value: string | number | boolean | null, literalType: LiteralType): string;
|
|
80
|
-
member(object: ParsedExpr, property: string, _computed: boolean, emit: (e: ParsedExpr) => string): string;
|
|
80
|
+
member(object: ParsedExpr, property: string, _computed: boolean, _optional: boolean, emit: (e: ParsedExpr) => string): string;
|
|
81
81
|
indexAccess(object: ParsedExpr, index: ParsedExpr, emit: (e: ParsedExpr) => string): string;
|
|
82
82
|
call(callee: ParsedExpr, args: ParsedExpr[], emit: (e: ParsedExpr) => string): string;
|
|
83
83
|
unary(op: string, argument: ParsedExpr, emit: (e: ParsedExpr) => string): string;
|
|
@@ -112,7 +112,7 @@ export declare class JinjaTopLevelEmitter implements ParsedExprEmitter {
|
|
|
112
112
|
constructor(ctx: JinjaEmitContext);
|
|
113
113
|
identifier(name: string): string;
|
|
114
114
|
literal(value: string | number | boolean | null, literalType: LiteralType): string;
|
|
115
|
-
member(object: ParsedExpr, property: string, _computed: boolean, emit: (e: ParsedExpr) => string): string;
|
|
115
|
+
member(object: ParsedExpr, property: string, _computed: boolean, _optional: boolean, emit: (e: ParsedExpr) => string): string;
|
|
116
116
|
indexAccess(object: ParsedExpr, index: ParsedExpr, emit: (e: ParsedExpr) => string): string;
|
|
117
117
|
call(callee: ParsedExpr, args: ParsedExpr[], emit: (e: ParsedExpr) => string): string;
|
|
118
118
|
unary(op: string, argument: ParsedExpr, emit: (e: ParsedExpr) => string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,EAIlB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AA+B1D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,kBAAmB,YAAW,iBAAiB;IAExD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAI7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAPjC,YACmB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,YAAY,GAAE,CAAC,CAA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MAAM,CAEjD;IAED,aAAa,CAAC,UAAU,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAWzG;CACF"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -187308,7 +187308,13 @@ import {
|
|
|
187308
187308
|
prepareLoweringMatchers,
|
|
187309
187309
|
queryHrefArgs,
|
|
187310
187310
|
isValidHelperId,
|
|
187311
|
-
sortComparatorFromArrow as sortComparatorFromArrow2
|
|
187311
|
+
sortComparatorFromArrow as sortComparatorFromArrow2,
|
|
187312
|
+
isDangerousInnerHtmlAttr,
|
|
187313
|
+
resolveDangerousInnerHtml,
|
|
187314
|
+
dangerousInnerHtmlMetacharViolation,
|
|
187315
|
+
dangerousInnerHtmlDiagnostic,
|
|
187316
|
+
resolveStaticLoopSource,
|
|
187317
|
+
collectLoopBoundNames
|
|
187312
187318
|
} from "@barefootjs/jsx";
|
|
187313
187319
|
|
|
187314
187320
|
// src/adapter/boolean-result.ts
|
|
@@ -187369,7 +187375,7 @@ function isAriaBooleanAttr(name) {
|
|
|
187369
187375
|
}
|
|
187370
187376
|
|
|
187371
187377
|
// src/adapter/jinja-adapter.ts
|
|
187372
|
-
import { BF_SLOT, BF_COND, BF_REGION } from "@barefootjs/shared";
|
|
187378
|
+
import { BF_SLOT, BF_COND, BF_REGION, escapeHtml } from "@barefootjs/shared";
|
|
187373
187379
|
|
|
187374
187380
|
// src/adapter/lib/constants.ts
|
|
187375
187381
|
var JINJA_TEMPLATE_PRIMITIVES = {
|
|
@@ -187378,7 +187384,10 @@ var JINJA_TEMPLATE_PRIMITIVES = {
|
|
|
187378
187384
|
Number: { arity: 1, emit: (args) => `bf.number(${args[0]})` },
|
|
187379
187385
|
"Math.floor": { arity: 1, emit: (args) => `bf.floor(${args[0]})` },
|
|
187380
187386
|
"Math.ceil": { arity: 1, emit: (args) => `bf.ceil(${args[0]})` },
|
|
187381
|
-
"Math.round": { arity: 1, emit: (args) => `bf.round(${args[0]})` }
|
|
187387
|
+
"Math.round": { arity: 1, emit: (args) => `bf.round(${args[0]})` },
|
|
187388
|
+
"Math.min": { arity: 2, emit: (args) => `bf.min(${args[0]}, ${args[1]})` },
|
|
187389
|
+
"Math.max": { arity: 2, emit: (args) => `bf.max(${args[0]}, ${args[1]})` },
|
|
187390
|
+
"Math.abs": { arity: 1, emit: (args) => `bf.abs(${args[0]})` }
|
|
187382
187391
|
};
|
|
187383
187392
|
var JINJA_PRIMITIVE_EMIT_MAP = Object.fromEntries(Object.entries(JINJA_TEMPLATE_PRIMITIVES).map(([k, v]) => [k, v.emit]));
|
|
187384
187393
|
|
|
@@ -187557,6 +187566,12 @@ function renderArrayMethod(method, object, args, emit) {
|
|
|
187557
187566
|
const recv = emit(object);
|
|
187558
187567
|
return `bf.trim(${recv})`;
|
|
187559
187568
|
}
|
|
187569
|
+
case "trimStart":
|
|
187570
|
+
case "trimEnd": {
|
|
187571
|
+
const fn = method === "trimStart" ? "trim_start" : "trim_end";
|
|
187572
|
+
const recv = emit(object);
|
|
187573
|
+
return `bf.${fn}(${recv})`;
|
|
187574
|
+
}
|
|
187560
187575
|
case "toFixed": {
|
|
187561
187576
|
const recv = emit(object);
|
|
187562
187577
|
const digits = args.length >= 1 ? emit(args[0]) : "0";
|
|
@@ -187590,6 +187605,12 @@ function renderArrayMethod(method, object, args, emit) {
|
|
|
187590
187605
|
const newS = emit(args[1]);
|
|
187591
187606
|
return `bf.replace(${recv}, ${oldS}, ${newS})`;
|
|
187592
187607
|
}
|
|
187608
|
+
case "replaceAll": {
|
|
187609
|
+
const recv = emit(object);
|
|
187610
|
+
const oldS = emit(args[0]);
|
|
187611
|
+
const newS = emit(args[1]);
|
|
187612
|
+
return `bf.replace_all(${recv}, ${oldS}, ${newS})`;
|
|
187613
|
+
}
|
|
187593
187614
|
case "repeat": {
|
|
187594
187615
|
const recv = emit(object);
|
|
187595
187616
|
const count = args.length === 0 ? "0" : emit(args[0]);
|
|
@@ -187684,6 +187705,39 @@ function renderFlatMethod(recv, depth, emit) {
|
|
|
187684
187705
|
return `bf.flat(${recv}, ${d})`;
|
|
187685
187706
|
}
|
|
187686
187707
|
|
|
187708
|
+
// src/adapter/lib/static-value.ts
|
|
187709
|
+
function staticValueToJinja(value) {
|
|
187710
|
+
if (value === null || value === undefined)
|
|
187711
|
+
return "none";
|
|
187712
|
+
if (typeof value === "boolean")
|
|
187713
|
+
return value ? "true" : "false";
|
|
187714
|
+
if (typeof value === "number")
|
|
187715
|
+
return String(value);
|
|
187716
|
+
if (typeof value === "string")
|
|
187717
|
+
return `'${escapeJinjaSingleQuoted(value)}'`;
|
|
187718
|
+
if (Array.isArray(value)) {
|
|
187719
|
+
const items = [];
|
|
187720
|
+
for (const el of value) {
|
|
187721
|
+
const serialized = staticValueToJinja(el);
|
|
187722
|
+
if (serialized === null)
|
|
187723
|
+
return null;
|
|
187724
|
+
items.push(serialized);
|
|
187725
|
+
}
|
|
187726
|
+
return `[${items.join(", ")}]`;
|
|
187727
|
+
}
|
|
187728
|
+
if (typeof value === "object") {
|
|
187729
|
+
const entries = [];
|
|
187730
|
+
for (const [key, val] of Object.entries(value)) {
|
|
187731
|
+
const serialized = staticValueToJinja(val);
|
|
187732
|
+
if (serialized === null)
|
|
187733
|
+
return null;
|
|
187734
|
+
entries.push(`${jinjaHashKey(key)}: ${serialized}`);
|
|
187735
|
+
}
|
|
187736
|
+
return `{${entries.join(", ")}}`;
|
|
187737
|
+
}
|
|
187738
|
+
return null;
|
|
187739
|
+
}
|
|
187740
|
+
|
|
187687
187741
|
// src/adapter/expr/emitters.ts
|
|
187688
187742
|
import {
|
|
187689
187743
|
groupBinaryOperand,
|
|
@@ -187732,11 +187786,11 @@ class JinjaFilterEmitter {
|
|
|
187732
187786
|
return "none";
|
|
187733
187787
|
return String(value);
|
|
187734
187788
|
}
|
|
187735
|
-
member(object, property, _computed, emit) {
|
|
187789
|
+
member(object, property, _computed, _optional, emit) {
|
|
187736
187790
|
if (property === "length") {
|
|
187737
187791
|
return `bf.length(${emit(object)})`;
|
|
187738
187792
|
}
|
|
187739
|
-
return `${emit(object)}
|
|
187793
|
+
return `${emit(object)}['${escapeJinjaSingleQuoted(property)}']`;
|
|
187740
187794
|
}
|
|
187741
187795
|
indexAccess(object, index, emit) {
|
|
187742
187796
|
return `${emit(object)}[${emit(index)}]`;
|
|
@@ -187838,7 +187892,7 @@ class JinjaTopLevelEmitter {
|
|
|
187838
187892
|
return "none";
|
|
187839
187893
|
return String(value);
|
|
187840
187894
|
}
|
|
187841
|
-
member(object, property, _computed, emit) {
|
|
187895
|
+
member(object, property, _computed, _optional, emit) {
|
|
187842
187896
|
if (object.kind === "identifier" && object.name === "props") {
|
|
187843
187897
|
return jinjaIdent(property);
|
|
187844
187898
|
}
|
|
@@ -187850,7 +187904,7 @@ class JinjaTopLevelEmitter {
|
|
|
187850
187904
|
const obj = emit(object);
|
|
187851
187905
|
if (property === "length")
|
|
187852
187906
|
return `bf.length(${obj})`;
|
|
187853
|
-
return `${obj}
|
|
187907
|
+
return `${obj}['${escapeJinjaSingleQuoted(property)}']`;
|
|
187854
187908
|
}
|
|
187855
187909
|
indexAccess(object, index, emit) {
|
|
187856
187910
|
return `${emit(object)}[${emit(index)}]`;
|
|
@@ -188257,6 +188311,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188257
188311
|
options;
|
|
188258
188312
|
errors = [];
|
|
188259
188313
|
inLoop = false;
|
|
188314
|
+
currentLoopKeyDepth = 0;
|
|
188260
188315
|
propsObjectName = null;
|
|
188261
188316
|
propsParams = [];
|
|
188262
188317
|
booleanTypedProps = new Set;
|
|
@@ -188265,6 +188320,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188265
188320
|
_searchParamsLocals = new Set;
|
|
188266
188321
|
_loweringMatchers = [];
|
|
188267
188322
|
localConstants = [];
|
|
188323
|
+
staticLoopSourceBoundNames = new Set;
|
|
188268
188324
|
nullableOptionalProps = new Set;
|
|
188269
188325
|
constructor(options = {}) {
|
|
188270
188326
|
super();
|
|
@@ -188280,6 +188336,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188280
188336
|
this.propsParams = ir.metadata.propsParams.map((p) => ({ name: p.name }));
|
|
188281
188337
|
this.booleanTypedProps = collectBooleanTypedProps(ir);
|
|
188282
188338
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
188339
|
+
this.staticLoopSourceBoundNames = collectLoopBoundNames(ir);
|
|
188283
188340
|
this.nullableOptionalProps = collectNullableOptionalProps(ir);
|
|
188284
188341
|
this.stringValueNames = collectStringValueNames(ir);
|
|
188285
188342
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
@@ -188333,7 +188390,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188333
188390
|
return this.renderElement(node);
|
|
188334
188391
|
}
|
|
188335
188392
|
emitText(node) {
|
|
188336
|
-
return node.value;
|
|
188393
|
+
return escapeHtml(node.value);
|
|
188337
188394
|
}
|
|
188338
188395
|
emitExpression(node) {
|
|
188339
188396
|
return this.renderExpression(node);
|
|
@@ -188401,7 +188458,8 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188401
188458
|
renderElement(element) {
|
|
188402
188459
|
const tag = element.tag;
|
|
188403
188460
|
const attrs = this.renderAttributes(element);
|
|
188404
|
-
const
|
|
188461
|
+
const dangerousHtml = this.renderDangerousInnerHtml(element);
|
|
188462
|
+
const children = dangerousHtml !== null ? dangerousHtml : this.renderChildren(element.children);
|
|
188405
188463
|
let hydrationAttrs = "";
|
|
188406
188464
|
if (element.needsScope) {
|
|
188407
188465
|
hydrationAttrs += ` ${this.renderScopeMarker("")}`;
|
|
@@ -188436,6 +188494,22 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188436
188494
|
}
|
|
188437
188495
|
return `<${tag}${attrs}${hydrationAttrs}>${children}</${tag}>`;
|
|
188438
188496
|
}
|
|
188497
|
+
renderDangerousInnerHtml(element) {
|
|
188498
|
+
const resolution = resolveDangerousInnerHtml(element);
|
|
188499
|
+
if (!resolution)
|
|
188500
|
+
return null;
|
|
188501
|
+
if (resolution.kind === "dynamic") {
|
|
188502
|
+
this.errors.push(dangerousInnerHtmlDiagnostic(resolution.expr, resolution.loc));
|
|
188503
|
+
return "";
|
|
188504
|
+
}
|
|
188505
|
+
const violation = dangerousInnerHtmlMetacharViolation(resolution.html, this.name);
|
|
188506
|
+
if (violation) {
|
|
188507
|
+
const attr = element.attrs.find(isDangerousInnerHtmlAttr);
|
|
188508
|
+
this.errors.push(dangerousInnerHtmlDiagnostic(`{ __html: ${JSON.stringify(resolution.html)} }`, attr.loc, violation));
|
|
188509
|
+
return "";
|
|
188510
|
+
}
|
|
188511
|
+
return resolution.html;
|
|
188512
|
+
}
|
|
188439
188513
|
renderExpression(expr) {
|
|
188440
188514
|
if (expr.clientOnly) {
|
|
188441
188515
|
if (expr.slotId) {
|
|
@@ -188443,7 +188517,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188443
188517
|
}
|
|
188444
188518
|
return "";
|
|
188445
188519
|
}
|
|
188446
|
-
const jinjaExpr = `bf.string(${this.convertExpressionToJinja(expr.expr)})`;
|
|
188520
|
+
const jinjaExpr = `bf.string(${this.convertExpressionToJinja(expr.expr, expr.parsed)})`;
|
|
188447
188521
|
if (expr.slotId) {
|
|
188448
188522
|
return `{{ bf.text_start("${expr.slotId}") | safe }}{{ ${jinjaExpr} }}{{ bf.text_end() | safe }}`;
|
|
188449
188523
|
}
|
|
@@ -188535,8 +188609,12 @@ ${whenTrue}
|
|
|
188535
188609
|
}
|
|
188536
188610
|
});
|
|
188537
188611
|
}
|
|
188612
|
+
const staticItems = resolveStaticLoopSource(loop.arrayParsed, this.localConstants, {
|
|
188613
|
+
isNameShadowed: (name) => this.staticLoopSourceBoundNames.has(name)
|
|
188614
|
+
});
|
|
188615
|
+
const staticArray = staticItems !== null ? staticValueToJinja(staticItems) : null;
|
|
188538
188616
|
const arrayName = loop.array.trim();
|
|
188539
|
-
if (/^[A-Za-z_$][\w$]*$/.test(arrayName)) {
|
|
188617
|
+
if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
|
|
188540
188618
|
const arrayConst = (this.localConstants ?? []).find((c) => c.name === arrayName);
|
|
188541
188619
|
if (arrayConst && !arrayConst.isModule && this._resolveLiteralConst(arrayName) === null) {
|
|
188542
188620
|
this.errors.push({
|
|
@@ -188550,7 +188628,7 @@ ${whenTrue}
|
|
|
188550
188628
|
});
|
|
188551
188629
|
}
|
|
188552
188630
|
}
|
|
188553
|
-
const rawArray = this.convertExpressionToJinja(loop.array);
|
|
188631
|
+
const rawArray = staticArray ?? this.convertExpressionToJinja(loop.array);
|
|
188554
188632
|
let array = rawArray;
|
|
188555
188633
|
if (loop.sortComparator) {
|
|
188556
188634
|
const sort = loop.sortComparator;
|
|
@@ -188564,7 +188642,7 @@ ${whenTrue}
|
|
|
188564
188642
|
const renderedChildren = this.renderChildren(loop.children);
|
|
188565
188643
|
const loopVar = loop.iterationShape === "keys" ? "__bf_item" : supportableDestructure ? "__bf_item" : param;
|
|
188566
188644
|
const indexLocalLines = [];
|
|
188567
|
-
if (loop.iterationShape === "keys") {
|
|
188645
|
+
if (loop.objectIteration) {} else if (loop.iterationShape === "keys") {
|
|
188568
188646
|
indexLocalLines.push(`{% set ${jinjaIdent(param)} = loop.index0 %}`);
|
|
188569
188647
|
} else if (loop.index) {
|
|
188570
188648
|
indexLocalLines.push(`{% set ${jinjaIdent(loop.index)} = loop.index0 %}`);
|
|
@@ -188584,13 +188662,17 @@ ${whenTrue}
|
|
|
188584
188662
|
}
|
|
188585
188663
|
const prevInLoop = this.inLoop;
|
|
188586
188664
|
this.inLoop = true;
|
|
188665
|
+
const prevLoopKeyDepth = this.currentLoopKeyDepth;
|
|
188666
|
+
this.currentLoopKeyDepth = loop.depth;
|
|
188587
188667
|
const childrenUnderLoop = this.renderChildren(loop.children);
|
|
188668
|
+
this.currentLoopKeyDepth = prevLoopKeyDepth;
|
|
188588
188669
|
this.inLoop = prevInLoop;
|
|
188589
188670
|
const bodyChildren = loop.bodyIsItemConditional && loop.key ? `{{ bf.comment("loop-i:" ~ bf.string(${this.convertExpressionToJinja(loop.key)})) | safe }}
|
|
188590
188671
|
${childrenUnderLoop}` : childrenUnderLoop;
|
|
188591
188672
|
const lines = [];
|
|
188592
188673
|
lines.push(`{{ bf.comment("loop:${loop.markerId}") | safe }}`);
|
|
188593
|
-
|
|
188674
|
+
const forHeader = loop.objectIteration === "entries" ? `{% for ${jinjaIdent(loop.index ?? param)}, ${jinjaIdent(param)} in ${array}.items() %}` : loop.objectIteration === "keys" ? `{% for ${jinjaIdent(param)} in ${array}.keys() %}` : loop.objectIteration === "values" ? `{% for ${jinjaIdent(param)} in ${array}.values() %}` : `{% for ${jinjaIdent(loopVar)} in ${array} %}`;
|
|
188675
|
+
lines.push(forHeader);
|
|
188594
188676
|
for (const il of indexLocalLines)
|
|
188595
188677
|
lines.push(il);
|
|
188596
188678
|
if (loop.filterPredicate) {
|
|
@@ -188662,9 +188744,20 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
188662
188744
|
renderComponent(comp) {
|
|
188663
188745
|
const segments = [{ kind: "entries", parts: [] }];
|
|
188664
188746
|
const currentEntries = () => this.componentPropSegmentEntries(segments);
|
|
188747
|
+
const namedSlotSetBlocks = [];
|
|
188665
188748
|
for (const p of comp.props) {
|
|
188666
188749
|
if ((p.name.match(/^on[A-Z]/) || p.name === "ref") && p.value.kind === "expression")
|
|
188667
188750
|
continue;
|
|
188751
|
+
if (p.value.kind === "jsx-children" && p.name !== "children") {
|
|
188752
|
+
const prevInLoop = this.inLoop;
|
|
188753
|
+
this.inLoop = false;
|
|
188754
|
+
const slotBody = this.renderChildren(p.value.children);
|
|
188755
|
+
this.inLoop = prevInLoop;
|
|
188756
|
+
const captureName = `bf_prop_${this.childrenCaptureCounter++}`;
|
|
188757
|
+
namedSlotSetBlocks.push(`{% set ${captureName} %}${slotBody}{% endset %}`);
|
|
188758
|
+
currentEntries().push(`${jinjaHashKey(p.name)}: ${captureName}`);
|
|
188759
|
+
continue;
|
|
188760
|
+
}
|
|
188668
188761
|
if (p.value.kind === "spread") {
|
|
188669
188762
|
const trimmed = p.value.expr.trim();
|
|
188670
188763
|
if (this.propsObjectName && this.propsObjectName === trimmed) {
|
|
@@ -188693,11 +188786,11 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
188693
188786
|
const captureName = `bf_children_${comp.slotId ?? "c" + this.childrenCaptureCounter++}`;
|
|
188694
188787
|
currentEntries().push(`${jinjaHashKey("children")}: ${captureName}`);
|
|
188695
188788
|
const dict = this.combineComponentPropSegments(segments);
|
|
188696
|
-
return
|
|
188789
|
+
return `${namedSlotSetBlocks.join("")}{% set ${captureName} %}${childrenBody}{% endset %}{{ bf.render_child('${tplName}', ${dict}) | safe }}`;
|
|
188697
188790
|
}
|
|
188698
188791
|
const isEmpty = segments.every((s) => s.kind === "entries" && s.parts.length === 0);
|
|
188699
188792
|
const dictEntries = isEmpty ? "" : `, ${this.combineComponentPropSegments(segments)}`;
|
|
188700
|
-
return
|
|
188793
|
+
return `${namedSlotSetBlocks.join("")}{{ bf.render_child('${tplName}'${dictEntries}) | safe }}`;
|
|
188701
188794
|
}
|
|
188702
188795
|
childrenCaptureCounter = 0;
|
|
188703
188796
|
presenceVarCounter = 0;
|
|
@@ -188742,7 +188835,7 @@ ${alternate}
|
|
|
188742
188835
|
${children}`;
|
|
188743
188836
|
}
|
|
188744
188837
|
elementAttrEmitter = {
|
|
188745
|
-
emitLiteral: (value, name) => `${name}="${value.value}"`,
|
|
188838
|
+
emitLiteral: (value, name) => `${name}="${escapeHtml(value.value)}"`,
|
|
188746
188839
|
emitExpression: (value, name) => {
|
|
188747
188840
|
if (name === "style") {
|
|
188748
188841
|
const css = this.tryLowerStyleObject(value.expr);
|
|
@@ -188847,12 +188940,15 @@ ${name}="{{ bf.string(${val}) }}"
|
|
|
188847
188940
|
for (const attr of element.attrs) {
|
|
188848
188941
|
if (attr.clientOnly)
|
|
188849
188942
|
continue;
|
|
188943
|
+
if (isDangerousInnerHtmlAttr(attr))
|
|
188944
|
+
continue;
|
|
188850
188945
|
let attrName;
|
|
188851
188946
|
if (attr.name === "className")
|
|
188852
188947
|
attrName = "class";
|
|
188853
|
-
else if (attr.name === "key")
|
|
188854
|
-
|
|
188855
|
-
|
|
188948
|
+
else if (attr.name === "key") {
|
|
188949
|
+
const depth = this.currentLoopKeyDepth;
|
|
188950
|
+
attrName = depth > 0 ? `data-key-${depth}` : "data-key";
|
|
188951
|
+
} else
|
|
188856
188952
|
attrName = attr.name;
|
|
188857
188953
|
const lowered = emitAttrValue(attr.value, this.elementAttrEmitter, attrName);
|
|
188858
188954
|
if (lowered)
|
|
@@ -189045,6 +189141,8 @@ Options:
|
|
|
189045
189141
|
return isBooleanResultExpr(expr) || isAriaBooleanAttr(name) || this.isBooleanTypedPropRef(expr);
|
|
189046
189142
|
}
|
|
189047
189143
|
_resolveLiteralConst(name) {
|
|
189144
|
+
if (this.staticLoopSourceBoundNames.has(name))
|
|
189145
|
+
return null;
|
|
189048
189146
|
const c = (this.localConstants ?? []).find((lc) => lc.name === name);
|
|
189049
189147
|
if (c?.value === undefined)
|
|
189050
189148
|
return null;
|
|
@@ -189057,6 +189155,8 @@ Options:
|
|
|
189057
189155
|
return null;
|
|
189058
189156
|
}
|
|
189059
189157
|
_resolveStaticRecordLiteral(objectName, key) {
|
|
189158
|
+
if (this.staticLoopSourceBoundNames.has(objectName))
|
|
189159
|
+
return null;
|
|
189060
189160
|
const hit = lookupStaticRecordLiteral(objectName, key, this.localConstants);
|
|
189061
189161
|
if (!hit)
|
|
189062
189162
|
return null;
|
|
@@ -113,6 +113,14 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
|
|
|
113
113
|
private options;
|
|
114
114
|
private errors;
|
|
115
115
|
private inLoop;
|
|
116
|
+
/**
|
|
117
|
+
* `IRLoop.depth` of the loop currently being rendered (save/restore
|
|
118
|
+
* around `renderChildren(loop.children)`, mirroring `inLoop` above).
|
|
119
|
+
* `renderAttributes` reads this to derive the `key` → `data-key`/
|
|
120
|
+
* `data-key-N` suffix — the depth is IR-computed (jsx-to-ir.ts), not
|
|
121
|
+
* re-derived here (#2168 nested-loop-outer-binding).
|
|
122
|
+
*/
|
|
123
|
+
private currentLoopKeyDepth;
|
|
116
124
|
/**
|
|
117
125
|
* SolidJS-style props identifier (`function(props: P)`) and the
|
|
118
126
|
* analyzer-extracted prop names. Stashed at `generate()` entry so the
|
|
@@ -160,6 +168,16 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
|
|
|
160
168
|
* const (`const sizeAttrs = size ? {…} : {}`) to its initializer text.
|
|
161
169
|
*/
|
|
162
170
|
private localConstants;
|
|
171
|
+
/**
|
|
172
|
+
* Every name a `.map()`/`.filter()` loop callback binds as its item/index
|
|
173
|
+
* parameter anywhere in the component (#2208 fable review). A static
|
|
174
|
+
* loop-SOURCE name (e.g. a function-scope `const items = [...]`) must
|
|
175
|
+
* never resolve through `resolveStaticLoopSource` at a use site where a
|
|
176
|
+
* DIFFERENT, enclosing loop's own callback param shadows it — same
|
|
177
|
+
* shadowing hazard, and same coarse-but-safe mitigation, as #2212's
|
|
178
|
+
* `collectLoopBoundNames` use in `collectStringValueNames`.
|
|
179
|
+
*/
|
|
180
|
+
private staticLoopSourceBoundNames;
|
|
163
181
|
/**
|
|
164
182
|
* Optional, no-default props that are `None` when the caller omits them.
|
|
165
183
|
* Their bare-reference attribute emission is guarded with a Jinja
|
|
@@ -211,6 +229,13 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
|
|
|
211
229
|
private providerObjectLiteralJinja;
|
|
212
230
|
emitAsync(node: IRAsync, _ctx: JinjaRenderCtx, _emit: EmitIRNode<JinjaRenderCtx>): string;
|
|
213
231
|
renderElement(element: IRElement): string;
|
|
232
|
+
/**
|
|
233
|
+
* `dangerouslySetInnerHTML={{ __html: '...' }}` (#2207) — see the Blade
|
|
234
|
+
* adapter's identical helper for the full rationale. `null` means the
|
|
235
|
+
* attribute is absent (caller falls through to normal `renderChildren`);
|
|
236
|
+
* a non-`null` string (possibly `''`) replaces the children outright.
|
|
237
|
+
*/
|
|
238
|
+
private renderDangerousInnerHtml;
|
|
214
239
|
renderExpression(expr: IRExpression): string;
|
|
215
240
|
renderConditional(cond: IRConditional): string;
|
|
216
241
|
private renderNodeOrNull;
|
|
@@ -382,8 +407,32 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
|
|
|
382
407
|
* single-quoted string literal (`const totalPages = 5`, #1897
|
|
383
408
|
* pagination) — function-scope consts never reach the per-render
|
|
384
409
|
* context, so a bare reference would resolve to Undefined.
|
|
410
|
+
*
|
|
411
|
+
* The lookup is a flat name match with no notion of AST scope, so a
|
|
412
|
+
* name that any loop callback binds as its item/index param never
|
|
413
|
+
* inlines (#2221) — the occurrence may be the loop's own (shadowing)
|
|
414
|
+
* binding, and substituting the outer const's value there renders every
|
|
415
|
+
* iteration with the same hard-coded literal. Coarse (a genuinely
|
|
416
|
+
* non-shadowed same-named const elsewhere in the component also stops
|
|
417
|
+
* inlining, falling back to the bare identifier) but safe — the same
|
|
418
|
+
* trade-off as #2212's `collectLoopBoundNames` use in
|
|
419
|
+
* `collectStringValueNames`.
|
|
385
420
|
*/
|
|
386
421
|
private _resolveLiteralConst;
|
|
422
|
+
/**
|
|
423
|
+
* Resolve `IDENT.key` where `IDENT` is a module-scope object-literal const
|
|
424
|
+
* (`variantClasses.ghost`, #1896/#1897) to the looked-up scalar.
|
|
425
|
+
*
|
|
426
|
+
* The lookup is a flat name match on `objectName` with no notion of AST
|
|
427
|
+
* scope, so an enclosing loop callback's own param of the same name
|
|
428
|
+
* (`.map((cfg) => <li>{cfg.x}</li>)` shadowing a module `const cfg = {…}`)
|
|
429
|
+
* still resolved to the OUTER const's member value at every iteration
|
|
430
|
+
* (#2237) — the sibling hazard to #2221's `_resolveLiteralConst`. Same
|
|
431
|
+
* coarse-but-safe `staticLoopSourceBoundNames` guard: any name a loop
|
|
432
|
+
* binds anywhere in the component never inlines, falling back to the bare
|
|
433
|
+
* `cfg['x']` member expression (which a Jinja for-loop binds correctly
|
|
434
|
+
* at the shadowed occurrences).
|
|
435
|
+
*/
|
|
387
436
|
private _resolveStaticRecordLiteral;
|
|
388
437
|
private _resolveModuleStringConst;
|
|
389
438
|
private _recordExprBF101;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/jinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAKP,yBAAyB,EAE1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"jinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/jinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAKP,yBAAyB,EAE1B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/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAUnE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,CAG7E,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a compile-time-evaluated JS value (`@barefootjs/jsx`'s
|
|
3
|
+
* `evaluateStaticLiteral`/`resolveStaticLoopSource`, #2208) into a native
|
|
4
|
+
* Jinja2 literal. Used to inline a fully-static loop source (an inline
|
|
5
|
+
* array literal, or a function-scope local const with a static
|
|
6
|
+
* initializer) directly in a `{% for %}` header, rather than requiring a
|
|
7
|
+
* bound template variable.
|
|
8
|
+
*
|
|
9
|
+
* Returns `null` for a value this adapter can't represent as a literal
|
|
10
|
+
* (e.g. `undefined` reads for a missing object key are still representable
|
|
11
|
+
* as `none`, but anything else falls back to the caller's existing BF101
|
|
12
|
+
* refusal instead of guessing).
|
|
13
|
+
*/
|
|
14
|
+
export declare function staticValueToJinja(value: unknown): string | null;
|
|
15
|
+
//# sourceMappingURL=static-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-value.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/static-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAwBhE"}
|