@barefootjs/jsx 0.39.5 → 0.39.6

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.
Files changed (57) hide show
  1. package/dist/adapters/array-method.d.ts +93 -0
  2. package/dist/adapters/array-method.d.ts.map +1 -0
  3. package/dist/adapters/attr-plan.d.ts +135 -0
  4. package/dist/adapters/attr-plan.d.ts.map +1 -0
  5. package/dist/adapters/boolean-result.d.ts +84 -9
  6. package/dist/adapters/boolean-result.d.ts.map +1 -1
  7. package/dist/adapters/callback-method.d.ts +126 -0
  8. package/dist/adapters/callback-method.d.ts.map +1 -0
  9. package/dist/adapters/component-props.d.ts +99 -0
  10. package/dist/adapters/component-props.d.ts.map +1 -0
  11. package/dist/adapters/component-tree.d.ts +25 -0
  12. package/dist/adapters/component-tree.d.ts.map +1 -0
  13. package/dist/adapters/literal-value.d.ts +22 -0
  14. package/dist/adapters/literal-value.d.ts.map +1 -0
  15. package/dist/adapters/loop-plan.d.ts +53 -0
  16. package/dist/adapters/loop-plan.d.ts.map +1 -0
  17. package/dist/adapters/prop-classes.d.ts +37 -0
  18. package/dist/adapters/prop-classes.d.ts.map +1 -0
  19. package/dist/expression-parser.d.ts +38 -0
  20. package/dist/expression-parser.d.ts.map +1 -1
  21. package/dist/index.d.ts +17 -3
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1765 -914
  24. package/dist/jsx-to-ir.d.ts +465 -1
  25. package/dist/jsx-to-ir.d.ts.map +1 -1
  26. package/dist/nullable-signal-attr.d.ts +19 -0
  27. package/dist/nullable-signal-attr.d.ts.map +1 -1
  28. package/package.json +2 -2
  29. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +1 -1
  30. package/src/__tests__/action-accessor.test.ts +6 -24
  31. package/src/__tests__/array-method-catalogue.test.ts +99 -0
  32. package/src/__tests__/attr-plan.test.ts +121 -0
  33. package/src/__tests__/binding-scope-ratchet.test.ts +12 -12
  34. package/src/__tests__/boolean-result-expr.test.ts +106 -0
  35. package/src/__tests__/boolean-result.test.ts +34 -1
  36. package/src/__tests__/callback-method.test.ts +189 -0
  37. package/src/__tests__/component-props.test.ts +148 -0
  38. package/src/__tests__/delegated-handler-preamble.test.ts +4 -4
  39. package/src/__tests__/dsl-shared-helpers.test.ts +166 -0
  40. package/src/__tests__/issue-3240-nested-static-map-event-delegation.test.ts +1 -1
  41. package/src/__tests__/loop-plan.test.ts +104 -0
  42. package/src/__tests__/map-call-decisions.test.ts +521 -0
  43. package/src/__tests__/nullable-signal-attr.test.ts +45 -0
  44. package/src/adapters/array-method.ts +193 -0
  45. package/src/adapters/attr-plan.ts +200 -0
  46. package/src/adapters/boolean-result.ts +208 -12
  47. package/src/adapters/callback-method.ts +301 -0
  48. package/src/adapters/component-props.ts +144 -0
  49. package/src/adapters/component-tree.ts +118 -0
  50. package/src/adapters/literal-value.ts +36 -0
  51. package/src/adapters/loop-plan.ts +88 -0
  52. package/src/adapters/prop-classes.ts +73 -0
  53. package/src/expression-parser.ts +537 -374
  54. package/src/index.ts +53 -2
  55. package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +9 -7
  56. package/src/jsx-to-ir.ts +1328 -991
  57. package/src/nullable-signal-attr.ts +78 -0
@@ -3,7 +3,471 @@
3
3
  *
4
4
  * Transforms TypeScript JSX AST to Pure IR (JSX-independent JSON structure).
5
5
  */
6
- import { type IRNode } from './types.ts';
6
+ import ts from 'typescript';
7
+ import { type IRNode, type LoopParamBinding, type FlatMapCallback, type MapCallbackPreamble, type PreambleRegionSource } from './types.ts';
7
8
  import { type AnalyzerContext } from './analyzer-context.ts';
9
+ import { type ParsedExpr } from './expression-parser.ts';
10
+ import type { IRLoopSort, ConstantInfo, ParamInfo } from './types.ts';
11
+ import { type ClientBuiltinTag } from './builtins.ts';
12
+ import { type BindingEnvironment } from './free-refs.ts';
13
+ import type { LoweringMatcher } from './lowering-registry.ts';
14
+ import { BindingScope } from './scope/binding-scope.ts';
15
+ /** Pre-compiled regex patterns for reactivity detection */
16
+ interface ReactivityPatterns {
17
+ signals: {
18
+ getter: string;
19
+ pattern: RegExp;
20
+ }[];
21
+ memos: {
22
+ name: string;
23
+ pattern: RegExp;
24
+ }[];
25
+ /** For regex `props.<key>` detection only — for exact-name binding checks read `TransformContext.boundPropNames` instead (#2835). */
26
+ props: {
27
+ name: string;
28
+ pattern: RegExp;
29
+ }[];
30
+ constants: {
31
+ name: string;
32
+ value: string | undefined;
33
+ pattern: RegExp;
34
+ }[];
35
+ }
36
+ /** @internal exported for the per-decision loop tests (`map-call-decisions.test.ts`). */
37
+ export interface TransformContext {
38
+ analyzer: AnalyzerContext;
39
+ sourceFile: ts.SourceFile;
40
+ filePath: string;
41
+ slotIdCounter: number;
42
+ isRoot: boolean;
43
+ insideComponentChildren: boolean;
44
+ patterns: ReactivityPatterns;
45
+ /**
46
+ * Local names actually bound by the props parameter (#2835) — unlike
47
+ * `patterns.props`, which for a whole `(props: Props)` parameter holds
48
+ * every TYPE-MEMBER name (needed so its regex `pattern` still matches
49
+ * `props.<key>` accesses), this is empty in that shape since none of
50
+ * those names are local bindings a shadow check could ever see.
51
+ */
52
+ boundPropNames: ReadonlySet<string>;
53
+ /** Shortcut for analyzer.getJS(node) */
54
+ getJS(node: ts.Node): string;
55
+ /** getJS + rewrite destructured prop refs for client JS templates (#807) */
56
+ getTemplateJS(node: ts.Node): string;
57
+ /** Cached set of reactive getter names (signal getters + memo names) for O(1) lookup */
58
+ _reactiveGetterNames?: Set<string>;
59
+ /** Cached set of module-scope @client signal/memo names. */
60
+ _moduleClientSignalNames?: Set<string>;
61
+ /**
62
+ * Cached `localConstants` index (name → value text), shared by every
63
+ * `resolveAliasOrigin` walk in this file — `forwardsCallerRestProps`'s
64
+ * rest/props-spread alias walk and `isArrayExprDirectPropRef`'s
65
+ * direct-prop-array alias walk (#2724).
66
+ */
67
+ _constantValuesByName?: ReadonlyMap<string, string | undefined>;
68
+ /**
69
+ * Cached `localConstants` index (name → full `ConstantInfo`), for
70
+ * lookups that need more than the value text — e.g.
71
+ * `isArrayExprDirectPropRef` reading a constant's structured `.parsed`
72
+ * to recognize `const arr = props.items` (#2724).
73
+ */
74
+ _constantsByName?: ReadonlyMap<string, ConstantInfo>;
75
+ /** Cached set of destructured prop names for AST-based rewriting */
76
+ _destructuredPropNames?: Set<string> | null;
77
+ /**
78
+ * Cached local-name → caller-facing-key (`sourceName ?? name`) map for
79
+ * `_destructuredPropNames`, entries only for names that actually rename
80
+ * (`{ n: count }` → `count` → `n`). Built alongside `_destructuredPropNames`
81
+ * so both stay in lockstep with the same shadow-filtered eligible set —
82
+ * consumed by `rewriteBarePropRefsCore` to emit `_p.<caller>` instead of
83
+ * `_p.<local>` (#2524 CSR half: `_p` is always caller-keyed).
84
+ */
85
+ _destructuredPropAliases?: Map<string, string> | null;
86
+ /**
87
+ * Cached local-name → `ParamInfo` map for the same eligible set, so
88
+ * `rewriteBarePropRefs` can apply a prop's destructure DEFAULT. Without
89
+ * it the CSR-only `template:` literal emitted a bare `_p.label` for
90
+ * `data-label={label}` with `label = 'none'`: correct once the caller
91
+ * sends a value, but the attribute was omitted entirely on the first
92
+ * render, where `_p.label` is `undefined`. Covers PARAMETER destructuring
93
+ * and an UNRENAMED BODY destructure default alike (`function Foo(props) {
94
+ * const { label = 'none' } = props }`) — both populate `defaultValue`
95
+ * directly on `propsParams` (the parameter form in `extractProps`, the
96
+ * body form via `collectConstant`'s overlay, #2943), so this map is a
97
+ * plain re-keying of `eligible`, no second default-resolution needed.
98
+ */
99
+ _destructuredPropInfoByName?: ReadonlyMap<string, ParamInfo> | null;
100
+ /**
101
+ * The active `.map()`/callback binding stack (#2482 Stage 1a) — replaces
102
+ * the former mutable per-name `Set<string>` mutated in lockstep with
103
+ * `transformMapCall` entry/exit. `enterLoopRow`/`enterCallback` return a
104
+ * NEW `BindingScope`; restoring the saved parent reference on exit is
105
+ * the whole mechanism (no `.delete()` bookkeeping to get wrong).
106
+ */
107
+ scope: BindingScope;
108
+ /**
109
+ * Count of enclosing `.map()` loops (0 = outermost), incremented/
110
+ * decremented in lockstep with entering/leaving `transformMapCall`.
111
+ * Unlike `scope` (a binding stack that can gain several bound names for
112
+ * ONE loop level via destructuring), this is a plain per-level
113
+ * counter — the single source of truth `IRLoop.depth` is stamped
114
+ * from, so every adapter's `data-key`/`data-key-N` suffix derives
115
+ * from one IR-computed value instead of each adapter re-deriving
116
+ * nesting depth its own way (#2168 nested-loop-outer-binding).
117
+ */
118
+ loopDepth: number;
119
+ /** Counter for async boundary IDs (a0, a1, ...) */
120
+ asyncIdCounter: number;
121
+ /** Counter for <Region> structural index (0, 1, ...) within a file. */
122
+ regionIdCounter: number;
123
+ /** Counter for loop marker IDs (l0, l1, ...) — separate from slot IDs so element bf="sN" numbering stays stable across versions (#1087). */
124
+ loopMarkerCounter: number;
125
+ /**
126
+ * Counter for JSX spread bag slot IDs (`Spread_0`, `Spread_1`, ...).
127
+ * Separate namespace from element slot IDs (`s0`, `s1`, ...) so
128
+ * adapters that need to plumb the spread bag through a structured
129
+ * data path (Go template's `.Spread_N`) don't collide with element
130
+ * scope IDs (#1407). Component-scoped, allocated only when the
131
+ * spread falls through to the bag-emitting branch.
132
+ */
133
+ spreadIdCounter: number;
134
+ /**
135
+ * Memoized free-refs binding environment. Built lazily by
136
+ * `makeBindingEnv` and reused across every `resolveFreeRefs` call as
137
+ * long as `scope`'s bound VALUE names are unchanged. Invalidated by
138
+ * serializing `scope.valueBoundNames()` into `_bindingEnvLoopKey` and
139
+ * comparing on read.
140
+ */
141
+ _bindingEnv?: BindingEnvironment;
142
+ _bindingEnvLoopKey?: string;
143
+ /**
144
+ * Lazily computed map of `Pkg.Comp` → `Comp` resolutions for
145
+ * member-expression JSX tags (#1319). A `const Pkg = { Comp }` (or
146
+ * `{ Comp: ComponentName }`) in module scope lets the CSR template
147
+ * emit `renderChild('Comp', ...)` instead of the literal
148
+ * `renderChild('Pkg.Comp', ...)` which fails the registry lookup.
149
+ */
150
+ _componentNamespaces?: Map<string, Map<string, string>>;
151
+ /**
152
+ * Per-branch overlay of `const X = expr` declared inside an early-
153
+ * return `if`-block, populated by `buildIfStatementChain` before
154
+ * transforming the consequent JSX (#1409). When a JSX expression
155
+ * references one of these names, `transformExpression` inlines the
156
+ * initializer at the use site — the same way module-scope JSX
157
+ * constants are inlined via `analyzer.jsxConstants` (#547) — instead
158
+ * of leaving the identifier to leak into the emitted client JS at
159
+ * outer init scope where the binding doesn't exist. Saved/restored
160
+ * around each `transformNode(condReturn.jsxReturn, ctx)` call so
161
+ * sibling branches do not see each other's locals.
162
+ */
163
+ _branchScopeVars?: Map<string, ts.Expression>;
164
+ /**
165
+ * Subset of `_branchScopeVars` names whose initializer carries JSX
166
+ * (so text substitution into raw-captured callback bodies is unsafe
167
+ * — TS JSX in JS syntax is invalid). `processAttributes` consults
168
+ * this set when extracting ref / event-handler bodies and emits
169
+ * BF047 if any of these names appears as a free identifier in the
170
+ * callback body. See #1414 cell 5.
171
+ */
172
+ _jsxBranchLocalNames?: Set<string>;
173
+ /**
174
+ * Set of destructured prop names each branch-local transitively
175
+ * references in its initializer (directly or via inner-branch-local
176
+ * substitution). Populated alongside `_branchScopeVars`; consumed
177
+ * by `rewriteBarePropRefs` so prop refs introduced via text-level
178
+ * branch-local substitution still get bridged to `_p.X` in CSR
179
+ * template scope even though the use-site AST doesn't carry them.
180
+ * See #1425.
181
+ */
182
+ _branchScopePropDeps?: Map<string, Set<string>>;
183
+ /**
184
+ * Lazily computed map of local JSX tag name → compile-away built-in
185
+ * (`Async` / `Region`), derived from `@barefootjs/client` imports (#1915).
186
+ * Recognition is import-scoped (not a bare tag-name match) so a user's own
187
+ * `<Async>` / `<Region>` component doesn't collide with the built-in, and an
188
+ * aliased `import { Async as Boundary }` maps `<Boundary>` to the built-in.
189
+ */
190
+ _clientBuiltinTags?: Map<string, ClientBuiltinTag>;
191
+ /** Lazily computed local name → export name of every `@barefootjs/client` value import. */
192
+ _clientValueImports?: ReadonlyMap<string, string>;
193
+ /**
194
+ * BF063 candidates keyed by element position (`line:column`), recorded
195
+ * while transforming and reported by `reportRefAttrsAbsentAtSsr` once the
196
+ * IR shows which elements SSR renders.
197
+ */
198
+ _refAttrAbsences?: Map<string, RefAttrAbsence>;
199
+ /**
200
+ * Cached `datePlugin` matcher (#2292), bound once to this component's
201
+ * metadata. `undefined` = not yet computed; `null` = computed and
202
+ * inactive (this component's props never reach a `Date`, `datePlugin`'s
203
+ * own `prepare` gate). See `getDateLoweringMatcher`.
204
+ */
205
+ _dateLoweringMatcher?: LoweringMatcher | null;
206
+ /**
207
+ * Cached `toLocaleDatePlugin` matcher (#2324 slice 2), same lifecycle as
208
+ * `_dateLoweringMatcher`. See `getToLocaleDateLoweringMatcher`.
209
+ */
210
+ _toLocaleDateLoweringMatcher?: LoweringMatcher | null;
211
+ }
212
+ /** @internal exported for the per-decision loop tests (`map-call-decisions.test.ts`). */
213
+ export declare function createTransformContext(analyzer: AnalyzerContext): TransformContext;
8
214
  export declare function jsxToIR(analyzer: AnalyzerContext): IRNode | null;
215
+ /**
216
+ * Result type for extractFilterPredicate. The predicate is always an expression:
217
+ * a block body is normalized to one via `foldBlockToExpr` +
218
+ * `predicateTernaryToLogical` (#2040).
219
+ */
220
+ type FilterPredicateResult = {
221
+ param: string;
222
+ predicate?: ParsedExpr;
223
+ raw: string;
224
+ };
225
+ /**
226
+ * The loop's SOURCE after the receiver chain is recognised: the array
227
+ * expression the loop iterates (`array`, its `_p.`-rewritten `templateArray`
228
+ * twin, and the AST node it was read from), plus whatever the chain lifted
229
+ * out of it — the filter predicate, the sort comparator, their order, and
230
+ * the `.entries()` / `Object.entries()` iteration shape.
231
+ */
232
+ export interface LoopSourcePlan {
233
+ array: string;
234
+ templateArray: string | undefined;
235
+ /**
236
+ * AST node `array` was read from, so the static-array decision can run
237
+ * `exprHasFunctionCalls` on it. Starts as the full map source, which
238
+ * matches the plain-`.map()` fallback.
239
+ */
240
+ arrayExpr: ts.Expression;
241
+ filterPredicate: FilterPredicateResult | undefined;
242
+ sortComparator: IRLoopSort | undefined;
243
+ chainOrder: 'filter-sort' | 'sort-filter' | undefined;
244
+ iterationShape: 'entries' | 'keys' | undefined;
245
+ objectIteration: 'entries' | 'keys' | 'values' | undefined;
246
+ }
247
+ /**
248
+ * Decision 1 — recognise the receiver of `.map()` and decide what the loop
249
+ * iterates. Chaining patterns on the map source:
250
+ *
251
+ * 1. `sort().map()` / `toSorted().map()`
252
+ * 2. `filter().map()`
253
+ * 3. `filter().sort().map()` (outermost = sort, inner = filter)
254
+ * 4. `sort().filter().map()` (outermost = filter, inner = sort)
255
+ * 5. `entries().map()` / `keys().map()` / `values().map()`, and the static
256
+ * `Object.entries(x).map()` family
257
+ *
258
+ * Every branch binds the array through `setArray` so `templateArray`
259
+ * carries the `_p.`-rewritten form (#2222): the plain `.map()` fallback is
260
+ * the most common loop shape and was the primary repro for the
261
+ * bare-destructured-name ReferenceError.
262
+ *
263
+ * @internal exported for unit tests
264
+ */
265
+ export declare function resolveLoopSource(node: ts.CallExpression, ctx: TransformContext, isClientOnly: boolean): LoopSourcePlan;
266
+ /** The names one loop row binds, read off the callback's parameter list. */
267
+ export interface LoopRowParams {
268
+ param: string;
269
+ paramType: string | undefined;
270
+ index: string | null;
271
+ indexType: string | undefined;
272
+ paramBindings: LoopParamBinding[] | undefined;
273
+ /** Node whose checker type is the scalar item-type evidence (`IRLoop.itemType`). */
274
+ itemTypeNode: ts.Node | undefined;
275
+ }
276
+ /**
277
+ * Decision 2 — the names a row binds: the item param (and its type text),
278
+ * the index param, and the destructure accessor paths. An `.entries()`
279
+ * shape takes its index from the 2-tuple destructure instead of a second
280
+ * parameter.
281
+ *
282
+ * @internal exported for unit tests
283
+ */
284
+ export declare function resolveLoopRowParams(callback: ts.ArrowFunction, source: Pick<LoopSourcePlan, 'iterationShape' | 'objectIteration'>, ctx: TransformContext): LoopRowParams;
285
+ /** What one `.map()` callback body lowers to. */
286
+ export interface LoopBodyLowering {
287
+ children: IRNode[];
288
+ /**
289
+ * Structured pre-return statements of a block-body callback (Stage 3 root
290
+ * cure): JS text + compiled JSX leaves as segments, plus the raw TSX for
291
+ * JSX-runtime SSR and the declared names (D5 key guard, {out} join).
292
+ */
293
+ preamble: MapCallbackPreamble | undefined;
294
+ flatMapCallback: FlatMapCallback | undefined;
295
+ }
296
+ /**
297
+ * Run `fn` under the row's `BindingScope` frame. Registers the loop-bound
298
+ * names so expressions referencing them get a slotId (#2482 Stage 1a): for
299
+ * destructured patterns the frame binds the individual binding names —
300
+ * `\b${param}\b` never matches a bare name like `cfg` when `param` is
301
+ * `[, cfg]`, which would otherwise leave reactive-expression detection
302
+ * silently broken for destructured callbacks. `fn` receives the pre-loop
303
+ * parent scope (the frame the preamble-shadow window re-enters from). The
304
+ * parent is restored by reference, not deleted-from, so a nested loop
305
+ * reusing a param name can never corrupt the outer scope — the BindingScope
306
+ * twin of the old "unregister loop params" delete block, which can never
307
+ * miss an entry the add-site added.
308
+ *
309
+ * @internal exported for unit tests
310
+ */
311
+ export declare function withLoopRowScope<T>(ctx: TransformContext, row: Pick<LoopRowParams, 'param' | 'index' | 'paramBindings'>, fn: (savedScope: BindingScope) => T): T;
312
+ /**
313
+ * Decision 3 — lower the callback body into the row's children, preamble
314
+ * and flatMap carrier. The caller has already entered the row's
315
+ * `BindingScope` frame (`ctx.scope`, see `withLoopRowScope`) and bumped
316
+ * `ctx.loopDepth`; `savedScope` is the pre-loop parent the preamble-shadow
317
+ * window re-enters from.
318
+ *
319
+ * @internal exported for unit tests
320
+ */
321
+ export declare function transformLoopCallbackBody(callback: ts.ArrowFunction, row: LoopRowParams, savedScope: BindingScope, ctx: TransformContext, isClientOnly: boolean, method: 'map' | 'flatMap'): LoopBodyLowering;
322
+ /**
323
+ * Decision 4 — the structural net (sound-or-loud, spec/callback-fidelity.md):
324
+ * a callback body that carries an INLINE JSX literal but produced no loop
325
+ * lowering must never fall through to the IRExpression scalar path —
326
+ * `ctx.getJS` strips types, not JSX, so the raw `<li …>` would splice
327
+ * verbatim into the emitted client bundle as a silent SyntaxError. Any
328
+ * recognizer gap for a JSX-bearing shape becomes a loud diagnostic here
329
+ * instead of a leak. (A JSX-helper CALL — `map(t => renderItem(t))` —
330
+ * carries no inline JSX literal and legitimately stays on the reactive-text
331
+ * path.)
332
+ *
333
+ * Entry-count gate: a more specific refusal already fired for THIS call
334
+ * (e.g. the flatMap leaf-wiring check) — don't stack the generic message on
335
+ * top of it. Comparing against the count captured at entry (not `=== 0`)
336
+ * keeps the net armed when an unrelated diagnostic was recorded earlier in
337
+ * the file — a warning elsewhere must never silence the leak guard for this
338
+ * callback.
339
+ *
340
+ * @internal exported for unit tests
341
+ */
342
+ export declare function refuseUnloweredJsxCallback(node: ts.CallExpression, ctx: TransformContext, method: 'map' | 'flatMap', diagCountAtEntry: number): void;
343
+ /** The loop's keyFn source and whether the body is a whole-item conditional. */
344
+ export interface LoopKeyPlan {
345
+ key: string | null;
346
+ bodyIsItemConditional: boolean;
347
+ }
348
+ /**
349
+ * Decision 5 — the row key. Emits BF023 / BF024 if the loop root element
350
+ * lacks a valid key attribute, then looks for the loop's keyFn source on the
351
+ * first child. `extractLoopKey` handles direct elements, child components,
352
+ * and — crucially — ternary bodies (#1098): when every branch of an
353
+ * `IRConditional` declares the same `key={EXPR}`, that EXPR is lifted out to
354
+ * mapArray's keyFn so a shape change (e.g. `<polygon>` ↔ `<circle>`)
355
+ * replaces the DOM node instead of mutating attributes on the wrong tag.
356
+ * Whole-item conditional bodies (#1665): the loop item is a single
357
+ * conditional whose at-least-one branch renders nothing, so an item shows
358
+ * 0-or-1 element. The key lives inside the rendering branch, so it is
359
+ * hoisted from there; the flag routes the loop through anchored emission
360
+ * downstream.
361
+ *
362
+ * #2753: the row's key ATTRIBUTE (name + value) is resolved here, once, and
363
+ * stamped onto the element(s) that render it — `null` (unkeyed) means no
364
+ * `IRElement.keyAttr` at all, which is the correct final answer for every
365
+ * adapter and the client runtime alike, not a hint they still have to gate.
366
+ * See `IRElement.keyAttr` / `applyLoopKeyAttr`'s docstrings.
367
+ *
368
+ * @internal exported for unit tests
369
+ */
370
+ export declare function resolveLoopKey(callback: ts.ArrowFunction, children: IRNode[], ctx: TransformContext, isNested: boolean, depth: number): LoopKeyPlan;
371
+ /**
372
+ * Decision 6a — the JSX-building preamble's element-array children.
373
+ *
374
+ * Stage 3 / D4 — flag element-array children ({out}) built by the preamble
375
+ * so Phase-2 string emission joins them instead of `String([])`-collapsing
376
+ * them. Scoped to builderNames (leaf accumulators), NOT all declared locals
377
+ * — a value-only `{label}` keeps its historical plain interpolation.
378
+ *
379
+ * Stage 3 root cure — a JSX-building preamble feeding a COMPONENT root is
380
+ * refused: the component loop's rows are createComponent-driven ('dom-ops'
381
+ * row construction), and a lowered HTML-string leaf passed as a prop would
382
+ * silently diverge from SSR, where the same prop is a real JSX element.
383
+ * Refused = not carried (the old "do NOT collect" principle): codegen still
384
+ * runs on an errored compile, and the dom-ops backstop invariant must stay
385
+ * a FUTURE-variant tripwire, not re-fire on shapes Phase 1 already refused
386
+ * loudly. Returns the preamble to carry (`undefined` once refused).
387
+ *
388
+ * @internal exported for unit tests
389
+ */
390
+ export declare function applyPreambleBuilderPasses(node: ts.CallExpression, children: IRNode[], preamble: MapCallbackPreamble | undefined, ctx: TransformContext): MapCallbackPreamble | undefined;
391
+ /** How the loop's array renders: static (prop) or reconciled (signal/memo/call). */
392
+ export interface LoopArrayClassification {
393
+ callsReactive: boolean;
394
+ hasCalls: boolean;
395
+ isDirectPropArray: boolean;
396
+ isStaticArray: boolean;
397
+ }
398
+ /**
399
+ * Decision 7 — is the array static (prop) or dynamic (signal/memo)? Static
400
+ * arrays don't need mapArray/mapArrayAnchored — SSR elements are hydrated
401
+ * directly. Signal / memo arrays need mapArray for dynamic DOM updates.
402
+ *
403
+ * Solid-style wrap-by-default fallback (#943, follow-up to
404
+ * #937/#939/#940/#941/#942): if the array expression AST contains a function
405
+ * call but the analyzer can't recognise the callee as a signal / memo, we
406
+ * still force reconciliation. `getItems().map(...)` where `getItems` is an
407
+ * imported helper previously silent-dropped into the static-render path,
408
+ * freezing the SSR-time list on the client. Over-reconciling an array that
409
+ * happens to contain a pure call costs one extra `mapArray` per loop;
410
+ * under-reconciling is the silent-drop bug this closes.
411
+ *
412
+ * Destructured map params (`([, cfg]) => ...`, `({ a, b }) => ...`, typed
413
+ * forms) used to be excluded from the widening to avoid a latent crash in
414
+ * the `mapArray` renderItem emitter — see #949 and the emitter-side
415
+ * `destructureLoopParam` helper, which now unwraps the signal accessor at
416
+ * renderItem body entry. No more skip.
417
+ *
418
+ * `objectIteration` (#2168 object-entries-map): `array` here is the STRIPPED
419
+ * object expression (`Object.entries(x)`'s `x`), which can itself be a
420
+ * static module-scope const object literal and would otherwise satisfy
421
+ * every check — but a plain OBJECT has no `.forEach()`/`.map()` (the
422
+ * static-array client codegen's own methods), unlike an actual array
423
+ * literal. Force the dynamic `mapArray()` path instead, which this shape's
424
+ * client-JS array-expr reconstruction (`applyObjectIterationWrap`,
425
+ * `ir-to-client-js/utils.ts`) already handles correctly.
426
+ *
427
+ * @internal exported for unit tests
428
+ */
429
+ export declare function classifyLoopArray(source: Pick<LoopSourcePlan, 'array' | 'arrayExpr' | 'objectIteration'>, method: 'map' | 'flatMap', ctx: TransformContext): LoopArrayClassification;
430
+ /**
431
+ * Decision 6b — the preamble's after-the-fact reactivity wiring on a
432
+ * signal-backed (non-static) loop. Static arrays are never recreated via
433
+ * signals, so there is nothing to patch; they are skipped entirely.
434
+ *
435
+ * #2389 patch-on-update — a loop body with a preamble may reference a
436
+ * preamble-declared local directly as a child expression (`{cells}`,
437
+ * `{stateLabel}`). `mapArray` reuses the same DOM node on a same-key update,
438
+ * re-running only the wired text/attr slots — this child has neither, so
439
+ * without a dedicated region-patch effect it freezes at its mount-time
440
+ * value.
441
+ *
442
+ * #2447 follow-up — the ATTRIBUTE twin of the regions. `class={cls}` where
443
+ * the preamble declares `cls` froze at its row-construction value for the
444
+ * same reason `{cells}` did, and for one extra reason on top: an attribute
445
+ * only gets wired at all if its element carries a slot id, and
446
+ * `hasReactiveAttributes` (which decides that at element-build time, before
447
+ * any loop preamble is known) scores a bare local as non-reactive. So the
448
+ * slot has to be granted HERE, in the same after-the-fact pass the regions
449
+ * use — after which `collectLoopChildReactiveAttrs` classifies the attr and
450
+ * the row effect re-runs the preamble ahead of the write.
451
+ *
452
+ * #2596 — the CONDITION-position twin. See
453
+ * `markPreambleConditionalReactivity`'s docstring for why that one is gated
454
+ * on `reactiveNames` (genuinely signal-derived) rather than the blanket
455
+ * `declaredNames` the region/attr passes use.
456
+ *
457
+ * @internal exported for unit tests
458
+ */
459
+ export declare function markPreambleReactivity(children: IRNode[], preamble: MapCallbackPreamble | undefined, isStaticArray: boolean, ctx: TransformContext): PreambleRegionSource[] | undefined;
460
+ /** A BF063 candidate awaiting `reportRefAttrsAbsentAtSsr`. */
461
+ interface RefAttrAbsence {
462
+ /** `<tag> at line:column`, naming the element in the diagnostic. */
463
+ element: string;
464
+ /** Mount-time writes of attributes this element's JSX never renders. */
465
+ writes: RefAttrWrite[];
466
+ }
467
+ interface RefAttrWrite {
468
+ /** Lower-cased HTML attribute name (`data-*` for a `dataset` write). */
469
+ name: string;
470
+ node: ts.Node;
471
+ }
472
+ export {};
9
473
  //# sourceMappingURL=jsx-to-ir.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-to-ir.d.ts","sourceRoot":"","sources":["../src/jsx-to-ir.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,KAAK,MAAM,EAgCZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,eAAe,EAA4F,MAAM,uBAAuB,CAAA;AAunCtJ,wBAAgB,OAAO,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAchE"}
1
+ {"version":3,"file":"jsx-to-ir.d.ts","sourceRoot":"","sources":["../src/jsx-to-ir.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,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AAmB,GAAG,SAAS,EACzC,GAAG,EAAE,gBAAgB,GACpB,mBAAmB,GAAG,SAAS,CAkBjC;AAuBD,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,aAAa,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW,GAAG,iBAAiB,CAAC,EACvE,MAAM,EAAE,KAAK,GAAG,SAAS,EACzB,GAAG,EAAE,gBAAgB,GACpB,uBAAuB,CAUzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,mBAAmB,GAAG,SAAS,EACzC,aAAa,EAAE,OAAO,EACtB,GAAG,EAAE,gBAAgB,GACpB,oBAAoB,EAAE,GAAG,SAAS,CASpC;AAw4CD,8DAA8D;AAC9D,UAAU,cAAc;IACtB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAED,UAAU,YAAY;IACpB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;CACd"}
@@ -54,6 +54,10 @@ export interface NullishAttrContext {
54
54
  * (`arithmeticOperandIsUndefined`). */
55
55
  readonly undefinedSeededSignals?: ReadonlySet<string>;
56
56
  readonly memos: ReadonlyMap<string, MemoInfo>;
57
+ /** Props declared as a number that may be `null` or absent (`n: number |
58
+ * null`, `n?: number`), by the name a read uses: the binding name, and
59
+ * `<propsObjectName>.<key>` for a member read (#3474). */
60
+ readonly nullableNumberProps?: ReadonlySet<string>;
57
61
  }
58
62
  export declare function collectNullishAttrContext(ir: ComponentIR): NullishAttrContext;
59
63
  /**
@@ -103,4 +107,19 @@ export declare function arithmeticOperandIsUndefined(parsed: ParsedExpr | undefi
103
107
  * concatenates when either side is a string.
104
108
  */
105
109
  export declare const NULL_COERCING_ARITHMETIC_OPS: ReadonlySet<string>;
110
+ /** How a DSL adapter coerces an arithmetic operand (#3474): `'null'` reads a
111
+ * nil as `0` (JS `ToNumber(null)`), `'undefined'` reads it as `NaN`
112
+ * (`ToNumber(undefined)`), `null` leaves the operand as is. */
113
+ export type ArithmeticCoercion = 'null' | 'undefined' | null;
114
+ /**
115
+ * The one decision behind every DSL adapter's arithmetic over a nullish
116
+ * operand (#3474). An operand known to be `null` / `undefined`
117
+ * (`arithmeticOperandIsNull` / `arithmeticOperandIsUndefined`, or a nullable
118
+ * number prop) is coerced under the operators JS applies `ToNumber` to
119
+ * ({@link NULL_COERCING_ARITHMETIC_OPS}), and under `+` when the other
120
+ * operand is a number literal, where `+` cannot concatenate. Each adapter
121
+ * only spells the coercion; one whose engine already reads nil as `0`
122
+ * spells `'null'` as the operand itself.
123
+ */
124
+ export declare function arithmeticOperandCoercion(op: string, operand: ParsedExpr | undefined, other: ParsedExpr | undefined, ctx: NullishAttrContext, isShadowed?: (name: string) => boolean): ArithmeticCoercion;
106
125
  //# sourceMappingURL=nullable-signal-attr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nullable-signal-attr.d.ts","sourceRoot":"","sources":["../src/nullable-signal-attr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,YAAY,CAAA;AAY7E,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAItE;AAED;;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B,GAClD,kBAAkB,CAGpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/jsx",
3
- "version": "0.39.5",
3
+ "version": "0.39.6",
4
4
  "description": "JSX compiler for BarefootJS - transforms JSX to server HTML + client JS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "directory": "packages/jsx"
50
50
  },
51
51
  "dependencies": {
52
- "@barefootjs/shared": "0.39.5"
52
+ "@barefootjs/shared": "0.39.6"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@barefootjs/client": ">=0.2.0",
@@ -1944,7 +1944,7 @@ hydrate('Layout', { init: initLayout, template: (_p) => \`<html><body>\${markupO
1944
1944
  export function Layout(_p, __bfKey) { return createComponent('Layout', _p, __bfKey) }"
1945
1945
  `;
1946
1946
 
1947
- exports[`docs/core/adapters/go-template-adapter.md doc-examples L71 — (no label) 1`] = `
1947
+ exports[`docs/core/adapters/go-template-adapter.md doc-examples L72 — (no label) 1`] = `
1948
1948
  "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
1949
1949
 
1950
1950
 
@@ -20,14 +20,7 @@ import {
20
20
  import { parseExpression } from '../expression-parser.ts'
21
21
  import type { TemplatePositionRole } from '../template-position-walk.ts'
22
22
  import type { SignalInfo } from '../types.ts'
23
- import { isAriaBooleanAttr as bladeIsAriaBooleanAttr } from '../../../adapter-blade/src/adapter/boolean-result'
24
- import { isAriaBooleanAttr as erbIsAriaBooleanAttr } from '../../../adapter-erb/src/adapter/boolean-result'
25
- import { isAriaBooleanAttr as jinjaIsAriaBooleanAttr } from '../../../adapter-jinja/src/adapter/boolean-result'
26
- import { isAriaBooleanAttr as mojoIsAriaBooleanAttr } from '../../../adapter-mojolicious/src/adapter/boolean-result'
27
- import { isAriaBooleanAttr as pebbleIsAriaBooleanAttr } from '../../../adapter-pebble/src/adapter/boolean-result'
28
- import { isAriaBooleanAttr as rustIsAriaBooleanAttr } from '../../../adapter-rust/src/adapter/boolean-result'
29
- import { isAriaBooleanAttr as twigIsAriaBooleanAttr } from '../../../adapter-twig/src/adapter/boolean-result'
30
- import { isAriaBooleanAttr as xslateIsAriaBooleanAttr } from '../../../adapter-xslate/src/adapter/boolean-result'
23
+ import { isAriaBooleanAttr } from '../adapters/boolean-result.ts'
31
24
 
32
25
  function factorySignal(action: string): Pick<SignalInfo, 'factory'> {
33
26
  return { factory: { kind: 'query', callee: 'createQuery', argsText: '', requestText: '', requestFreeIdentifiers: new Set(), action } }
@@ -145,22 +138,11 @@ describe('seedableActionAccessorRead — the one gate for the BF117 lift and the
145
138
 
146
139
  describe('ARIA_BOOLEAN_STATE_ATTRS agrees with every DSL adapter', () => {
147
140
  // The seed renders `aria-x={false}` as `aria-x="false"` (Hono's output) only
148
- // where the adapter stringifies a boolean JS-style; outside its own
141
+ // where the adapter stringifies a boolean JS-style; outside the
149
142
  // `isAriaBooleanAttr` set, Mojolicious / Xslate render the literal as `0`.
150
143
  // Go renders `{{false}}` as `false` on every attribute, so it has no set.
151
- const adapters: Array<[string, (name: string) => boolean]> = [
152
- ['blade', bladeIsAriaBooleanAttr],
153
- ['erb', erbIsAriaBooleanAttr],
154
- ['jinja', jinjaIsAriaBooleanAttr],
155
- ['mojolicious', mojoIsAriaBooleanAttr],
156
- ['pebble', pebbleIsAriaBooleanAttr],
157
- ['rust', rustIsAriaBooleanAttr],
158
- ['twig', twigIsAriaBooleanAttr],
159
- ['xslate', xslateIsAriaBooleanAttr],
160
- ]
161
- for (const [adapter, isAriaBooleanAttr] of adapters) {
162
- test(`${adapter} stringifies every gated attribute as a boolean`, () => {
163
- expect([...ARIA_BOOLEAN_STATE_ATTRS].filter((name) => !isAriaBooleanAttr(name))).toEqual([])
164
- })
165
- }
144
+ // Every DSL adapter imports the one shared `isAriaBooleanAttr` (#3475).
145
+ test('every gated attribute is stringified as a boolean', () => {
146
+ expect([...ARIA_BOOLEAN_STATE_ATTRS].filter((name) => !isAriaBooleanAttr(name))).toEqual([])
147
+ })
166
148
  })