@barefootjs/jinja 0.33.4 → 0.34.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/emit-context.d.ts +11 -1
- package/dist/adapter/emit-context.d.ts.map +1 -1
- package/dist/adapter/expr/emitters.d.ts +11 -1
- package/dist/adapter/expr/emitters.d.ts.map +1 -1
- package/dist/adapter/index.js +33 -23
- package/dist/adapter/jinja-adapter.d.ts +25 -0
- package/dist/adapter/jinja-adapter.d.ts.map +1 -1
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +38 -25
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +197 -135
- package/package.json +5 -5
- package/src/adapter/emit-context.ts +12 -1
- package/src/adapter/expr/emitters.ts +43 -0
- package/src/adapter/jinja-adapter.ts +54 -39
- package/src/conformance-pins.ts +11 -0
- package/src/render-divergences.ts +4 -1
|
@@ -18,13 +18,23 @@
|
|
|
18
18
|
* genuinely needs it, so the seam documents the real cross-module coupling
|
|
19
19
|
* rather than re-exposing the whole adapter.
|
|
20
20
|
*/
|
|
21
|
-
import type { ParsedExpr, CompilerError, IRMetadata } from '@barefootjs/jsx';
|
|
21
|
+
import type { ParsedExpr, CompilerError, IRMetadata, LoweringMatcher } from '@barefootjs/jsx';
|
|
22
22
|
export interface JinjaEmitContext {
|
|
23
23
|
/**
|
|
24
24
|
* (#1922) Local binding names the request-scoped `searchParams()` env signal
|
|
25
25
|
* is imported under. Non-empty enables the env-signal method-call lowering.
|
|
26
26
|
*/
|
|
27
27
|
readonly _searchParamsLocals: Set<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Registered lowering-plugin matchers (#2057), bound to this component's
|
|
30
|
+
* metadata at init. Read by `JinjaTopLevelEmitter`'s `lowering` seam
|
|
31
|
+
* (#2843) so a registered call — the built-in `queryHref`, or any
|
|
32
|
+
* userland plugin — is recognised no matter where it sits in an
|
|
33
|
+
* expression tree (a ternary branch, a template-literal interpolation, …),
|
|
34
|
+
* not only when it's the call the adapter's own top-level conversion
|
|
35
|
+
* entry point (`convertExpressionToJinja`) is asked to lower directly.
|
|
36
|
+
*/
|
|
37
|
+
readonly _loweringMatchers: readonly LoweringMatcher[];
|
|
28
38
|
/**
|
|
29
39
|
* Inline a module-scope pure string-literal const by name as the resolved
|
|
30
40
|
* literal value, or null when the name is not such a const.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-context.d.ts","sourceRoot":"","sources":["../../src/adapter/emit-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"emit-context.d.ts","sourceRoot":"","sources":["../../src/adapter/emit-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE7F,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAEzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,iBAAiB,EAAE,SAAS,eAAe,EAAE,CAAA;IAEtD;;;OAGG;IACH,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAEtD,oFAAoF;IACpF,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAEjD;;;OAGG;IACH,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAE3E,wDAAwD;IACxD,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAExD,yEAAyE;IACzE,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACtE;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAE9B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAA;IAEhC,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAErD,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAExC;;;;;;;;OAQG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;IAEtE;;;;;;OAMG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CACtE;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,CAAA;IAElG;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAA;CACjC"}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* unaffected and still used for that path plus the filter-predicate
|
|
48
48
|
* entry point `_renderJinjaFilterExprPublic`.
|
|
49
49
|
*/
|
|
50
|
-
import { type ParsedExprEmitter, type ArrayMethod, type LiteralType, type ParsedExpr, type ObjectLiteralProperty, type FlatDepth, type TemplatePart } from '@barefootjs/jsx';
|
|
50
|
+
import { type ParsedExprEmitter, type LoweringEmitter, type ArrayMethod, type LiteralType, type ParsedExpr, type ObjectLiteralProperty, type FlatDepth, type TemplatePart } from '@barefootjs/jsx';
|
|
51
51
|
import type { JinjaEmitContext } from '../emit-context.ts';
|
|
52
52
|
/**
|
|
53
53
|
* Route a condition-TEST position through `bf.truthy(...)` unless the node
|
|
@@ -110,6 +110,16 @@ export declare class JinjaFilterEmitter implements ParsedExprEmitter {
|
|
|
110
110
|
export declare class JinjaTopLevelEmitter implements ParsedExprEmitter {
|
|
111
111
|
private readonly ctx;
|
|
112
112
|
constructor(ctx: JinjaEmitContext);
|
|
113
|
+
/**
|
|
114
|
+
* Registered-lowering seam (#2843): `emitParsedExpr`'s shared `call` case
|
|
115
|
+
* tries every matcher here BEFORE `call()` itself, so a registered call
|
|
116
|
+
* (the built-in `queryHref`, or any userland plugin) is recognised no
|
|
117
|
+
* matter where it sits in the tree. `render` is what used to live inline
|
|
118
|
+
* in `JinjaAdapter.convertExpressionToJinja` before the object-literal
|
|
119
|
+
* support-gate refusal (`checkSupport`'s `call` arm, now itself
|
|
120
|
+
* registry-aware) made the pre-gate special case unnecessary.
|
|
121
|
+
*/
|
|
122
|
+
get lowering(): LoweringEmitter;
|
|
113
123
|
identifier(name: string): string;
|
|
114
124
|
literal(value: string | number | boolean | null, literalType: LiteralType): string;
|
|
115
125
|
member(object: ParsedExpr, property: string, _computed: boolean, _optional: boolean, 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,EAEL,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAEL,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,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,CAER;IAED,UAAU,CACR,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,EACvC,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,CAER;IAED,WAAW,CACT,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,CAER;IAED,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAwB9E;IAED,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAMlD;IAED,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1B;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;IAED,aAAa,CAAC,UAAU,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAoBxG;CACF"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -187307,8 +187307,6 @@ import {
|
|
|
187307
187307
|
lookupStaticRecordLiteral,
|
|
187308
187308
|
searchParamsLocalNames,
|
|
187309
187309
|
prepareLoweringMatchers,
|
|
187310
|
-
queryHrefArgs,
|
|
187311
|
-
isValidHelperId,
|
|
187312
187310
|
sortComparatorFromArrow as sortComparatorFromArrow2,
|
|
187313
187311
|
isDangerousInnerHtmlAttr,
|
|
187314
187312
|
resolveDangerousInnerHtml,
|
|
@@ -187316,7 +187314,8 @@ import {
|
|
|
187316
187314
|
dangerousInnerHtmlDiagnostic,
|
|
187317
187315
|
resolveStaticLoopSource,
|
|
187318
187316
|
derivesScopeFromSlot,
|
|
187319
|
-
BindingScope
|
|
187317
|
+
BindingScope,
|
|
187318
|
+
buildImportAliasMap
|
|
187320
187319
|
} from "@barefootjs/jsx";
|
|
187321
187320
|
|
|
187322
187321
|
// src/adapter/boolean-result.ts
|
|
@@ -187690,7 +187689,9 @@ import {
|
|
|
187690
187689
|
groupObjectLiteralSegments,
|
|
187691
187690
|
identifierPath,
|
|
187692
187691
|
matchSearchParamsMethodCall,
|
|
187693
|
-
sortComparatorFromArrow
|
|
187692
|
+
sortComparatorFromArrow,
|
|
187693
|
+
queryHrefArgs,
|
|
187694
|
+
isValidHelperId
|
|
187694
187695
|
} from "@barefootjs/jsx";
|
|
187695
187696
|
var PREDICATE_METHODS = new Set([
|
|
187696
187697
|
"filter",
|
|
@@ -187819,6 +187820,21 @@ class JinjaTopLevelEmitter {
|
|
|
187819
187820
|
constructor(ctx) {
|
|
187820
187821
|
this.ctx = ctx;
|
|
187821
187822
|
}
|
|
187823
|
+
get lowering() {
|
|
187824
|
+
return {
|
|
187825
|
+
matchers: this.ctx._loweringMatchers,
|
|
187826
|
+
render: (node, emit) => {
|
|
187827
|
+
if (node.kind === "guard-list" && node.helper === "query") {
|
|
187828
|
+
const qArgs = queryHrefArgs(node, emit);
|
|
187829
|
+
return `bf.query(${qArgs.join(", ")})`;
|
|
187830
|
+
}
|
|
187831
|
+
if (node.kind === "helper-call" && isValidHelperId(node.helper)) {
|
|
187832
|
+
return `bf.${node.helper}(${node.args.map(emit).join(", ")})`;
|
|
187833
|
+
}
|
|
187834
|
+
return null;
|
|
187835
|
+
}
|
|
187836
|
+
};
|
|
187837
|
+
}
|
|
187822
187838
|
identifier(name) {
|
|
187823
187839
|
if (name === "undefined" || name === "null")
|
|
187824
187840
|
return "none";
|
|
@@ -188302,6 +188318,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188302
188318
|
localConstants = [];
|
|
188303
188319
|
scope = BindingScope.EMPTY;
|
|
188304
188320
|
nullableOptionalProps = new Set;
|
|
188321
|
+
importAliases = new Map;
|
|
188305
188322
|
constructor(options = {}) {
|
|
188306
188323
|
super();
|
|
188307
188324
|
this.options = {
|
|
@@ -188322,6 +188339,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188322
188339
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
188323
188340
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188324
188341
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188342
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188325
188343
|
this.errors = [];
|
|
188326
188344
|
this.childrenCaptureCounter = 0;
|
|
188327
188345
|
if (!options?.siblingTemplatesRegistered) {
|
|
@@ -188799,7 +188817,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
188799
188817
|
childrenCaptureCounter = 0;
|
|
188800
188818
|
presenceVarCounter = 0;
|
|
188801
188819
|
toTemplateName(componentName) {
|
|
188802
|
-
|
|
188820
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
188821
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
188803
188822
|
}
|
|
188804
188823
|
renderIfStatement(ifStmt) {
|
|
188805
188824
|
const condition = this.convertConditionToJinja(ifStmt.condition);
|
|
@@ -188878,8 +188897,8 @@ ${body}
|
|
|
188878
188897
|
{
|
|
188879
188898
|
const m = this.parseUndefinedAlternateTernary(value.expr);
|
|
188880
188899
|
if (m) {
|
|
188881
|
-
const cond = this.convertConditionToJinja(m.condition);
|
|
188882
|
-
const val = this.convertExpressionToJinja(m.consequent);
|
|
188900
|
+
const cond = this.convertConditionToJinja(m.condition, m.testParsed);
|
|
188901
|
+
const val = this.convertExpressionToJinja(m.consequent, m.consequentParsed);
|
|
188883
188902
|
return `
|
|
188884
188903
|
{% if ${cond} %}
|
|
188885
188904
|
${name}="{{ bf.string(${val}) }}"
|
|
@@ -189012,7 +189031,7 @@ ${name}="{{ bf.string(${val}) }}"
|
|
|
189012
189031
|
if (!startsAsObjectLiteral && !hasTaggedTemplate)
|
|
189013
189032
|
return false;
|
|
189014
189033
|
const parsed = parseExpression2(expr.trim());
|
|
189015
|
-
const support = isSupported(parsed);
|
|
189034
|
+
const support = isSupported(parsed, { loweringMatchers: this._loweringMatchers });
|
|
189016
189035
|
if (parsed.kind !== "unsupported" && support.supported)
|
|
189017
189036
|
return false;
|
|
189018
189037
|
const reason = support.reason ?? (parsed.kind === "unsupported" ? parsed.reason : undefined);
|
|
@@ -189032,6 +189051,7 @@ ${reason}` : "";
|
|
|
189032
189051
|
get emitCtx() {
|
|
189033
189052
|
return {
|
|
189034
189053
|
_searchParamsLocals: this._searchParamsLocals,
|
|
189054
|
+
_loweringMatchers: this._loweringMatchers,
|
|
189035
189055
|
_resolveModuleStringConst: (name) => this._resolveModuleStringConst(name),
|
|
189036
189056
|
_resolveLiteralConst: (name) => this._resolveLiteralConst(name),
|
|
189037
189057
|
_resolveStaticRecordLiteral: (o, k) => this._resolveStaticRecordLiteral(o, k),
|
|
@@ -189065,20 +189085,8 @@ ${reason}` : "";
|
|
|
189065
189085
|
return "''";
|
|
189066
189086
|
parsed = parseExpression2(trimmed);
|
|
189067
189087
|
}
|
|
189068
|
-
|
|
189069
|
-
|
|
189070
|
-
const node = matcher(parsed.callee, parsed.args);
|
|
189071
|
-
if (node?.kind === "guard-list" && node.helper === "query") {
|
|
189072
|
-
const qArgs = queryHrefArgs(node, (n) => this.renderParsedExprToJinja(n));
|
|
189073
|
-
return `bf.query(${qArgs.join(", ")})`;
|
|
189074
|
-
}
|
|
189075
|
-
if (node?.kind === "helper-call" && isValidHelperId(node.helper)) {
|
|
189076
|
-
const argsX = node.args.map((a) => this.renderParsedExprToJinja(a));
|
|
189077
|
-
return `bf.${node.helper}(${argsX.join(", ")})`;
|
|
189078
|
-
}
|
|
189079
|
-
}
|
|
189080
|
-
}
|
|
189081
|
-
const support = pos === "value" ? isSupportedValue(parsed) : isSupported(parsed);
|
|
189088
|
+
const supportOpts = { loweringMatchers: this._loweringMatchers };
|
|
189089
|
+
const support = pos === "value" ? isSupportedValue(parsed, supportOpts) : isSupported(parsed, supportOpts);
|
|
189082
189090
|
if (!support.supported) {
|
|
189083
189091
|
this.errors.push({
|
|
189084
189092
|
code: "BF101",
|
|
@@ -189123,7 +189131,9 @@ Options:
|
|
|
189123
189131
|
return null;
|
|
189124
189132
|
return {
|
|
189125
189133
|
condition: exprToString(parsed.test),
|
|
189126
|
-
consequent: exprToString(parsed.consequent)
|
|
189134
|
+
consequent: exprToString(parsed.consequent),
|
|
189135
|
+
testParsed: parsed.test,
|
|
189136
|
+
consequentParsed: parsed.consequent
|
|
189127
189137
|
};
|
|
189128
189138
|
}
|
|
189129
189139
|
isBooleanTypedPropRef(expr) {
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
*/
|
|
90
90
|
import type { ComponentIR, IRNode, IRElement, IRText, IRExpression, IRConditional, IRLoop, IRComponent, IRFragment, IRSlot, IRIfStatement, IRProvider, IRAsync, TemplatePrimitiveRegistry } from '@barefootjs/jsx';
|
|
91
91
|
import { BaseAdapter, type AdapterOutput, type AdapterGenerateOptions, type IRNodeEmitter, type EmitIRNode } from '@barefootjs/jsx';
|
|
92
|
+
import type { ParsedExpr } from '@barefootjs/jsx';
|
|
92
93
|
import type { JinjaRenderCtx } from './lib/types.ts';
|
|
93
94
|
export type { JinjaAdapterOptions } from './lib/types.ts';
|
|
94
95
|
import type { JinjaAdapterOptions } from './lib/types.ts';
|
|
@@ -182,6 +183,17 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
|
|
|
182
183
|
* concrete-primitive props.
|
|
183
184
|
*/
|
|
184
185
|
private nullableOptionalProps;
|
|
186
|
+
/**
|
|
187
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
188
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
189
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
190
|
+
* `<Bar/>`) must build its cross-template `render_child` call against
|
|
191
|
+
* the child's own declared name (`Foo`, what `foo.tsx` registers its
|
|
192
|
+
* Jinja partial as) — never the caller-local binding. Built once per
|
|
193
|
+
* compile from `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
194
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
195
|
+
*/
|
|
196
|
+
private importAliases;
|
|
185
197
|
constructor(options?: JinjaAdapterOptions);
|
|
186
198
|
generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
|
|
187
199
|
private generateScriptRegistrations;
|
|
@@ -379,10 +391,23 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
|
|
|
379
391
|
* Parse `cond ? value : undefined` (or `: null`), returning the
|
|
380
392
|
* condition/consequent source spans, else `null`. Used for the
|
|
381
393
|
* attribute-omission rule (#1897).
|
|
394
|
+
*
|
|
395
|
+
* `testParsed`/`consequentParsed` (#2843 review) are the ACTUAL parsed
|
|
396
|
+
* sub-trees, for the caller to pass through as `preParsed` — `condition`/
|
|
397
|
+
* `consequent` are `exprToString` output, a DEBUG formatter that renders
|
|
398
|
+
* any nested `object-literal` as the non-reparseable `[UNSUPPORTED: …]`
|
|
399
|
+
* placeholder (unlike `stringifyParsedExpr`, meant for round-tripping).
|
|
400
|
+
* Re-parsing THAT string for a consequent like `queryHref(base, { tag })`
|
|
401
|
+
* would corrupt the call's args before the lowering registry — now
|
|
402
|
+
* consulted at any nesting depth (#2843) — ever sees them. Kept for any
|
|
403
|
+
* caller that only needs the string form; the parsed trees are the
|
|
404
|
+
* correct input wherever the caller can accept `preParsed`.
|
|
382
405
|
*/
|
|
383
406
|
parseUndefinedAlternateTernary(expr: string): {
|
|
384
407
|
condition: string;
|
|
385
408
|
consequent: string;
|
|
409
|
+
testParsed: ParsedExpr;
|
|
410
|
+
consequentParsed: ParsedExpr;
|
|
386
411
|
} | null;
|
|
387
412
|
isBooleanTypedPropRef(expr: string): boolean;
|
|
388
413
|
/** Position-accurate loop-bound-name check — see `this.scope`'s docstring. */
|
|
@@ -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,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,EA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AM,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,eAiE7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -187307,8 +187307,6 @@ import {
|
|
|
187307
187307
|
lookupStaticRecordLiteral,
|
|
187308
187308
|
searchParamsLocalNames,
|
|
187309
187309
|
prepareLoweringMatchers,
|
|
187310
|
-
queryHrefArgs,
|
|
187311
|
-
isValidHelperId,
|
|
187312
187310
|
sortComparatorFromArrow as sortComparatorFromArrow2,
|
|
187313
187311
|
isDangerousInnerHtmlAttr,
|
|
187314
187312
|
resolveDangerousInnerHtml,
|
|
@@ -187316,7 +187314,8 @@ import {
|
|
|
187316
187314
|
dangerousInnerHtmlDiagnostic,
|
|
187317
187315
|
resolveStaticLoopSource,
|
|
187318
187316
|
derivesScopeFromSlot,
|
|
187319
|
-
BindingScope
|
|
187317
|
+
BindingScope,
|
|
187318
|
+
buildImportAliasMap
|
|
187320
187319
|
} from "@barefootjs/jsx";
|
|
187321
187320
|
|
|
187322
187321
|
// src/adapter/boolean-result.ts
|
|
@@ -187690,7 +187689,9 @@ import {
|
|
|
187690
187689
|
groupObjectLiteralSegments,
|
|
187691
187690
|
identifierPath,
|
|
187692
187691
|
matchSearchParamsMethodCall,
|
|
187693
|
-
sortComparatorFromArrow
|
|
187692
|
+
sortComparatorFromArrow,
|
|
187693
|
+
queryHrefArgs,
|
|
187694
|
+
isValidHelperId
|
|
187694
187695
|
} from "@barefootjs/jsx";
|
|
187695
187696
|
var PREDICATE_METHODS = new Set([
|
|
187696
187697
|
"filter",
|
|
@@ -187819,6 +187820,21 @@ class JinjaTopLevelEmitter {
|
|
|
187819
187820
|
constructor(ctx) {
|
|
187820
187821
|
this.ctx = ctx;
|
|
187821
187822
|
}
|
|
187823
|
+
get lowering() {
|
|
187824
|
+
return {
|
|
187825
|
+
matchers: this.ctx._loweringMatchers,
|
|
187826
|
+
render: (node, emit) => {
|
|
187827
|
+
if (node.kind === "guard-list" && node.helper === "query") {
|
|
187828
|
+
const qArgs = queryHrefArgs(node, emit);
|
|
187829
|
+
return `bf.query(${qArgs.join(", ")})`;
|
|
187830
|
+
}
|
|
187831
|
+
if (node.kind === "helper-call" && isValidHelperId(node.helper)) {
|
|
187832
|
+
return `bf.${node.helper}(${node.args.map(emit).join(", ")})`;
|
|
187833
|
+
}
|
|
187834
|
+
return null;
|
|
187835
|
+
}
|
|
187836
|
+
};
|
|
187837
|
+
}
|
|
187822
187838
|
identifier(name) {
|
|
187823
187839
|
if (name === "undefined" || name === "null")
|
|
187824
187840
|
return "none";
|
|
@@ -188302,6 +188318,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188302
188318
|
localConstants = [];
|
|
188303
188319
|
scope = BindingScope.EMPTY;
|
|
188304
188320
|
nullableOptionalProps = new Set;
|
|
188321
|
+
importAliases = new Map;
|
|
188305
188322
|
constructor(options = {}) {
|
|
188306
188323
|
super();
|
|
188307
188324
|
this.options = {
|
|
@@ -188322,6 +188339,7 @@ class JinjaAdapter extends BaseAdapter {
|
|
|
188322
188339
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
188323
188340
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188324
188341
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188342
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188325
188343
|
this.errors = [];
|
|
188326
188344
|
this.childrenCaptureCounter = 0;
|
|
188327
188345
|
if (!options?.siblingTemplatesRegistered) {
|
|
@@ -188799,7 +188817,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
188799
188817
|
childrenCaptureCounter = 0;
|
|
188800
188818
|
presenceVarCounter = 0;
|
|
188801
188819
|
toTemplateName(componentName) {
|
|
188802
|
-
|
|
188820
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
188821
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
188803
188822
|
}
|
|
188804
188823
|
renderIfStatement(ifStmt) {
|
|
188805
188824
|
const condition = this.convertConditionToJinja(ifStmt.condition);
|
|
@@ -188878,8 +188897,8 @@ ${body}
|
|
|
188878
188897
|
{
|
|
188879
188898
|
const m = this.parseUndefinedAlternateTernary(value.expr);
|
|
188880
188899
|
if (m) {
|
|
188881
|
-
const cond = this.convertConditionToJinja(m.condition);
|
|
188882
|
-
const val = this.convertExpressionToJinja(m.consequent);
|
|
188900
|
+
const cond = this.convertConditionToJinja(m.condition, m.testParsed);
|
|
188901
|
+
const val = this.convertExpressionToJinja(m.consequent, m.consequentParsed);
|
|
188883
188902
|
return `
|
|
188884
188903
|
{% if ${cond} %}
|
|
188885
188904
|
${name}="{{ bf.string(${val}) }}"
|
|
@@ -189012,7 +189031,7 @@ ${name}="{{ bf.string(${val}) }}"
|
|
|
189012
189031
|
if (!startsAsObjectLiteral && !hasTaggedTemplate)
|
|
189013
189032
|
return false;
|
|
189014
189033
|
const parsed = parseExpression2(expr.trim());
|
|
189015
|
-
const support = isSupported(parsed);
|
|
189034
|
+
const support = isSupported(parsed, { loweringMatchers: this._loweringMatchers });
|
|
189016
189035
|
if (parsed.kind !== "unsupported" && support.supported)
|
|
189017
189036
|
return false;
|
|
189018
189037
|
const reason = support.reason ?? (parsed.kind === "unsupported" ? parsed.reason : undefined);
|
|
@@ -189032,6 +189051,7 @@ ${reason}` : "";
|
|
|
189032
189051
|
get emitCtx() {
|
|
189033
189052
|
return {
|
|
189034
189053
|
_searchParamsLocals: this._searchParamsLocals,
|
|
189054
|
+
_loweringMatchers: this._loweringMatchers,
|
|
189035
189055
|
_resolveModuleStringConst: (name) => this._resolveModuleStringConst(name),
|
|
189036
189056
|
_resolveLiteralConst: (name) => this._resolveLiteralConst(name),
|
|
189037
189057
|
_resolveStaticRecordLiteral: (o, k) => this._resolveStaticRecordLiteral(o, k),
|
|
@@ -189065,20 +189085,8 @@ ${reason}` : "";
|
|
|
189065
189085
|
return "''";
|
|
189066
189086
|
parsed = parseExpression2(trimmed);
|
|
189067
189087
|
}
|
|
189068
|
-
|
|
189069
|
-
|
|
189070
|
-
const node = matcher(parsed.callee, parsed.args);
|
|
189071
|
-
if (node?.kind === "guard-list" && node.helper === "query") {
|
|
189072
|
-
const qArgs = queryHrefArgs(node, (n) => this.renderParsedExprToJinja(n));
|
|
189073
|
-
return `bf.query(${qArgs.join(", ")})`;
|
|
189074
|
-
}
|
|
189075
|
-
if (node?.kind === "helper-call" && isValidHelperId(node.helper)) {
|
|
189076
|
-
const argsX = node.args.map((a) => this.renderParsedExprToJinja(a));
|
|
189077
|
-
return `bf.${node.helper}(${argsX.join(", ")})`;
|
|
189078
|
-
}
|
|
189079
|
-
}
|
|
189080
|
-
}
|
|
189081
|
-
const support = pos === "value" ? isSupportedValue(parsed) : isSupported(parsed);
|
|
189088
|
+
const supportOpts = { loweringMatchers: this._loweringMatchers };
|
|
189089
|
+
const support = pos === "value" ? isSupportedValue(parsed, supportOpts) : isSupported(parsed, supportOpts);
|
|
189082
189090
|
if (!support.supported) {
|
|
189083
189091
|
this.errors.push({
|
|
189084
189092
|
code: "BF101",
|
|
@@ -189123,7 +189131,9 @@ Options:
|
|
|
189123
189131
|
return null;
|
|
189124
189132
|
return {
|
|
189125
189133
|
condition: exprToString(parsed.test),
|
|
189126
|
-
consequent: exprToString(parsed.consequent)
|
|
189134
|
+
consequent: exprToString(parsed.consequent),
|
|
189135
|
+
testParsed: parsed.test,
|
|
189136
|
+
consequentParsed: parsed.consequent
|
|
189127
189137
|
};
|
|
189128
189138
|
}
|
|
189129
189139
|
isBooleanTypedPropRef(expr) {
|
|
@@ -189230,10 +189240,13 @@ var conformancePins = {
|
|
|
189230
189240
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
189231
189241
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
189232
189242
|
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
189233
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }]
|
|
189243
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
189244
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
|
|
189234
189245
|
};
|
|
189235
189246
|
// src/render-divergences.ts
|
|
189236
|
-
var renderDivergences = {
|
|
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>` on real Jinja2 — 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
|
+
};
|
|
189237
189250
|
export {
|
|
189238
189251
|
renderDivergences,
|
|
189239
189252
|
jinjaAdapter,
|
|
@@ -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,iBAG/B,CAAA"}
|