@barefootjs/erb 0.18.5 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/erb-adapter.d.ts +7 -0
- package/dist/adapter/erb-adapter.d.ts.map +1 -1
- package/dist/adapter/expr/emitters.d.ts +2 -1
- package/dist/adapter/expr/emitters.d.ts.map +1 -1
- package/dist/adapter/index.js +76 -11
- package/dist/adapter/lib/static-value.d.ts +17 -0
- package/dist/adapter/lib/static-value.d.ts.map +1 -0
- package/dist/adapter/props/prop-classes.d.ts +5 -4
- package/dist/adapter/props/prop-classes.d.ts.map +1 -1
- package/dist/build.js +76 -11
- package/dist/index.js +77 -17
- package/dist/render-divergences.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/erb-adapter.test.ts +138 -0
- package/src/adapter/erb-adapter.ts +94 -12
- package/src/adapter/expr/emitters.ts +14 -1
- package/src/adapter/lib/static-value.ts +43 -0
- package/src/adapter/props/prop-classes.ts +6 -5
- package/src/conformance-pins.ts +23 -23
- package/src/render-divergences.ts +6 -1
- package/src/test-render.ts +13 -136
|
@@ -251,6 +251,13 @@ export declare class ErbAdapter extends BaseAdapter implements IRNodeEmitter<Erb
|
|
|
251
251
|
private isClientOnlyContextIdentifier;
|
|
252
252
|
emitAsync(node: IRAsync, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
253
253
|
renderElement(element: IRElement): string;
|
|
254
|
+
/**
|
|
255
|
+
* `dangerouslySetInnerHTML={{ __html: '...' }}` (#2207) — see the Blade
|
|
256
|
+
* adapter's identical helper for the full rationale. `null` means the
|
|
257
|
+
* attribute is absent (caller falls through to normal `renderChildren`);
|
|
258
|
+
* a non-`null` string (possibly `''`) replaces the children outright.
|
|
259
|
+
*/
|
|
260
|
+
private renderDangerousInnerHtml;
|
|
254
261
|
renderExpression(expr: IRExpression): string;
|
|
255
262
|
/**
|
|
256
263
|
* True when `expr` is a structural read of the `children` prop: a bare
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erb-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/erb-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAMP,yBAAyB,EAC1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"erb-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/erb-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAMP,yBAAyB,EAC1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EA8BhB,MAAM,iBAAiB,CAAA;AAKxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAoClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAoBvD,qBAAa,UAAW,SAAQ,WAAY,YAAW,aAAa,CAAC,YAAY,CAAC;IAChF,IAAI,SAAQ;IACZ,SAAS,SAAS;IAClB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c;IAStB,OAAO,CAAC,gBAAgB;IAyCxB,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAMjD;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAMD;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IA8B5B,OAAO,CAAC,iCAAiC;IAkCzC;;;;;;;OAOG;IACH,OAAO,CAAC,gCAAgC;IAmBxC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GAWlB;IAED;;;;OAIG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,uBAAuB;IA+E/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAI9B;uEACmE;IACnE,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,2BAA2B;CAGpC;AAED,eAAO,MAAM,UAAU,YAAmB,CAAA"}
|
|
@@ -39,7 +39,8 @@ export declare class ErbFilterEmitter implements ParsedExprEmitter {
|
|
|
39
39
|
private readonly isLoopBoundOuter;
|
|
40
40
|
private readonly isStringName;
|
|
41
41
|
private readonly onUnsupported?;
|
|
42
|
-
|
|
42
|
+
private readonly renderParamAs;
|
|
43
|
+
constructor(param: string, localVarMap: Map<string, string>, isLoopBoundOuter?: (n: string) => boolean, isStringName?: (n: string) => boolean, onUnsupported?: ((message: string, reason?: string) => void) | undefined, renderParamAs?: string);
|
|
43
44
|
identifier(name: string): string;
|
|
44
45
|
literal(value: string | number | boolean | null, literalType: LiteralType): string;
|
|
45
46
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,EAKlB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAwCxD,qBAAa,gBAAiB,YAAW,iBAAiB;IAEtD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAM5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAIjC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAK7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,EAKlB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAwCxD,qBAAa,gBAAiB,YAAW,iBAAiB;IAEtD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAM5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAIjC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAK7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAa/B,OAAO,CAAC,QAAQ,CAAC,aAAa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KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAOpF;IAED,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1B;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKjD;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,12 @@ 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
|
|
187312
187317
|
} from "@barefootjs/jsx";
|
|
187313
187318
|
|
|
187314
187319
|
// src/adapter/boolean-result.ts
|
|
@@ -187693,6 +187698,39 @@ function renderFlatMethod(recv, depth, emit) {
|
|
|
187693
187698
|
return `bf.flat(${recv}, ${d})`;
|
|
187694
187699
|
}
|
|
187695
187700
|
|
|
187701
|
+
// src/adapter/lib/static-value.ts
|
|
187702
|
+
function staticValueToRuby(value) {
|
|
187703
|
+
if (value === null || value === undefined)
|
|
187704
|
+
return "nil";
|
|
187705
|
+
if (typeof value === "boolean")
|
|
187706
|
+
return value ? "true" : "false";
|
|
187707
|
+
if (typeof value === "number")
|
|
187708
|
+
return String(value);
|
|
187709
|
+
if (typeof value === "string")
|
|
187710
|
+
return rubyStringLiteral(value);
|
|
187711
|
+
if (Array.isArray(value)) {
|
|
187712
|
+
const items = [];
|
|
187713
|
+
for (const el of value) {
|
|
187714
|
+
const serialized = staticValueToRuby(el);
|
|
187715
|
+
if (serialized === null)
|
|
187716
|
+
return null;
|
|
187717
|
+
items.push(serialized);
|
|
187718
|
+
}
|
|
187719
|
+
return `[${items.join(", ")}]`;
|
|
187720
|
+
}
|
|
187721
|
+
if (typeof value === "object") {
|
|
187722
|
+
const entries = [];
|
|
187723
|
+
for (const [key, val] of Object.entries(value)) {
|
|
187724
|
+
const serialized = staticValueToRuby(val);
|
|
187725
|
+
if (serialized === null)
|
|
187726
|
+
return null;
|
|
187727
|
+
entries.push(`${rubySymbolKey(key)} ${serialized}`);
|
|
187728
|
+
}
|
|
187729
|
+
return `{ ${entries.join(", ")} }`;
|
|
187730
|
+
}
|
|
187731
|
+
return null;
|
|
187732
|
+
}
|
|
187733
|
+
|
|
187696
187734
|
// src/adapter/expr/emitters.ts
|
|
187697
187735
|
import {
|
|
187698
187736
|
emitParsedExpr,
|
|
@@ -187738,16 +187776,18 @@ class ErbFilterEmitter {
|
|
|
187738
187776
|
isLoopBoundOuter;
|
|
187739
187777
|
isStringName;
|
|
187740
187778
|
onUnsupported;
|
|
187741
|
-
|
|
187779
|
+
renderParamAs;
|
|
187780
|
+
constructor(param, localVarMap, isLoopBoundOuter = () => false, isStringName = unusedIsStringName, onUnsupported, renderParamAs = rubyLocal(param)) {
|
|
187742
187781
|
this.param = param;
|
|
187743
187782
|
this.localVarMap = localVarMap;
|
|
187744
187783
|
this.isLoopBoundOuter = isLoopBoundOuter;
|
|
187745
187784
|
this.isStringName = isStringName;
|
|
187746
187785
|
this.onUnsupported = onUnsupported;
|
|
187786
|
+
this.renderParamAs = renderParamAs;
|
|
187747
187787
|
}
|
|
187748
187788
|
identifier(name) {
|
|
187749
187789
|
if (name === this.param)
|
|
187750
|
-
return
|
|
187790
|
+
return this.renderParamAs;
|
|
187751
187791
|
const signal = this.localVarMap.get(name);
|
|
187752
187792
|
if (signal)
|
|
187753
187793
|
return `v[${rubySymbolLiteral(signal)}]`;
|
|
@@ -188299,7 +188339,7 @@ function collectBooleanTypedProps(ir) {
|
|
|
188299
188339
|
return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
|
|
188300
188340
|
}
|
|
188301
188341
|
function collectNullableOptionalProps(ir) {
|
|
188302
|
-
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
|
|
188342
|
+
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
|
|
188303
188343
|
}
|
|
188304
188344
|
function collectStringValueNames(ir) {
|
|
188305
188345
|
const names = new Set;
|
|
@@ -188547,7 +188587,8 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188547
188587
|
renderElement(element) {
|
|
188548
188588
|
const tag = element.tag;
|
|
188549
188589
|
const attrs = this.renderAttributes(element);
|
|
188550
|
-
const
|
|
188590
|
+
const dangerousHtml = this.renderDangerousInnerHtml(element);
|
|
188591
|
+
const children = dangerousHtml !== null ? dangerousHtml : this.renderChildren(element.children);
|
|
188551
188592
|
let hydrationAttrs = "";
|
|
188552
188593
|
if (element.needsScope) {
|
|
188553
188594
|
hydrationAttrs += ` ${this.renderScopeMarker("")}`;
|
|
@@ -188582,6 +188623,22 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188582
188623
|
}
|
|
188583
188624
|
return `<${tag}${attrs}${hydrationAttrs}>${children}</${tag}>`;
|
|
188584
188625
|
}
|
|
188626
|
+
renderDangerousInnerHtml(element) {
|
|
188627
|
+
const resolution = resolveDangerousInnerHtml(element);
|
|
188628
|
+
if (!resolution)
|
|
188629
|
+
return null;
|
|
188630
|
+
if (resolution.kind === "dynamic") {
|
|
188631
|
+
this.errors.push(dangerousInnerHtmlDiagnostic(resolution.expr, resolution.loc));
|
|
188632
|
+
return "";
|
|
188633
|
+
}
|
|
188634
|
+
const violation = dangerousInnerHtmlMetacharViolation(resolution.html, this.name);
|
|
188635
|
+
if (violation) {
|
|
188636
|
+
const attr = element.attrs.find(isDangerousInnerHtmlAttr);
|
|
188637
|
+
this.errors.push(dangerousInnerHtmlDiagnostic(`{ __html: ${JSON.stringify(resolution.html)} }`, attr.loc, violation));
|
|
188638
|
+
return "";
|
|
188639
|
+
}
|
|
188640
|
+
return resolution.html;
|
|
188641
|
+
}
|
|
188585
188642
|
renderExpression(expr) {
|
|
188586
188643
|
if (expr.clientOnly) {
|
|
188587
188644
|
if (expr.slotId) {
|
|
@@ -188589,7 +188646,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188589
188646
|
}
|
|
188590
188647
|
return "";
|
|
188591
188648
|
}
|
|
188592
|
-
const rubyExpr = this.convertExpressionToRuby(expr.expr);
|
|
188649
|
+
const rubyExpr = this.convertExpressionToRuby(expr.expr, expr.parsed);
|
|
188593
188650
|
const wrapped = this.isChildrenValueExpr(expr) ? rubyExpr : `bf.h(${rubyExpr})`;
|
|
188594
188651
|
if (expr.slotId) {
|
|
188595
188652
|
return `<%= bf.text_start("${expr.slotId}") %><%= ${wrapped} %><%= bf.text_end %>`;
|
|
@@ -188698,7 +188755,11 @@ ${whenTrue}
|
|
|
188698
188755
|
}
|
|
188699
188756
|
});
|
|
188700
188757
|
}
|
|
188701
|
-
|
|
188758
|
+
const staticItems = resolveStaticLoopSource(loop.arrayParsed, this.localConstants, {
|
|
188759
|
+
isNameShadowed: (name) => this.loopBoundNames.has(name)
|
|
188760
|
+
});
|
|
188761
|
+
const staticArray = staticItems !== null ? staticValueToRuby(staticItems) : null;
|
|
188762
|
+
if (staticArray === null && loop.arrayParsed?.kind === "identifier") {
|
|
188702
188763
|
const arrayName = loop.arrayParsed.name;
|
|
188703
188764
|
const isUnresolvableLocalConst = !this.loopBoundNames.has(arrayName) && this.resolveModuleStringConst(arrayName) === null && this.resolveLiteralConst(arrayName) === null && this.localConstants.some((c) => c.name === arrayName && !c.isModule);
|
|
188704
188765
|
if (isUnresolvableLocalConst) {
|
|
@@ -188708,7 +188769,7 @@ ${whenTrue}
|
|
|
188708
188769
|
3. Precompute the value server-side and pass it in as a prop.`);
|
|
188709
188770
|
}
|
|
188710
188771
|
}
|
|
188711
|
-
const rawArray = this.convertExpressionToRuby(loop.array);
|
|
188772
|
+
const rawArray = staticArray ?? this.convertExpressionToRuby(loop.array);
|
|
188712
188773
|
let sortedHoist = null;
|
|
188713
188774
|
let array = rawArray;
|
|
188714
188775
|
if (loop.sortComparator) {
|
|
@@ -188788,7 +188849,9 @@ ${renderedChildren}` : renderedChildren;
|
|
|
188788
188849
|
if (loop.filterPredicate) {
|
|
188789
188850
|
let filterCond;
|
|
188790
188851
|
if (loop.filterPredicate.predicate) {
|
|
188791
|
-
|
|
188852
|
+
const filterOwnParam = loop.filterPredicate.param;
|
|
188853
|
+
const matchParam = filterOwnParam && !filterOwnParam.startsWith("[") && !filterOwnParam.startsWith("{") ? filterOwnParam : param;
|
|
188854
|
+
filterCond = this.renderRubyFilterExpr(loop.filterPredicate.predicate, matchParam, undefined, rubyLocal(param));
|
|
188792
188855
|
} else {
|
|
188793
188856
|
filterCond = "true";
|
|
188794
188857
|
}
|
|
@@ -189009,6 +189072,8 @@ ${children}`;
|
|
|
189009
189072
|
for (const attr of element.attrs) {
|
|
189010
189073
|
if (attr.clientOnly)
|
|
189011
189074
|
continue;
|
|
189075
|
+
if (isDangerousInnerHtmlAttr(attr))
|
|
189076
|
+
continue;
|
|
189012
189077
|
let attrName;
|
|
189013
189078
|
if (attr.name === "className")
|
|
189014
189079
|
attrName = "class";
|
|
@@ -189032,8 +189097,8 @@ ${children}`;
|
|
|
189032
189097
|
renderCondMarker(condId) {
|
|
189033
189098
|
return `${BF_COND}="${condId}"`;
|
|
189034
189099
|
}
|
|
189035
|
-
renderRubyFilterExpr(expr, param, localVarMap = new Map) {
|
|
189036
|
-
return emitParsedExpr2(expr, new ErbFilterEmitter(param, localVarMap, (n) => this.isLoopBoundName(n), (n) => this._isStringValueName(n), (message, reason) => this._recordExprBF101(message, reason)));
|
|
189100
|
+
renderRubyFilterExpr(expr, param, localVarMap = new Map, renderParamAs) {
|
|
189101
|
+
return emitParsedExpr2(expr, new ErbFilterEmitter(param, localVarMap, (n) => this.isLoopBoundName(n), (n) => this._isStringValueName(n), (message, reason) => this._recordExprBF101(message, reason), renderParamAs));
|
|
189037
189102
|
}
|
|
189038
189103
|
convertTemplateLiteralPartsToRuby(literalParts) {
|
|
189039
189104
|
const parts = [];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a compile-time-evaluated JS value (`@barefootjs/jsx`'s
|
|
3
|
+
* `evaluateStaticLiteral`/`resolveStaticLoopSource`, #2208) into a native
|
|
4
|
+
* Ruby literal. Used to inline a fully-static loop source (an inline array
|
|
5
|
+
* literal, or a function-scope local const with a static initializer)
|
|
6
|
+
* directly in the loop-bound expression, rather than requiring a bound
|
|
7
|
+
* template variable.
|
|
8
|
+
*
|
|
9
|
+
* Hash keys render as symbols (`label: 'Alpha'`) to match `item[:label]`,
|
|
10
|
+
* this adapter's existing member-access convention (`rubyLocal`'s
|
|
11
|
+
* companion, `rubySymbolKey`/`rubySymbolLiteral`).
|
|
12
|
+
*
|
|
13
|
+
* Returns `null` for a value this adapter can't represent as a literal —
|
|
14
|
+
* the caller falls back to its existing BF101 refusal instead of guessing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function staticValueToRuby(value: unknown): string | null;
|
|
17
|
+
//# 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;;;;;;;;;;;;;;GAcG;AAIH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAwB/D"}
|
|
@@ -26,10 +26,11 @@ export declare function collectBooleanTypedProps(ir: ComponentIR): Set<string>;
|
|
|
26
26
|
* omission). A prop WITH a destructure default (`value = ''`) is never
|
|
27
27
|
* `nil` in the body and must stay unconditional, so it is excluded. Mirrors
|
|
28
28
|
* the Go adapter's nillable-field guard: there the witness is the resolved
|
|
29
|
-
* `interface{}` field type; here it is the absence of a default.
|
|
30
|
-
* concrete-primitive
|
|
31
|
-
*
|
|
32
|
-
* fields
|
|
29
|
+
* `interface{}` field type; here it is the absence of a default. A REQUIRED
|
|
30
|
+
* concrete-primitive prop (`string`/`number`/`boolean`) is excluded — the
|
|
31
|
+
* caller always supplies it, matching the Go adapter's unconditional
|
|
32
|
+
* concrete fields — but an OPTIONAL primitive is presence-uncertain and
|
|
33
|
+
* stays guarded (#2259).
|
|
33
34
|
*/
|
|
34
35
|
export declare function collectNullableOptionalProps(ir: ComponentIR): Set<string>;
|
|
35
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED
|
|
1
|
+
{"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWpE"}
|
package/dist/build.js
CHANGED
|
@@ -187308,7 +187308,12 @@ 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
|
|
187312
187317
|
} from "@barefootjs/jsx";
|
|
187313
187318
|
|
|
187314
187319
|
// src/adapter/boolean-result.ts
|
|
@@ -187693,6 +187698,39 @@ function renderFlatMethod(recv, depth, emit) {
|
|
|
187693
187698
|
return `bf.flat(${recv}, ${d})`;
|
|
187694
187699
|
}
|
|
187695
187700
|
|
|
187701
|
+
// src/adapter/lib/static-value.ts
|
|
187702
|
+
function staticValueToRuby(value) {
|
|
187703
|
+
if (value === null || value === undefined)
|
|
187704
|
+
return "nil";
|
|
187705
|
+
if (typeof value === "boolean")
|
|
187706
|
+
return value ? "true" : "false";
|
|
187707
|
+
if (typeof value === "number")
|
|
187708
|
+
return String(value);
|
|
187709
|
+
if (typeof value === "string")
|
|
187710
|
+
return rubyStringLiteral(value);
|
|
187711
|
+
if (Array.isArray(value)) {
|
|
187712
|
+
const items = [];
|
|
187713
|
+
for (const el of value) {
|
|
187714
|
+
const serialized = staticValueToRuby(el);
|
|
187715
|
+
if (serialized === null)
|
|
187716
|
+
return null;
|
|
187717
|
+
items.push(serialized);
|
|
187718
|
+
}
|
|
187719
|
+
return `[${items.join(", ")}]`;
|
|
187720
|
+
}
|
|
187721
|
+
if (typeof value === "object") {
|
|
187722
|
+
const entries = [];
|
|
187723
|
+
for (const [key, val] of Object.entries(value)) {
|
|
187724
|
+
const serialized = staticValueToRuby(val);
|
|
187725
|
+
if (serialized === null)
|
|
187726
|
+
return null;
|
|
187727
|
+
entries.push(`${rubySymbolKey(key)} ${serialized}`);
|
|
187728
|
+
}
|
|
187729
|
+
return `{ ${entries.join(", ")} }`;
|
|
187730
|
+
}
|
|
187731
|
+
return null;
|
|
187732
|
+
}
|
|
187733
|
+
|
|
187696
187734
|
// src/adapter/expr/emitters.ts
|
|
187697
187735
|
import {
|
|
187698
187736
|
emitParsedExpr,
|
|
@@ -187738,16 +187776,18 @@ class ErbFilterEmitter {
|
|
|
187738
187776
|
isLoopBoundOuter;
|
|
187739
187777
|
isStringName;
|
|
187740
187778
|
onUnsupported;
|
|
187741
|
-
|
|
187779
|
+
renderParamAs;
|
|
187780
|
+
constructor(param, localVarMap, isLoopBoundOuter = () => false, isStringName = unusedIsStringName, onUnsupported, renderParamAs = rubyLocal(param)) {
|
|
187742
187781
|
this.param = param;
|
|
187743
187782
|
this.localVarMap = localVarMap;
|
|
187744
187783
|
this.isLoopBoundOuter = isLoopBoundOuter;
|
|
187745
187784
|
this.isStringName = isStringName;
|
|
187746
187785
|
this.onUnsupported = onUnsupported;
|
|
187786
|
+
this.renderParamAs = renderParamAs;
|
|
187747
187787
|
}
|
|
187748
187788
|
identifier(name) {
|
|
187749
187789
|
if (name === this.param)
|
|
187750
|
-
return
|
|
187790
|
+
return this.renderParamAs;
|
|
187751
187791
|
const signal = this.localVarMap.get(name);
|
|
187752
187792
|
if (signal)
|
|
187753
187793
|
return `v[${rubySymbolLiteral(signal)}]`;
|
|
@@ -188299,7 +188339,7 @@ function collectBooleanTypedProps(ir) {
|
|
|
188299
188339
|
return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
|
|
188300
188340
|
}
|
|
188301
188341
|
function collectNullableOptionalProps(ir) {
|
|
188302
|
-
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
|
|
188342
|
+
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
|
|
188303
188343
|
}
|
|
188304
188344
|
function collectStringValueNames(ir) {
|
|
188305
188345
|
const names = new Set;
|
|
@@ -188547,7 +188587,8 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188547
188587
|
renderElement(element) {
|
|
188548
188588
|
const tag = element.tag;
|
|
188549
188589
|
const attrs = this.renderAttributes(element);
|
|
188550
|
-
const
|
|
188590
|
+
const dangerousHtml = this.renderDangerousInnerHtml(element);
|
|
188591
|
+
const children = dangerousHtml !== null ? dangerousHtml : this.renderChildren(element.children);
|
|
188551
188592
|
let hydrationAttrs = "";
|
|
188552
188593
|
if (element.needsScope) {
|
|
188553
188594
|
hydrationAttrs += ` ${this.renderScopeMarker("")}`;
|
|
@@ -188582,6 +188623,22 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188582
188623
|
}
|
|
188583
188624
|
return `<${tag}${attrs}${hydrationAttrs}>${children}</${tag}>`;
|
|
188584
188625
|
}
|
|
188626
|
+
renderDangerousInnerHtml(element) {
|
|
188627
|
+
const resolution = resolveDangerousInnerHtml(element);
|
|
188628
|
+
if (!resolution)
|
|
188629
|
+
return null;
|
|
188630
|
+
if (resolution.kind === "dynamic") {
|
|
188631
|
+
this.errors.push(dangerousInnerHtmlDiagnostic(resolution.expr, resolution.loc));
|
|
188632
|
+
return "";
|
|
188633
|
+
}
|
|
188634
|
+
const violation = dangerousInnerHtmlMetacharViolation(resolution.html, this.name);
|
|
188635
|
+
if (violation) {
|
|
188636
|
+
const attr = element.attrs.find(isDangerousInnerHtmlAttr);
|
|
188637
|
+
this.errors.push(dangerousInnerHtmlDiagnostic(`{ __html: ${JSON.stringify(resolution.html)} }`, attr.loc, violation));
|
|
188638
|
+
return "";
|
|
188639
|
+
}
|
|
188640
|
+
return resolution.html;
|
|
188641
|
+
}
|
|
188585
188642
|
renderExpression(expr) {
|
|
188586
188643
|
if (expr.clientOnly) {
|
|
188587
188644
|
if (expr.slotId) {
|
|
@@ -188589,7 +188646,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188589
188646
|
}
|
|
188590
188647
|
return "";
|
|
188591
188648
|
}
|
|
188592
|
-
const rubyExpr = this.convertExpressionToRuby(expr.expr);
|
|
188649
|
+
const rubyExpr = this.convertExpressionToRuby(expr.expr, expr.parsed);
|
|
188593
188650
|
const wrapped = this.isChildrenValueExpr(expr) ? rubyExpr : `bf.h(${rubyExpr})`;
|
|
188594
188651
|
if (expr.slotId) {
|
|
188595
188652
|
return `<%= bf.text_start("${expr.slotId}") %><%= ${wrapped} %><%= bf.text_end %>`;
|
|
@@ -188698,7 +188755,11 @@ ${whenTrue}
|
|
|
188698
188755
|
}
|
|
188699
188756
|
});
|
|
188700
188757
|
}
|
|
188701
|
-
|
|
188758
|
+
const staticItems = resolveStaticLoopSource(loop.arrayParsed, this.localConstants, {
|
|
188759
|
+
isNameShadowed: (name) => this.loopBoundNames.has(name)
|
|
188760
|
+
});
|
|
188761
|
+
const staticArray = staticItems !== null ? staticValueToRuby(staticItems) : null;
|
|
188762
|
+
if (staticArray === null && loop.arrayParsed?.kind === "identifier") {
|
|
188702
188763
|
const arrayName = loop.arrayParsed.name;
|
|
188703
188764
|
const isUnresolvableLocalConst = !this.loopBoundNames.has(arrayName) && this.resolveModuleStringConst(arrayName) === null && this.resolveLiteralConst(arrayName) === null && this.localConstants.some((c) => c.name === arrayName && !c.isModule);
|
|
188704
188765
|
if (isUnresolvableLocalConst) {
|
|
@@ -188708,7 +188769,7 @@ ${whenTrue}
|
|
|
188708
188769
|
3. Precompute the value server-side and pass it in as a prop.`);
|
|
188709
188770
|
}
|
|
188710
188771
|
}
|
|
188711
|
-
const rawArray = this.convertExpressionToRuby(loop.array);
|
|
188772
|
+
const rawArray = staticArray ?? this.convertExpressionToRuby(loop.array);
|
|
188712
188773
|
let sortedHoist = null;
|
|
188713
188774
|
let array = rawArray;
|
|
188714
188775
|
if (loop.sortComparator) {
|
|
@@ -188788,7 +188849,9 @@ ${renderedChildren}` : renderedChildren;
|
|
|
188788
188849
|
if (loop.filterPredicate) {
|
|
188789
188850
|
let filterCond;
|
|
188790
188851
|
if (loop.filterPredicate.predicate) {
|
|
188791
|
-
|
|
188852
|
+
const filterOwnParam = loop.filterPredicate.param;
|
|
188853
|
+
const matchParam = filterOwnParam && !filterOwnParam.startsWith("[") && !filterOwnParam.startsWith("{") ? filterOwnParam : param;
|
|
188854
|
+
filterCond = this.renderRubyFilterExpr(loop.filterPredicate.predicate, matchParam, undefined, rubyLocal(param));
|
|
188792
188855
|
} else {
|
|
188793
188856
|
filterCond = "true";
|
|
188794
188857
|
}
|
|
@@ -189009,6 +189072,8 @@ ${children}`;
|
|
|
189009
189072
|
for (const attr of element.attrs) {
|
|
189010
189073
|
if (attr.clientOnly)
|
|
189011
189074
|
continue;
|
|
189075
|
+
if (isDangerousInnerHtmlAttr(attr))
|
|
189076
|
+
continue;
|
|
189012
189077
|
let attrName;
|
|
189013
189078
|
if (attr.name === "className")
|
|
189014
189079
|
attrName = "class";
|
|
@@ -189032,8 +189097,8 @@ ${children}`;
|
|
|
189032
189097
|
renderCondMarker(condId) {
|
|
189033
189098
|
return `${BF_COND}="${condId}"`;
|
|
189034
189099
|
}
|
|
189035
|
-
renderRubyFilterExpr(expr, param, localVarMap = new Map) {
|
|
189036
|
-
return emitParsedExpr2(expr, new ErbFilterEmitter(param, localVarMap, (n) => this.isLoopBoundName(n), (n) => this._isStringValueName(n), (message, reason) => this._recordExprBF101(message, reason)));
|
|
189100
|
+
renderRubyFilterExpr(expr, param, localVarMap = new Map, renderParamAs) {
|
|
189101
|
+
return emitParsedExpr2(expr, new ErbFilterEmitter(param, localVarMap, (n) => this.isLoopBoundName(n), (n) => this._isStringValueName(n), (message, reason) => this._recordExprBF101(message, reason), renderParamAs));
|
|
189037
189102
|
}
|
|
189038
189103
|
convertTemplateLiteralPartsToRuby(literalParts) {
|
|
189039
189104
|
const parts = [];
|