@barefootjs/xslate 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.
@@ -187308,7 +187308,13 @@ import {
187308
187308
  queryHrefArgs,
187309
187309
  isValidHelperId,
187310
187310
  sortComparatorFromArrow as sortComparatorFromArrow2,
187311
- isLowerableLoopDestructure
187311
+ isLowerableLoopDestructure,
187312
+ isDangerousInnerHtmlAttr,
187313
+ resolveDangerousInnerHtml,
187314
+ dangerousInnerHtmlMetacharViolation,
187315
+ dangerousInnerHtmlDiagnostic,
187316
+ resolveStaticLoopSource,
187317
+ collectLoopBoundNames as collectLoopBoundNames2
187312
187318
  } from "@barefootjs/jsx";
187313
187319
 
187314
187320
  // src/adapter/boolean-result.ts
@@ -187624,6 +187630,39 @@ function renderFlatMethod(recv, depth, emit) {
187624
187630
  return `$bf.flat(${recv}, ${d})`;
187625
187631
  }
187626
187632
 
187633
+ // src/adapter/lib/static-value.ts
187634
+ function staticValueToKolon(value) {
187635
+ if (value === null || value === undefined)
187636
+ return "nil";
187637
+ if (typeof value === "boolean")
187638
+ return null;
187639
+ if (typeof value === "number")
187640
+ return String(value);
187641
+ if (typeof value === "string")
187642
+ return `'${escapeKolonSingleQuoted(value)}'`;
187643
+ if (Array.isArray(value)) {
187644
+ const items = [];
187645
+ for (const el of value) {
187646
+ const serialized = staticValueToKolon(el);
187647
+ if (serialized === null)
187648
+ return null;
187649
+ items.push(serialized);
187650
+ }
187651
+ return `[${items.join(", ")}]`;
187652
+ }
187653
+ if (typeof value === "object") {
187654
+ const entries = [];
187655
+ for (const [key, val] of Object.entries(value)) {
187656
+ const serialized = staticValueToKolon(val);
187657
+ if (serialized === null)
187658
+ return null;
187659
+ entries.push(`${kolonHashKey(key)} => ${serialized}`);
187660
+ }
187661
+ return `{ ${entries.join(", ")} }`;
187662
+ }
187663
+ return null;
187664
+ }
187665
+
187627
187666
  // src/adapter/expr/emitters.ts
187628
187667
  import {
187629
187668
  groupBinaryOperand,
@@ -188167,6 +188206,9 @@ function generateDerivedMemoSeed(ctx, ir) {
188167
188206
  ` : "";
188168
188207
  }
188169
188208
 
188209
+ // src/adapter/props/prop-classes.ts
188210
+ import { collectLoopBoundNames } from "@barefootjs/jsx";
188211
+
188170
188212
  // src/adapter/value/parsed-literal.ts
188171
188213
  import { evalStringArrayJoin } from "@barefootjs/jsx";
188172
188214
  function isStringTypeInfo(type2) {
@@ -188184,7 +188226,7 @@ function collectBooleanTypedProps(ir) {
188184
188226
  return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
188185
188227
  }
188186
188228
  function collectNullableOptionalProps(ir) {
188187
- return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
188229
+ return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
188188
188230
  }
188189
188231
  function collectStringValueNames(ir) {
188190
188232
  const names = new Set;
@@ -188197,6 +188239,12 @@ function collectStringValueNames(ir) {
188197
188239
  if (isStringTypeInfo(p.type))
188198
188240
  names.add(p.name);
188199
188241
  }
188242
+ for (const c of ir.metadata.localConstants) {
188243
+ if (isStringTypeInfo(c.type ?? undefined) || isBareStringLiteral(c.value))
188244
+ names.add(c.name);
188245
+ }
188246
+ for (const bound of collectLoopBoundNames(ir))
188247
+ names.delete(bound);
188200
188248
  return names;
188201
188249
  }
188202
188250
 
@@ -188232,6 +188280,7 @@ class XslateAdapter extends BaseAdapter {
188232
188280
  _searchParamsLocals = new Set;
188233
188281
  _loweringMatchers = [];
188234
188282
  localConstants = [];
188283
+ staticLoopSourceBoundNames = new Set;
188235
188284
  nullableOptionalProps = new Set;
188236
188285
  constructor(options = {}) {
188237
188286
  super();
@@ -188247,6 +188296,7 @@ class XslateAdapter extends BaseAdapter {
188247
188296
  this.propsParams = ir.metadata.propsParams.map((p) => ({ name: p.name }));
188248
188297
  this.booleanTypedProps = collectBooleanTypedProps(ir);
188249
188298
  this.localConstants = ir.metadata.localConstants ?? [];
188299
+ this.staticLoopSourceBoundNames = collectLoopBoundNames2(ir);
188250
188300
  this.nullableOptionalProps = collectNullableOptionalProps(ir);
188251
188301
  this.stringValueNames = collectStringValueNames(ir);
188252
188302
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
@@ -188363,7 +188413,8 @@ class XslateAdapter extends BaseAdapter {
188363
188413
  renderElement(element) {
188364
188414
  const tag = element.tag;
188365
188415
  const attrs = this.renderAttributes(element);
188366
- const children = this.renderChildren(element.children);
188416
+ const dangerousHtml = this.renderDangerousInnerHtml(element);
188417
+ const children = dangerousHtml !== null ? dangerousHtml : this.renderChildren(element.children);
188367
188418
  let hydrationAttrs = "";
188368
188419
  if (element.needsScope) {
188369
188420
  hydrationAttrs += ` ${this.renderScopeMarker("")}`;
@@ -188398,6 +188449,22 @@ class XslateAdapter extends BaseAdapter {
188398
188449
  }
188399
188450
  return `<${tag}${attrs}${hydrationAttrs}>${children}</${tag}>`;
188400
188451
  }
188452
+ renderDangerousInnerHtml(element) {
188453
+ const resolution = resolveDangerousInnerHtml(element);
188454
+ if (!resolution)
188455
+ return null;
188456
+ if (resolution.kind === "dynamic") {
188457
+ this.errors.push(dangerousInnerHtmlDiagnostic(resolution.expr, resolution.loc));
188458
+ return "";
188459
+ }
188460
+ const violation = dangerousInnerHtmlMetacharViolation(resolution.html, this.name);
188461
+ if (violation) {
188462
+ const attr = element.attrs.find(isDangerousInnerHtmlAttr);
188463
+ this.errors.push(dangerousInnerHtmlDiagnostic(`{ __html: ${JSON.stringify(resolution.html)} }`, attr.loc, violation));
188464
+ return "";
188465
+ }
188466
+ return resolution.html;
188467
+ }
188401
188468
  renderExpression(expr) {
188402
188469
  if (expr.clientOnly) {
188403
188470
  if (expr.slotId) {
@@ -188405,7 +188472,7 @@ class XslateAdapter extends BaseAdapter {
188405
188472
  }
188406
188473
  return "";
188407
188474
  }
188408
- const perlExpr = this.convertExpressionToKolon(expr.expr);
188475
+ const perlExpr = this.convertExpressionToKolon(expr.expr, expr.parsed);
188409
188476
  if (expr.slotId) {
188410
188477
  return `<: $bf.text_start("${expr.slotId}") | mark_raw :><: ${perlExpr} :><: $bf.text_end() | mark_raw :>`;
188411
188478
  }
@@ -188497,8 +188564,12 @@ ${whenTrue}
188497
188564
  }
188498
188565
  });
188499
188566
  }
188567
+ const staticItems = resolveStaticLoopSource(loop.arrayParsed, this.localConstants, {
188568
+ isNameShadowed: (name) => this.staticLoopSourceBoundNames.has(name)
188569
+ });
188570
+ const staticArray = staticItems !== null ? staticValueToKolon(staticItems) : null;
188500
188571
  const arrayName = loop.array.trim();
188501
- if (/^[A-Za-z_$][\w$]*$/.test(arrayName)) {
188572
+ if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
188502
188573
  const arrayConst = (this.localConstants ?? []).find((c) => c.name === arrayName);
188503
188574
  if (arrayConst && !arrayConst.isModule && this._resolveLiteralConst(arrayName) === null) {
188504
188575
  this.errors.push({
@@ -188512,7 +188583,7 @@ ${whenTrue}
188512
188583
  });
188513
188584
  }
188514
188585
  }
188515
- const rawArray = this.convertExpressionToKolon(loop.array);
188586
+ const rawArray = staticArray ?? this.convertExpressionToKolon(loop.array);
188516
188587
  let array = rawArray;
188517
188588
  if (loop.sortComparator) {
188518
188589
  const sort = loop.sortComparator;
@@ -188825,6 +188896,8 @@ ${name}="<: ${val} :>"
188825
188896
  for (const attr of element.attrs) {
188826
188897
  if (attr.clientOnly)
188827
188898
  continue;
188899
+ if (isDangerousInnerHtmlAttr(attr))
188900
+ continue;
188828
188901
  let attrName;
188829
188902
  if (attr.name === "className")
188830
188903
  attrName = "class";
@@ -189008,6 +189081,8 @@ Options:
189008
189081
  return this.booleanTypedProps.has(bare);
189009
189082
  }
189010
189083
  _resolveLiteralConst(name) {
189084
+ if (this.staticLoopSourceBoundNames.has(name))
189085
+ return null;
189011
189086
  const c = (this.localConstants ?? []).find((lc) => lc.name === name);
189012
189087
  if (c?.value === undefined)
189013
189088
  return null;
@@ -189020,6 +189095,8 @@ Options:
189020
189095
  return null;
189021
189096
  }
189022
189097
  _resolveStaticRecordLiteral(objectName, key) {
189098
+ if (this.staticLoopSourceBoundNames.has(objectName))
189099
+ return null;
189023
189100
  const hit = lookupStaticRecordLiteral(objectName, key, this.localConstants);
189024
189101
  if (!hit)
189025
189102
  return null;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Serialize a compile-time-evaluated JS value (`@barefootjs/jsx`'s
3
+ * `evaluateStaticLiteral`/`resolveStaticLoopSource`, #2208) into a native
4
+ * Text::Xslate (Kolon) literal. Used to inline a fully-static loop source
5
+ * (an inline array literal, or a function-scope local const with a static
6
+ * initializer) directly in a `for EXPR -> $item { ... }` header, rather
7
+ * than requiring a bound template variable.
8
+ *
9
+ * Booleans deliberately return `null` (defer to the caller's BF101
10
+ * refusal) rather than baking a `1`/absent-value stand-in — Kolon has no
11
+ * native boolean literal in this position, and guessing one would diverge
12
+ * from JS's `String(true) === "true"` at render.
13
+ *
14
+ * Returns `null` for a value this adapter can't represent as a literal —
15
+ * the caller falls back to its existing BF101 refusal instead of guessing.
16
+ */
17
+ export declare function staticValueToKolon(value: unknown): string | null;
18
+ //# 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;;;;;;;;;;;;;;;GAeG;AAIH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAwBhE"}
@@ -6,7 +6,7 @@
6
6
  * prop/name sets the adapter consults during lowering. Mirror of the Go
7
7
  * adapter's `props/prop-types.ts`. No adapter instance state.
8
8
  */
9
- import type { ComponentIR } from '@barefootjs/jsx';
9
+ import { type ComponentIR } from '@barefootjs/jsx';
10
10
  /**
11
11
  * Props whose declared TS type is boolean — a bare binding of one
12
12
  * (`data-active={props.isActive}`) must stringify as JS `String(boolean)`
@@ -15,18 +15,37 @@ import type { ComponentIR } from '@barefootjs/jsx';
15
15
  */
16
16
  export declare function collectBooleanTypedProps(ir: ComponentIR): Set<string>;
17
17
  /**
18
- * Bare references to optional, no-default, non-primitive props (e.g.
19
- * textarea's `rows`) are `undef` when omitted → `defined`-guarded in
18
+ * Bare references to presence-uncertain no-default props (non-primitive
19
+ * typed OR declared optional, #2259 — e.g. textarea's `rows`) are
20
+ * `undef` when omitted → `defined`-guarded in
20
21
  * `emitExpression`. See the `nullableOptionalProps` field docstring.
21
22
  */
22
23
  export declare function collectNullableOptionalProps(ir: ComponentIR): Set<string>;
23
24
  /**
24
- * String-typed signals and props. A signal is string-typed when its inferred
25
- * type is `string` (or, defensively, when its initial value is a bare string
26
- * literal); a prop when its annotated type is `string`. In the Mojo adapter
27
- * this drives `eq`/`ne` selection for string equality; the Kolon emitters
28
- * don't consume the distinction (Kolon's `==`/`!=` compare strings and numbers
29
- * correctly), so this set is carried for parity with the Mojo adapter.
25
+ * String-typed signals, props, and same-file local consts (#2212). A
26
+ * signal is string-typed when its inferred type is `string` (or,
27
+ * defensively, when its initial value is a bare string literal); a prop
28
+ * when its annotated type is `string`; a local const the same way. Consumed
29
+ * by `isStringConcatBinary`/`isStringTypedOperand` (`@barefootjs/jsx`) to
30
+ * pick Kolon's `~` over JS `+`'s numeric fallback (#2163, #2212)
31
+ * including now for a bare identifier operand, not just a prop/getter/
32
+ * literal. In the Mojo adapter this ALSO drives `eq`/`ne` selection for
33
+ * string equality; the Kolon emitters don't consume that distinction
34
+ * (Kolon's `==`/`!=` compare strings and numbers correctly), so that half
35
+ * of this set is carried only for parity with the Mojo adapter.
36
+ *
37
+ * Excludes any name bound as a `.map()`/`.filter()` loop callback's item
38
+ * or index parameter ANYWHERE in the component (Fable review, #2212): the
39
+ * lookup below is a flat, scope-blind `Set<string>` with no notion of a
40
+ * loop param shadowing an outer string-typed binding of the same name
41
+ * (`items.map((name) => 1 + name)` inside a component that also has a
42
+ * string `name` prop) — left unguarded, that shadowed `name` would be
43
+ * misdetected as string-typed and `1 + name` would silently lower to `~`
44
+ * instead of staying numeric `+`. Subtracting loop-bound names is coarse
45
+ * (it also suppresses a genuinely non-shadowed same-named string
46
+ * elsewhere in the component) but safe: the suppressed case just falls
47
+ * back to today's numeric `+` — the same, already-accepted residual as an
48
+ * unresolvable operand — never silently-wrong output.
30
49
  */
31
50
  export declare function collectStringValueNames(ir: ComponentIR): Set<string>;
32
51
  //# sourceMappingURL=prop-classes.d.ts.map
@@ -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;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWzE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWpE"}
1
+ {"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGzE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAepE"}
@@ -104,6 +104,16 @@ export declare class XslateAdapter extends BaseAdapter implements IRNodeEmitter<
104
104
  * const (`const sizeAttrs = size ? {…} : {}`) to its initializer text.
105
105
  */
106
106
  private localConstants;
107
+ /**
108
+ * Every name a `.map()`/`.filter()` loop callback binds as its item/index
109
+ * parameter anywhere in the component (#2208 fable review). A static
110
+ * loop-SOURCE name (e.g. a function-scope `const items = [...]`) must
111
+ * never resolve through `resolveStaticLoopSource` at a use site where a
112
+ * DIFFERENT, enclosing loop's own callback param shadows it — same
113
+ * shadowing hazard, and same coarse-but-safe mitigation, as #2212's
114
+ * `collectLoopBoundNames` use in `collectStringValueNames`.
115
+ */
116
+ private staticLoopSourceBoundNames;
107
117
  /**
108
118
  * Optional, no-default props that are `undef` when the caller omits them.
109
119
  * Their bare-reference attribute emission is guarded with Kolon `defined` so
@@ -154,6 +164,13 @@ export declare class XslateAdapter extends BaseAdapter implements IRNodeEmitter<
154
164
  private providerObjectLiteralKolon;
155
165
  emitAsync(node: IRAsync, _ctx: XslateRenderCtx, _emit: EmitIRNode<XslateRenderCtx>): string;
156
166
  renderElement(element: IRElement): string;
167
+ /**
168
+ * `dangerouslySetInnerHTML={{ __html: '...' }}` (#2207) — see the Blade
169
+ * adapter's identical helper for the full rationale. `null` means the
170
+ * attribute is absent (caller falls through to normal `renderChildren`);
171
+ * a non-`null` string (possibly `''`) replaces the children outright.
172
+ */
173
+ private renderDangerousInnerHtml;
157
174
  renderExpression(expr: IRExpression): string;
158
175
  renderConditional(cond: IRConditional): string;
159
176
  private renderNodeOrNull;
@@ -311,8 +328,32 @@ export declare class XslateAdapter extends BaseAdapter implements IRNodeEmitter<
311
328
  * single-quoted string literal (`const totalPages = 5`, #1897
312
329
  * pagination) — function-scope consts never reach the per-render
313
330
  * stash, so a bare `$totalPages` renders empty.
331
+ *
332
+ * The lookup is a flat name match with no notion of AST scope, so a
333
+ * name that any loop callback binds as its item/index param never
334
+ * inlines (#2221) — the occurrence may be the loop's own (shadowing)
335
+ * binding, and substituting the outer const's value there renders every
336
+ * iteration with the same hard-coded literal. Coarse (a genuinely
337
+ * non-shadowed same-named const elsewhere in the component also stops
338
+ * inlining, falling back to the bare identifier) but safe — the same
339
+ * trade-off as #2212's `collectLoopBoundNames` use in
340
+ * `collectStringValueNames`.
314
341
  */
315
342
  private _resolveLiteralConst;
343
+ /**
344
+ * Resolve `IDENT.key` where `IDENT` is a module-scope object-literal const
345
+ * (`variantClasses.ghost`, #1896/#1897) to the looked-up scalar.
346
+ *
347
+ * The lookup is a flat name match on `objectName` with no notion of AST
348
+ * scope, so an enclosing loop callback's own param of the same name
349
+ * (`.map((cfg) => <li>{cfg.x}</li>)` shadowing a module `const cfg = {…}`)
350
+ * still resolved to the OUTER const's member value at every iteration
351
+ * (#2237) — the sibling hazard to #2221's `_resolveLiteralConst`. Same
352
+ * coarse-but-safe `staticLoopSourceBoundNames` guard: any name a loop
353
+ * binds anywhere in the component never inlines, falling back to the bare
354
+ * `$cfg.x` member expression (which an Xslate `: for` loop binds
355
+ * correctly at the shadowed occurrences).
356
+ */
316
357
  private _resolveStaticRecordLiteral;
317
358
  private _resolveModuleStringConst;
318
359
  private _recordExprBF101;
@@ -1 +1 @@
1
- {"version":3,"file":"xslate-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/xslate-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aA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;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,kCAAkC;IAwB1C;;;;OAIG;IACH,OAAO,CAAC,iCAAiC;IAmBzC;;;;;OAKG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GAUlB;IAED;;;;;OAKG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,wBAAwB;IAyEhC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAI/B;oEACgE;IAChE,OAAO,CAAC,kBAAkB;IAI1B;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;OAIG;IACH,8BAA8B,CAC5B,IAAI,EAAE,MAAM,GACX;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAgBlD;IAED,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO3C;IAED;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,4BAA4B;CAGrC;AAED,eAAO,MAAM,aAAa,eAAsB,CAAA"}
1
+ {"version":3,"file":"xslate-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/xslate-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,K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MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAMD;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,kCAAkC;IAwB1C;;;;OAIG;IACH,OAAO,CAAC,iCAAiC;IAmBzC;;;;;OAKG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GAUlB;IAED;;;;;OAKG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,wBAAwB;IAyEhC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAI/B;oEACgE;IAChE,OAAO,CAAC,kBAAkB;IAI1B;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;OAIG;IACH,8BAA8B,CAC5B,IAAI,EAAE,MAAM,GACX;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAgBlD;IAED,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO3C;IAED;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,4BAA4B;CAGrC;AAED,eAAO,MAAM,aAAa,eAAsB,CAAA"}
package/dist/build.js CHANGED
@@ -187308,7 +187308,13 @@ import {
187308
187308
  queryHrefArgs,
187309
187309
  isValidHelperId,
187310
187310
  sortComparatorFromArrow as sortComparatorFromArrow2,
187311
- isLowerableLoopDestructure
187311
+ isLowerableLoopDestructure,
187312
+ isDangerousInnerHtmlAttr,
187313
+ resolveDangerousInnerHtml,
187314
+ dangerousInnerHtmlMetacharViolation,
187315
+ dangerousInnerHtmlDiagnostic,
187316
+ resolveStaticLoopSource,
187317
+ collectLoopBoundNames as collectLoopBoundNames2
187312
187318
  } from "@barefootjs/jsx";
187313
187319
 
187314
187320
  // src/adapter/boolean-result.ts
@@ -187624,6 +187630,39 @@ function renderFlatMethod(recv, depth, emit) {
187624
187630
  return `$bf.flat(${recv}, ${d})`;
187625
187631
  }
187626
187632
 
187633
+ // src/adapter/lib/static-value.ts
187634
+ function staticValueToKolon(value) {
187635
+ if (value === null || value === undefined)
187636
+ return "nil";
187637
+ if (typeof value === "boolean")
187638
+ return null;
187639
+ if (typeof value === "number")
187640
+ return String(value);
187641
+ if (typeof value === "string")
187642
+ return `'${escapeKolonSingleQuoted(value)}'`;
187643
+ if (Array.isArray(value)) {
187644
+ const items = [];
187645
+ for (const el of value) {
187646
+ const serialized = staticValueToKolon(el);
187647
+ if (serialized === null)
187648
+ return null;
187649
+ items.push(serialized);
187650
+ }
187651
+ return `[${items.join(", ")}]`;
187652
+ }
187653
+ if (typeof value === "object") {
187654
+ const entries = [];
187655
+ for (const [key, val] of Object.entries(value)) {
187656
+ const serialized = staticValueToKolon(val);
187657
+ if (serialized === null)
187658
+ return null;
187659
+ entries.push(`${kolonHashKey(key)} => ${serialized}`);
187660
+ }
187661
+ return `{ ${entries.join(", ")} }`;
187662
+ }
187663
+ return null;
187664
+ }
187665
+
187627
187666
  // src/adapter/expr/emitters.ts
187628
187667
  import {
187629
187668
  groupBinaryOperand,
@@ -188167,6 +188206,9 @@ function generateDerivedMemoSeed(ctx, ir) {
188167
188206
  ` : "";
188168
188207
  }
188169
188208
 
188209
+ // src/adapter/props/prop-classes.ts
188210
+ import { collectLoopBoundNames } from "@barefootjs/jsx";
188211
+
188170
188212
  // src/adapter/value/parsed-literal.ts
188171
188213
  import { evalStringArrayJoin } from "@barefootjs/jsx";
188172
188214
  function isStringTypeInfo(type2) {
@@ -188184,7 +188226,7 @@ function collectBooleanTypedProps(ir) {
188184
188226
  return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
188185
188227
  }
188186
188228
  function collectNullableOptionalProps(ir) {
188187
- return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
188229
+ return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
188188
188230
  }
188189
188231
  function collectStringValueNames(ir) {
188190
188232
  const names = new Set;
@@ -188197,6 +188239,12 @@ function collectStringValueNames(ir) {
188197
188239
  if (isStringTypeInfo(p.type))
188198
188240
  names.add(p.name);
188199
188241
  }
188242
+ for (const c of ir.metadata.localConstants) {
188243
+ if (isStringTypeInfo(c.type ?? undefined) || isBareStringLiteral(c.value))
188244
+ names.add(c.name);
188245
+ }
188246
+ for (const bound of collectLoopBoundNames(ir))
188247
+ names.delete(bound);
188200
188248
  return names;
188201
188249
  }
188202
188250
 
@@ -188232,6 +188280,7 @@ class XslateAdapter extends BaseAdapter {
188232
188280
  _searchParamsLocals = new Set;
188233
188281
  _loweringMatchers = [];
188234
188282
  localConstants = [];
188283
+ staticLoopSourceBoundNames = new Set;
188235
188284
  nullableOptionalProps = new Set;
188236
188285
  constructor(options = {}) {
188237
188286
  super();
@@ -188247,6 +188296,7 @@ class XslateAdapter extends BaseAdapter {
188247
188296
  this.propsParams = ir.metadata.propsParams.map((p) => ({ name: p.name }));
188248
188297
  this.booleanTypedProps = collectBooleanTypedProps(ir);
188249
188298
  this.localConstants = ir.metadata.localConstants ?? [];
188299
+ this.staticLoopSourceBoundNames = collectLoopBoundNames2(ir);
188250
188300
  this.nullableOptionalProps = collectNullableOptionalProps(ir);
188251
188301
  this.stringValueNames = collectStringValueNames(ir);
188252
188302
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
@@ -188363,7 +188413,8 @@ class XslateAdapter extends BaseAdapter {
188363
188413
  renderElement(element) {
188364
188414
  const tag = element.tag;
188365
188415
  const attrs = this.renderAttributes(element);
188366
- const children = this.renderChildren(element.children);
188416
+ const dangerousHtml = this.renderDangerousInnerHtml(element);
188417
+ const children = dangerousHtml !== null ? dangerousHtml : this.renderChildren(element.children);
188367
188418
  let hydrationAttrs = "";
188368
188419
  if (element.needsScope) {
188369
188420
  hydrationAttrs += ` ${this.renderScopeMarker("")}`;
@@ -188398,6 +188449,22 @@ class XslateAdapter extends BaseAdapter {
188398
188449
  }
188399
188450
  return `<${tag}${attrs}${hydrationAttrs}>${children}</${tag}>`;
188400
188451
  }
188452
+ renderDangerousInnerHtml(element) {
188453
+ const resolution = resolveDangerousInnerHtml(element);
188454
+ if (!resolution)
188455
+ return null;
188456
+ if (resolution.kind === "dynamic") {
188457
+ this.errors.push(dangerousInnerHtmlDiagnostic(resolution.expr, resolution.loc));
188458
+ return "";
188459
+ }
188460
+ const violation = dangerousInnerHtmlMetacharViolation(resolution.html, this.name);
188461
+ if (violation) {
188462
+ const attr = element.attrs.find(isDangerousInnerHtmlAttr);
188463
+ this.errors.push(dangerousInnerHtmlDiagnostic(`{ __html: ${JSON.stringify(resolution.html)} }`, attr.loc, violation));
188464
+ return "";
188465
+ }
188466
+ return resolution.html;
188467
+ }
188401
188468
  renderExpression(expr) {
188402
188469
  if (expr.clientOnly) {
188403
188470
  if (expr.slotId) {
@@ -188405,7 +188472,7 @@ class XslateAdapter extends BaseAdapter {
188405
188472
  }
188406
188473
  return "";
188407
188474
  }
188408
- const perlExpr = this.convertExpressionToKolon(expr.expr);
188475
+ const perlExpr = this.convertExpressionToKolon(expr.expr, expr.parsed);
188409
188476
  if (expr.slotId) {
188410
188477
  return `<: $bf.text_start("${expr.slotId}") | mark_raw :><: ${perlExpr} :><: $bf.text_end() | mark_raw :>`;
188411
188478
  }
@@ -188497,8 +188564,12 @@ ${whenTrue}
188497
188564
  }
188498
188565
  });
188499
188566
  }
188567
+ const staticItems = resolveStaticLoopSource(loop.arrayParsed, this.localConstants, {
188568
+ isNameShadowed: (name) => this.staticLoopSourceBoundNames.has(name)
188569
+ });
188570
+ const staticArray = staticItems !== null ? staticValueToKolon(staticItems) : null;
188500
188571
  const arrayName = loop.array.trim();
188501
- if (/^[A-Za-z_$][\w$]*$/.test(arrayName)) {
188572
+ if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
188502
188573
  const arrayConst = (this.localConstants ?? []).find((c) => c.name === arrayName);
188503
188574
  if (arrayConst && !arrayConst.isModule && this._resolveLiteralConst(arrayName) === null) {
188504
188575
  this.errors.push({
@@ -188512,7 +188583,7 @@ ${whenTrue}
188512
188583
  });
188513
188584
  }
188514
188585
  }
188515
- const rawArray = this.convertExpressionToKolon(loop.array);
188586
+ const rawArray = staticArray ?? this.convertExpressionToKolon(loop.array);
188516
188587
  let array = rawArray;
188517
188588
  if (loop.sortComparator) {
188518
188589
  const sort = loop.sortComparator;
@@ -188825,6 +188896,8 @@ ${name}="<: ${val} :>"
188825
188896
  for (const attr of element.attrs) {
188826
188897
  if (attr.clientOnly)
188827
188898
  continue;
188899
+ if (isDangerousInnerHtmlAttr(attr))
188900
+ continue;
188828
188901
  let attrName;
188829
188902
  if (attr.name === "className")
188830
188903
  attrName = "class";
@@ -189008,6 +189081,8 @@ Options:
189008
189081
  return this.booleanTypedProps.has(bare);
189009
189082
  }
189010
189083
  _resolveLiteralConst(name) {
189084
+ if (this.staticLoopSourceBoundNames.has(name))
189085
+ return null;
189011
189086
  const c = (this.localConstants ?? []).find((lc) => lc.name === name);
189012
189087
  if (c?.value === undefined)
189013
189088
  return null;
@@ -189020,6 +189095,8 @@ Options:
189020
189095
  return null;
189021
189096
  }
189022
189097
  _resolveStaticRecordLiteral(objectName, key) {
189098
+ if (this.staticLoopSourceBoundNames.has(objectName))
189099
+ return null;
189023
189100
  const hit = lookupStaticRecordLiteral(objectName, key, this.localConstants);
189024
189101
  if (!hit)
189025
189102
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eA2G7B,CAAA"}
1
+ {"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAyG7B,CAAA"}