@barefootjs/rust 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/minijinja-adapter.d.ts +14 -0
- package/dist/adapter/minijinja-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 +33 -0
- package/src/adapter/minijinja-adapter.ts +37 -43
- package/src/conformance-pins.ts +11 -0
- package/src/render-divergences.ts +4 -1
|
@@ -19,13 +19,23 @@
|
|
|
19
19
|
* genuinely needs it, so the seam documents the real cross-module coupling
|
|
20
20
|
* rather than re-exposing the whole adapter.
|
|
21
21
|
*/
|
|
22
|
-
import type { ParsedExpr, CompilerError, IRMetadata } from '@barefootjs/jsx';
|
|
22
|
+
import type { ParsedExpr, CompilerError, IRMetadata, LoweringMatcher } from '@barefootjs/jsx';
|
|
23
23
|
export interface JinjaEmitContext {
|
|
24
24
|
/**
|
|
25
25
|
* (#1922) Local binding names the request-scoped `searchParams()` env signal
|
|
26
26
|
* is imported under. Non-empty enables the env-signal method-call lowering.
|
|
27
27
|
*/
|
|
28
28
|
readonly _searchParamsLocals: Set<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Registered lowering-plugin matchers (#2057), bound to this component's
|
|
31
|
+
* metadata at init. Read by `JinjaTopLevelEmitter`'s `lowering` seam
|
|
32
|
+
* (#2843) so a registered call — the built-in `queryHref`, or any
|
|
33
|
+
* userland plugin — is recognised no matter where it sits in an
|
|
34
|
+
* expression tree (a ternary branch, a template-literal interpolation, …),
|
|
35
|
+
* not only when it's the call the adapter's own top-level conversion
|
|
36
|
+
* entry point (`convertExpressionToJinja`) is asked to lower directly.
|
|
37
|
+
*/
|
|
38
|
+
readonly _loweringMatchers: readonly LoweringMatcher[];
|
|
29
39
|
/**
|
|
30
40
|
* Inline a module-scope pure string-literal const by name as the resolved
|
|
31
41
|
* 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;;;;;;;;;;;;;;;;;;;;GAoBG;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;;;;;;;;;;;;;;;;;;;;GAoBG;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 ArrayMethod, type LiteralType, type ParsedExpr, type ObjectLiteralProperty, type FlatDepth, type TemplatePart, type LoweringEmitter } 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 `MinijinjaAdapter.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,EACL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adap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AG,MAAM,CAE5E;IAED,WAAW,CACT,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,EAAE,EAClB,IAAI,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,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAuCvG;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
|
|
@@ -187676,7 +187675,9 @@ import {
|
|
|
187676
187675
|
groupBinaryOperand,
|
|
187677
187676
|
identifierPath,
|
|
187678
187677
|
matchSearchParamsMethodCall,
|
|
187679
|
-
sortComparatorFromArrow
|
|
187678
|
+
sortComparatorFromArrow,
|
|
187679
|
+
queryHrefArgs,
|
|
187680
|
+
isValidHelperId
|
|
187680
187681
|
} from "@barefootjs/jsx";
|
|
187681
187682
|
var PREDICATE_METHODS = new Set([
|
|
187682
187683
|
"filter",
|
|
@@ -187805,6 +187806,21 @@ class JinjaTopLevelEmitter {
|
|
|
187805
187806
|
constructor(ctx) {
|
|
187806
187807
|
this.ctx = ctx;
|
|
187807
187808
|
}
|
|
187809
|
+
get lowering() {
|
|
187810
|
+
return {
|
|
187811
|
+
matchers: this.ctx._loweringMatchers,
|
|
187812
|
+
render: (node, emit) => {
|
|
187813
|
+
if (node.kind === "guard-list" && node.helper === "query") {
|
|
187814
|
+
const qArgs = queryHrefArgs(node, emit);
|
|
187815
|
+
return `bf.query(${qArgs.join(", ")})`;
|
|
187816
|
+
}
|
|
187817
|
+
if (node.kind === "helper-call" && isValidHelperId(node.helper)) {
|
|
187818
|
+
return `bf.${node.helper}(${node.args.map(emit).join(", ")})`;
|
|
187819
|
+
}
|
|
187820
|
+
return null;
|
|
187821
|
+
}
|
|
187822
|
+
};
|
|
187823
|
+
}
|
|
187808
187824
|
identifier(name) {
|
|
187809
187825
|
if (name === "undefined" || name === "null")
|
|
187810
187826
|
return "none";
|
|
@@ -188303,6 +188319,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188303
188319
|
localConstants = [];
|
|
188304
188320
|
scope = BindingScope.EMPTY;
|
|
188305
188321
|
nullableOptionalProps = new Set;
|
|
188322
|
+
importAliases = new Map;
|
|
188306
188323
|
constructor(options = {}) {
|
|
188307
188324
|
super();
|
|
188308
188325
|
this.options = {
|
|
@@ -188323,6 +188340,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188323
188340
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
188324
188341
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188325
188342
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188343
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188326
188344
|
this.errors = [];
|
|
188327
188345
|
this.childrenCaptureCounter = 0;
|
|
188328
188346
|
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.
|
|
188882
|
-
const val = this.convertExpressionToJinja(m.
|
|
188900
|
+
const cond = this.convertConditionToJinja("", m.testParsed);
|
|
188901
|
+
const val = this.convertExpressionToJinja("", 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) {
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
*/
|
|
115
115
|
import type { ComponentIR, IRNode, IRElement, IRText, IRExpression, IRConditional, IRLoop, IRComponent, IRFragment, IRSlot, IRIfStatement, IRProvider, IRAsync, TemplatePrimitiveRegistry } from '@barefootjs/jsx';
|
|
116
116
|
import { BaseAdapter, type AdapterOutput, type AdapterGenerateOptions, type IRNodeEmitter, type EmitIRNode } from '@barefootjs/jsx';
|
|
117
|
+
import type { ParsedExpr } from '@barefootjs/jsx';
|
|
117
118
|
import type { JinjaRenderCtx } from './lib/types.ts';
|
|
118
119
|
export type { MinijinjaAdapterOptions } from './lib/types.ts';
|
|
119
120
|
import type { MinijinjaAdapterOptions } from './lib/types.ts';
|
|
@@ -207,6 +208,17 @@ export declare class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitt
|
|
|
207
208
|
* concrete-primitive props.
|
|
208
209
|
*/
|
|
209
210
|
private nullableOptionalProps;
|
|
211
|
+
/**
|
|
212
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
213
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
214
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
215
|
+
* `<Bar/>`) must build its cross-template call against the child's own
|
|
216
|
+
* declared name (`Foo`, what `foo.tsx` registers its minijinja partial
|
|
217
|
+
* as) — never the caller-local binding. Built once per compile from
|
|
218
|
+
* `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
219
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
220
|
+
*/
|
|
221
|
+
private importAliases;
|
|
210
222
|
constructor(options?: MinijinjaAdapterOptions);
|
|
211
223
|
generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
|
|
212
224
|
private generateScriptRegistrations;
|
|
@@ -410,6 +422,8 @@ export declare class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitt
|
|
|
410
422
|
parseUndefinedAlternateTernary(expr: string): {
|
|
411
423
|
condition: string;
|
|
412
424
|
consequent: string;
|
|
425
|
+
testParsed: ParsedExpr;
|
|
426
|
+
consequentParsed: ParsedExpr;
|
|
413
427
|
} | null;
|
|
414
428
|
isBooleanTypedPropRef(expr: string): boolean;
|
|
415
429
|
/** Position-accurate loop-bound-name check — see `this.scope`'s docstring. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minijinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/minijinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW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;;OAIG;IACH,8BAA8B,CAC5B,IAAI,EAAE,MAAM,GACX;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,UAAU,CAAC;QAAC,gBAAgB,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI,CAmBxG;IAED,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAW3C;IAED,8EAA8E;IAC9E,OAAO,CAAC,eAAe;IAIvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IAKrB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,4BAA4B;CAGrC;AAED,eAAO,MAAM,gBAAgB,kBAAyB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,eAkE7B,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
|
|
@@ -187676,7 +187675,9 @@ import {
|
|
|
187676
187675
|
groupBinaryOperand,
|
|
187677
187676
|
identifierPath,
|
|
187678
187677
|
matchSearchParamsMethodCall,
|
|
187679
|
-
sortComparatorFromArrow
|
|
187678
|
+
sortComparatorFromArrow,
|
|
187679
|
+
queryHrefArgs,
|
|
187680
|
+
isValidHelperId
|
|
187680
187681
|
} from "@barefootjs/jsx";
|
|
187681
187682
|
var PREDICATE_METHODS = new Set([
|
|
187682
187683
|
"filter",
|
|
@@ -187805,6 +187806,21 @@ class JinjaTopLevelEmitter {
|
|
|
187805
187806
|
constructor(ctx) {
|
|
187806
187807
|
this.ctx = ctx;
|
|
187807
187808
|
}
|
|
187809
|
+
get lowering() {
|
|
187810
|
+
return {
|
|
187811
|
+
matchers: this.ctx._loweringMatchers,
|
|
187812
|
+
render: (node, emit) => {
|
|
187813
|
+
if (node.kind === "guard-list" && node.helper === "query") {
|
|
187814
|
+
const qArgs = queryHrefArgs(node, emit);
|
|
187815
|
+
return `bf.query(${qArgs.join(", ")})`;
|
|
187816
|
+
}
|
|
187817
|
+
if (node.kind === "helper-call" && isValidHelperId(node.helper)) {
|
|
187818
|
+
return `bf.${node.helper}(${node.args.map(emit).join(", ")})`;
|
|
187819
|
+
}
|
|
187820
|
+
return null;
|
|
187821
|
+
}
|
|
187822
|
+
};
|
|
187823
|
+
}
|
|
187808
187824
|
identifier(name) {
|
|
187809
187825
|
if (name === "undefined" || name === "null")
|
|
187810
187826
|
return "none";
|
|
@@ -188303,6 +188319,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188303
188319
|
localConstants = [];
|
|
188304
188320
|
scope = BindingScope.EMPTY;
|
|
188305
188321
|
nullableOptionalProps = new Set;
|
|
188322
|
+
importAliases = new Map;
|
|
188306
188323
|
constructor(options = {}) {
|
|
188307
188324
|
super();
|
|
188308
188325
|
this.options = {
|
|
@@ -188323,6 +188340,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188323
188340
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
188324
188341
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188325
188342
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188343
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188326
188344
|
this.errors = [];
|
|
188327
188345
|
this.childrenCaptureCounter = 0;
|
|
188328
188346
|
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.
|
|
188882
|
-
const val = this.convertExpressionToJinja(m.
|
|
188900
|
+
const cond = this.convertConditionToJinja("", m.testParsed);
|
|
188901
|
+
const val = this.convertExpressionToJinja("", 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>` 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
|
+
};
|
|
189237
189250
|
export {
|
|
189238
189251
|
renderDivergences,
|
|
189239
189252
|
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,iBAG/B,CAAA"}
|