@barefootjs/jsx 0.40.0 → 0.40.2

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 (249) hide show
  1. package/dist/adapters/ambiguous-nil-arithmetic.d.ts +42 -0
  2. package/dist/adapters/ambiguous-nil-arithmetic.d.ts.map +1 -0
  3. package/dist/adapters/attr-plan.d.ts.map +1 -1
  4. package/dist/adapters/boolean-carrier.d.ts +31 -0
  5. package/dist/adapters/boolean-carrier.d.ts.map +1 -0
  6. package/dist/adapters/boolean-result.d.ts +32 -10
  7. package/dist/adapters/boolean-result.d.ts.map +1 -1
  8. package/dist/adapters/brace-delimiter-text.d.ts +18 -0
  9. package/dist/adapters/brace-delimiter-text.d.ts.map +1 -0
  10. package/dist/adapters/callback-method.d.ts +38 -5
  11. package/dist/adapters/callback-method.d.ts.map +1 -1
  12. package/dist/adapters/component-props.d.ts +22 -7
  13. package/dist/adapters/component-props.d.ts.map +1 -1
  14. package/dist/adapters/computed-const.d.ts +28 -1
  15. package/dist/adapters/computed-const.d.ts.map +1 -1
  16. package/dist/adapters/dsl-template-adapter.d.ts +39 -1
  17. package/dist/adapters/dsl-template-adapter.d.ts.map +1 -1
  18. package/dist/adapters/loop-bound-names.d.ts +9 -1
  19. package/dist/adapters/loop-bound-names.d.ts.map +1 -1
  20. package/dist/adapters/loop-row-type.d.ts +52 -0
  21. package/dist/adapters/loop-row-type.d.ts.map +1 -0
  22. package/dist/adapters/nil-reading.d.ts +68 -0
  23. package/dist/adapters/nil-reading.d.ts.map +1 -0
  24. package/dist/adapters/non-primitive-equality.d.ts +33 -0
  25. package/dist/adapters/non-primitive-equality.d.ts.map +1 -0
  26. package/dist/adapters/number-value.d.ts +45 -0
  27. package/dist/adapters/number-value.d.ts.map +1 -0
  28. package/dist/adapters/operand-typing.d.ts +126 -0
  29. package/dist/adapters/operand-typing.d.ts.map +1 -0
  30. package/dist/adapters/parsed-expr-emitter.d.ts +70 -12
  31. package/dist/adapters/parsed-expr-emitter.d.ts.map +1 -1
  32. package/dist/adapters/primitive-plan.d.ts +291 -0
  33. package/dist/adapters/primitive-plan.d.ts.map +1 -0
  34. package/dist/analyzer-context.d.ts +11 -0
  35. package/dist/analyzer-context.d.ts.map +1 -1
  36. package/dist/analyzer.d.ts +34 -0
  37. package/dist/analyzer.d.ts.map +1 -1
  38. package/dist/augment-inherited-props.d.ts +63 -8
  39. package/dist/augment-inherited-props.d.ts.map +1 -1
  40. package/dist/compiler.d.ts.map +1 -1
  41. package/dist/event-handler-name.d.ts +12 -0
  42. package/dist/event-handler-name.d.ts.map +1 -1
  43. package/dist/expression-parser.d.ts +8 -0
  44. package/dist/expression-parser.d.ts.map +1 -1
  45. package/dist/index.d.ts +24 -11
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +5671 -2586
  48. package/dist/ir-to-client-js/build-references.d.ts.map +1 -1
  49. package/dist/ir-to-client-js/child-props-object.d.ts +64 -0
  50. package/dist/ir-to-client-js/child-props-object.d.ts.map +1 -0
  51. package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
  52. package/dist/ir-to-client-js/control-flow/plan/build-component-loop.d.ts.map +1 -1
  53. package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts +29 -0
  54. package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts.map +1 -1
  55. package/dist/ir-to-client-js/control-flow/plan/build-lazy-row.d.ts +2 -0
  56. package/dist/ir-to-client-js/control-flow/plan/build-lazy-row.d.ts.map +1 -1
  57. package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts.map +1 -1
  58. package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts.map +1 -1
  59. package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts +5 -4
  60. package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts.map +1 -1
  61. package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts +2 -0
  62. package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts.map +1 -1
  63. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +15 -0
  64. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
  65. package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts +2 -0
  66. package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts.map +1 -1
  67. package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
  68. package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts +22 -0
  69. package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts.map +1 -1
  70. package/dist/ir-to-client-js/control-flow/stringify/component-loop.d.ts.map +1 -1
  71. package/dist/ir-to-client-js/control-flow/stringify/event-listener.d.ts +1 -1
  72. package/dist/ir-to-client-js/control-flow/stringify/event-listener.d.ts.map +1 -1
  73. package/dist/ir-to-client-js/control-flow/stringify/lazy-row.d.ts.map +1 -1
  74. package/dist/ir-to-client-js/html-template.d.ts +3 -2
  75. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  76. package/dist/ir-to-client-js/imports.d.ts +2 -2
  77. package/dist/ir-to-client-js/imports.d.ts.map +1 -1
  78. package/dist/ir-to-client-js/index.d.ts +2 -6
  79. package/dist/ir-to-client-js/index.d.ts.map +1 -1
  80. package/dist/ir-to-client-js/plan/build-static-array-child-init.d.ts.map +1 -1
  81. package/dist/ir-to-client-js/plan/static-array-child-init.d.ts +37 -19
  82. package/dist/ir-to-client-js/plan/static-array-child-init.d.ts.map +1 -1
  83. package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
  84. package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
  85. package/dist/ir-to-client-js/safe-html.d.ts +9 -3
  86. package/dist/ir-to-client-js/safe-html.d.ts.map +1 -1
  87. package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts +3 -2
  88. package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts.map +1 -1
  89. package/dist/ir-to-client-js/types.d.ts +30 -0
  90. package/dist/ir-to-client-js/types.d.ts.map +1 -1
  91. package/dist/ir-to-client-js/utils.d.ts +8 -0
  92. package/dist/ir-to-client-js/utils.d.ts.map +1 -1
  93. package/dist/jsx-to-ir.d.ts +1 -0
  94. package/dist/jsx-to-ir.d.ts.map +1 -1
  95. package/dist/nullable-signal-attr.d.ts +95 -10
  96. package/dist/nullable-signal-attr.d.ts.map +1 -1
  97. package/dist/prop-rewrite.d.ts +7 -0
  98. package/dist/prop-rewrite.d.ts.map +1 -1
  99. package/dist/props-binding.d.ts +27 -3
  100. package/dist/props-binding.d.ts.map +1 -1
  101. package/dist/props-object-whole-read.d.ts +15 -0
  102. package/dist/props-object-whole-read.d.ts.map +1 -0
  103. package/dist/rich-type-refusal.d.ts.map +1 -1
  104. package/dist/scope/binding-scope.d.ts +100 -4
  105. package/dist/scope/binding-scope.d.ts.map +1 -1
  106. package/dist/scope/lexical-scope-walk.d.ts +3 -2
  107. package/dist/scope/lexical-scope-walk.d.ts.map +1 -1
  108. package/dist/scope/root-prop-alias.d.ts +16 -0
  109. package/dist/scope/root-prop-alias.d.ts.map +1 -1
  110. package/dist/signal-prop-name-collision.d.ts.map +1 -1
  111. package/dist/ssr-defaults.d.ts +4 -2
  112. package/dist/ssr-defaults.d.ts.map +1 -1
  113. package/dist/ssr-seed-plan.d.ts +14 -0
  114. package/dist/ssr-seed-plan.d.ts.map +1 -1
  115. package/dist/strip-types.d.ts +13 -0
  116. package/dist/strip-types.d.ts.map +1 -1
  117. package/dist/template-parts.d.ts.map +1 -1
  118. package/dist/template-position-walk.d.ts +21 -3
  119. package/dist/template-position-walk.d.ts.map +1 -1
  120. package/dist/types.d.ts +120 -0
  121. package/dist/types.d.ts.map +1 -1
  122. package/package.json +2 -2
  123. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +3 -3
  124. package/src/__tests__/binding-scope-ratchet.test.ts +12 -2
  125. package/src/__tests__/binding-scope.test.ts +89 -1
  126. package/src/__tests__/body-destructure-props-object-alias.test.ts +123 -0
  127. package/src/__tests__/boolean-carrier.test.ts +74 -0
  128. package/src/__tests__/boolean-result.test.ts +22 -5
  129. package/src/__tests__/brace-delimiter-text.test.ts +26 -0
  130. package/src/__tests__/callback-method.test.ts +62 -2
  131. package/src/__tests__/child-components-in-map.test.ts +1 -1
  132. package/src/__tests__/component-props.test.ts +14 -0
  133. package/src/__tests__/computed-const.test.ts +188 -0
  134. package/src/__tests__/emit-to-string-call.test.ts +2 -1
  135. package/src/__tests__/expression-parser.test.ts +24 -0
  136. package/src/__tests__/hydration-payload-analysis.test.ts +166 -0
  137. package/src/__tests__/issue-2724-prop-alias-loop-not-static.test.ts +7 -7
  138. package/src/__tests__/issue-2754-rest-spread-needs-slot.test.ts +5 -2
  139. package/src/__tests__/issue-2798-static-nested-loop-bindings.test.ts +1 -1
  140. package/src/__tests__/issue-2835-props-type-member-name-collision.test.ts +4 -4
  141. package/src/__tests__/issue-3044-nested-prop-object-array-not-static.test.ts +1 -1
  142. package/src/__tests__/issue-3688-props-spread-child-csr.test.ts +143 -0
  143. package/src/__tests__/issue-3713-props-spread-loop-row.test.ts +65 -0
  144. package/src/__tests__/lookup-literal-const.test.ts +9 -3
  145. package/src/__tests__/loop-index-reactivity.test.ts +2 -2
  146. package/src/__tests__/loop-param-accessor-key-member-safety.test.ts +1 -1
  147. package/src/__tests__/loop-plan.test.ts +1 -1
  148. package/src/__tests__/loop-row-const-initializer-shadow.test.ts +146 -0
  149. package/src/__tests__/loop-row-prop-read.test.ts +111 -0
  150. package/src/__tests__/loop-row-type.test.ts +64 -0
  151. package/src/__tests__/lowering-value-position.test.ts +4 -0
  152. package/src/__tests__/memo-body-expr.test.ts +137 -0
  153. package/src/__tests__/module-const-destructure-default.test.ts +156 -0
  154. package/src/__tests__/nested-loop-index-param.test.ts +1 -1
  155. package/src/__tests__/nested-loop-reactive-attrs.test.ts +2 -2
  156. package/src/__tests__/nested-row-shadowing.test.ts +2 -2
  157. package/src/__tests__/nil-reading.test.ts +77 -0
  158. package/src/__tests__/nullable-signal-attr.test.ts +231 -2
  159. package/src/__tests__/primitive-plan.test.ts +416 -0
  160. package/src/__tests__/profile-binding-ids.test.ts +14 -0
  161. package/src/__tests__/profile-loop-binding-ids.test.ts +2 -2
  162. package/src/__tests__/profile-nested-binding-ids.test.ts +2 -2
  163. package/src/__tests__/props-object-whole-read.test.ts +40 -0
  164. package/src/__tests__/reactive-attrs-in-map.test.ts +1 -1
  165. package/src/__tests__/reactive-factory-inlining.test.ts +4 -1
  166. package/src/__tests__/rest-binding-gaps.test.ts +192 -0
  167. package/src/__tests__/root-prop-alias.test.ts +79 -1
  168. package/src/__tests__/signal-prop-name-collision.test.ts +102 -2
  169. package/src/__tests__/source-file-cache.test.ts +105 -0
  170. package/src/__tests__/ssr-seed-plan.test.ts +43 -0
  171. package/src/__tests__/static-loop-csr-materialize.test.ts +2 -2
  172. package/src/__tests__/static-record-literal-array.test.ts +171 -0
  173. package/src/__tests__/string-concat-identifier.test.ts +40 -1
  174. package/src/__tests__/template-parts-literal-boundary.test.ts +19 -0
  175. package/src/adapters/ambiguous-nil-arithmetic.ts +103 -0
  176. package/src/adapters/attr-plan.ts +6 -2
  177. package/src/adapters/boolean-carrier.ts +76 -0
  178. package/src/adapters/boolean-result.ts +72 -66
  179. package/src/adapters/brace-delimiter-text.ts +25 -0
  180. package/src/adapters/callback-method.ts +151 -27
  181. package/src/adapters/component-props.ts +28 -8
  182. package/src/adapters/computed-const.ts +443 -10
  183. package/src/adapters/dsl-template-adapter.ts +79 -2
  184. package/src/adapters/loop-bound-names.ts +9 -1
  185. package/src/adapters/loop-plan.ts +1 -1
  186. package/src/adapters/loop-row-type.ts +139 -0
  187. package/src/adapters/nil-reading.ts +297 -0
  188. package/src/adapters/non-primitive-equality.ts +92 -0
  189. package/src/adapters/number-value.ts +108 -0
  190. package/src/adapters/operand-typing.ts +522 -0
  191. package/src/adapters/parsed-expr-emitter.ts +154 -19
  192. package/src/adapters/primitive-plan.ts +696 -0
  193. package/src/analyzer-context.ts +14 -0
  194. package/src/analyzer.ts +692 -85
  195. package/src/augment-inherited-props.ts +108 -10
  196. package/src/compiler.ts +17 -0
  197. package/src/event-handler-name.ts +15 -0
  198. package/src/expression-parser.ts +74 -2
  199. package/src/index.ts +45 -9
  200. package/src/ir-to-client-js/build-references.ts +69 -0
  201. package/src/ir-to-client-js/child-props-object.ts +106 -0
  202. package/src/ir-to-client-js/collect-elements.ts +100 -67
  203. package/src/ir-to-client-js/compute-inlinability.ts +1 -1
  204. package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +15 -1
  205. package/src/ir-to-client-js/control-flow/plan/build-inner-loop.ts +85 -5
  206. package/src/ir-to-client-js/control-flow/plan/build-lazy-row.ts +3 -0
  207. package/src/ir-to-client-js/control-flow/plan/build-loop-child-arm.ts +30 -28
  208. package/src/ir-to-client-js/control-flow/plan/build-reactive-effects.ts +1 -0
  209. package/src/ir-to-client-js/control-flow/plan/inner-loop.ts +5 -4
  210. package/src/ir-to-client-js/control-flow/plan/loop-child-arm.ts +2 -0
  211. package/src/ir-to-client-js/control-flow/plan/loop.ts +12 -0
  212. package/src/ir-to-client-js/control-flow/plan/reactive-effects.ts +2 -0
  213. package/src/ir-to-client-js/control-flow/shared.ts +23 -24
  214. package/src/ir-to-client-js/control-flow/stringify/claim-plan.ts +29 -0
  215. package/src/ir-to-client-js/control-flow/stringify/component-loop.ts +8 -2
  216. package/src/ir-to-client-js/control-flow/stringify/event-listener.ts +8 -1
  217. package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +8 -7
  218. package/src/ir-to-client-js/control-flow/stringify/lazy-row.ts +8 -7
  219. package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +4 -4
  220. package/src/ir-to-client-js/control-flow/stringify/loop.ts +3 -3
  221. package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +6 -6
  222. package/src/ir-to-client-js/emit-reactive.ts +1 -1
  223. package/src/ir-to-client-js/html-template.ts +95 -38
  224. package/src/ir-to-client-js/imports.ts +1 -1
  225. package/src/ir-to-client-js/index.ts +53 -11
  226. package/src/ir-to-client-js/plan/build-static-array-child-init.ts +42 -15
  227. package/src/ir-to-client-js/plan/static-array-child-init.ts +34 -19
  228. package/src/ir-to-client-js/prop-handling.ts +22 -3
  229. package/src/ir-to-client-js/reactivity.ts +14 -0
  230. package/src/ir-to-client-js/safe-html.ts +11 -4
  231. package/src/ir-to-client-js/stringify/static-array-child-init.ts +30 -12
  232. package/src/ir-to-client-js/types.ts +23 -0
  233. package/src/ir-to-client-js/utils.ts +15 -1
  234. package/src/jsx-to-ir.ts +510 -58
  235. package/src/nullable-signal-attr.ts +366 -28
  236. package/src/prop-rewrite.ts +30 -6
  237. package/src/props-binding.ts +54 -3
  238. package/src/props-object-whole-read.ts +87 -0
  239. package/src/rich-type-refusal.ts +2 -1
  240. package/src/scope/binding-scope.ts +203 -11
  241. package/src/scope/lexical-scope-walk.ts +4 -3
  242. package/src/scope/root-prop-alias.ts +23 -0
  243. package/src/signal-prop-name-collision.ts +113 -22
  244. package/src/ssr-defaults.ts +10 -4
  245. package/src/ssr-seed-plan.ts +82 -17
  246. package/src/strip-types.ts +31 -3
  247. package/src/template-parts.ts +21 -1
  248. package/src/template-position-walk.ts +57 -28
  249. package/src/types.ts +117 -0
@@ -0,0 +1,166 @@
1
+ /**
2
+ * What the client reads beyond its named props, decided before the adapter
3
+ * runs (#3845): a destructured prop read only in a `.filter()` predicate
4
+ * reaches the module-scope client template as `_p.<key>`, a closed-type rest
5
+ * key the client reads is in `clientAnalysis.usedRestKeys`, and a spread of
6
+ * a whole caller bag sets `clientAnalysis.readsCallerBag`.
7
+ *
8
+ * The rendered shapes are conformance fixtures (`filter-predicate-on-prefixed-prop`,
9
+ * `rest-spread-root-hydration-props`, …). These pin the name-binding edges
10
+ * the fixtures do not reach: a filter parameter or a loop row named like the
11
+ * prop or the bag.
12
+ */
13
+
14
+ import { describe, test, expect } from 'bun:test'
15
+ import { compileJSX } from '../compiler'
16
+ import { TestAdapter } from '../adapters/test-adapter'
17
+ import { isHydrationPayloadPropName } from '../event-handler-name'
18
+ import type { ComponentIR } from '../types'
19
+
20
+ const adapter = new TestAdapter()
21
+
22
+ function compile(source: string): { js: string; ir: ComponentIR } {
23
+ const result = compileJSX(source, 'C.tsx', { adapter, outputIR: true })
24
+ expect(result.errors.filter(e => e.severity === 'error')).toHaveLength(0)
25
+ const js = result.files.find(f => f.type === 'clientJs')!.content
26
+ const irs = result.files.filter(f => f.type === 'ir').map(f => JSON.parse(f.content) as ComponentIR)
27
+ const ir = irs.find(c => c.metadata.componentName === 'C')!
28
+ return { js, ir }
29
+ }
30
+
31
+ /** The `template: (_p) => …` lambda the client registers for `C`. */
32
+ function templateLine(js: string): string {
33
+ const line = js.split('\n').find(l => l.includes("hydrate('C'") && l.includes('template: (_p) =>'))
34
+ expect(line).toBeDefined()
35
+ return line!
36
+ }
37
+
38
+ /** Everything the client registers for `C`, including a multi-line template. */
39
+ function templateSource(js: string): string {
40
+ const start = js.indexOf("hydrate('C'")
41
+ expect(start).toBeGreaterThanOrEqual(0)
42
+ return js.slice(start)
43
+ }
44
+
45
+ describe('filter predicate in the client template (#3845)', () => {
46
+ test('a destructured prop read in the predicate becomes `_p.<key>`', () => {
47
+ const { js } = compile(`
48
+ 'use client'
49
+ export function C({ keys, one }: { keys: string[]; one: string }) {
50
+ return <ul>{keys.filter(k => k === one).map(k => <li key={k}>{k}</li>)}</ul>
51
+ }
52
+ `)
53
+ expect(templateLine(js)).toContain('.filter(k => k === _p.one)')
54
+ })
55
+
56
+ test('the predicate parameter keeps its name when a prop shares it', () => {
57
+ const { js } = compile(`
58
+ 'use client'
59
+ export function C({ keys, k }: { keys: string[]; k: string }) {
60
+ return <div data-k={k}><ul>{keys.filter(k => k !== '').map(v => <li key={v}>{v}</li>)}</ul></div>
61
+ }
62
+ `)
63
+ expect(templateLine(js)).toContain(".filter(k => k !== '')")
64
+ })
65
+
66
+ test('an enclosing row binding named like the prop keeps its name', () => {
67
+ const { js } = compile(`
68
+ 'use client'
69
+ export function C({ groups, one }: { groups: { one: string; keys: string[] }[]; one: string }) {
70
+ return (
71
+ <div data-one={one}>
72
+ {groups.map(({ one, keys }) => (
73
+ <ul key={one}>{keys.filter(k => k === one).map(k => <li key={k}>{k}</li>)}</ul>
74
+ ))}
75
+ </div>
76
+ )
77
+ }
78
+ `)
79
+ const line = templateLine(js)
80
+ expect(line).toContain('.filter(k => k === one)')
81
+ expect(line).not.toContain('k === _p.one')
82
+ })
83
+
84
+ test('a block body rewrites the outer read and keeps an inner `const` of the same name', () => {
85
+ const { js } = compile(`
86
+ 'use client'
87
+ export function C({ keys, one }: { keys: string[]; one: string }) {
88
+ return <ul>{keys.filter(k => {
89
+ const v = one
90
+ if (k === 'a') {
91
+ const one = 'a'
92
+ return k === one
93
+ }
94
+ return k === v
95
+ }).map(k => <li key={k}>{k}</li>)}</ul>
96
+ }
97
+ `)
98
+ const tpl = templateSource(js)
99
+ expect(tpl).toContain('const v = _p.one')
100
+ expect(tpl).toContain("const one = 'a'")
101
+ expect(tpl).toContain('return k === one')
102
+ expect(tpl).not.toContain('const _p.one')
103
+ })
104
+
105
+ test('a block body keeps a nested-block `var` hoisted over the whole body', () => {
106
+ const { js } = compile(`
107
+ 'use client'
108
+ export function C({ keys, one }: { keys: string[]; one: string }) {
109
+ return <ul>{keys.filter(k => {
110
+ if (k === 'a') {
111
+ var one = 'a'
112
+ }
113
+ return k === one
114
+ }).map(k => <li key={k}>{k}</li>)}</ul>
115
+ }
116
+ `)
117
+ const tpl = templateSource(js)
118
+ expect(tpl).toContain('return k === one')
119
+ expect(tpl).not.toContain('_p.one')
120
+ })
121
+ })
122
+
123
+ describe('client analysis of the hydration payload (#3845)', () => {
124
+ test('closed-type rest keys the client reads are listed', () => {
125
+ const { ir } = compile(`
126
+ 'use client'
127
+ export function C({ label, ...rest }: { label: string; tone?: string; size?: string }) {
128
+ return <button {...rest} onClick={() => {}}>{label}</button>
129
+ }
130
+ `)
131
+ expect(ir.metadata.clientAnalysis?.usedRestKeys).toEqual(['tone', 'size'])
132
+ expect(ir.metadata.clientAnalysis?.readsCallerBag).toBe(false)
133
+ })
134
+
135
+ test('a whole props-object spread onto a child reads the caller bag', () => {
136
+ const { ir } = compile(`
137
+ 'use client'
138
+ function Chip(props: { label: string }) { return <button onClick={() => {}}>{props.label}</button> }
139
+ export function C(props: { label: string }) {
140
+ return <div><Chip {...props} /></div>
141
+ }
142
+ `)
143
+ expect(ir.metadata.clientAnalysis?.readsCallerBag).toBe(true)
144
+ })
145
+
146
+ test('a loop row named like the props object is not the caller bag', () => {
147
+ const { ir } = compile(`
148
+ 'use client'
149
+ function Chip(p: { label: string }) { return <button onClick={() => {}}>{p.label}</button> }
150
+ export function C(props: { rows: { label: string }[] }) {
151
+ return <div>{props.rows.map((props) => <Chip key={props.label} {...props} />)}</div>
152
+ }
153
+ `)
154
+ expect(ir.metadata.clientAnalysis?.readsCallerBag).toBe(false)
155
+ })
156
+ })
157
+
158
+ describe('isHydrationPayloadPropName', () => {
159
+ test('`on[A-Z]` handlers and `__` plumbing stay out; `on`-prefixed data props travel', () => {
160
+ expect(isHydrationPayloadPropName('onClick')).toBe(false)
161
+ expect(isHydrationPayloadPropName('__instanceId')).toBe(false)
162
+ for (const name of ['on', 'one', 'only', 'once', 'online']) {
163
+ expect(isHydrationPayloadPropName(name)).toBe(true)
164
+ }
165
+ })
166
+ })
@@ -3,10 +3,10 @@
3
3
  * `.map()` of child components made the loop's array look, to
4
4
  * `isArrayExprDirectPropRef` (jsx-to-ir.ts), like a local constant with no
5
5
  * prop/signal origin. The loop was then classified `isStaticArray: true`
6
- * and compiled to the static `qsaChildScopes` + `forEach` init path instead
6
+ * and compiled to the static `childScopesBySlot` + `forEach` init path instead
7
7
  * of `mapArray`. That static path's `renderChild()` calls (client runtime)
8
8
  * carry no `bf-h`/`bf-m` scope-relationship attributes on a CSR-only mount
9
- * (no existing SSR markup to hydrate against), so the `qsaChildScopes`
9
+ * (no existing SSR markup to hydrate against), so the `childScopesBySlot`
10
10
  * selector in the static init never matches — the row's child component
11
11
  * never gets `initChild`ed, so its signals and event listeners never wire
12
12
  * up. Found by the #2481 mutation sweep's `alias-props` mutation against
@@ -100,7 +100,7 @@ describe('#2724 — prop-alias keyed loop stays on mapArray, not the static path
100
100
  }
101
101
  `, 'AliasHop.tsx')
102
102
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
103
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
103
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
104
104
  })
105
105
 
106
106
  test('local const derived from a whole-props member access uses mapArray', () => {
@@ -115,7 +115,7 @@ describe('#2724 — prop-alias keyed loop stays on mapArray, not the static path
115
115
  }
116
116
  `, 'MemberAlias.tsx')
117
117
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
118
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
118
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
119
119
  })
120
120
 
121
121
  test('two-hop alias chain uses mapArray', () => {
@@ -131,7 +131,7 @@ describe('#2724 — prop-alias keyed loop stays on mapArray, not the static path
131
131
  }
132
132
  `, 'TwoHop.tsx')
133
133
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
134
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
134
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
135
135
  })
136
136
 
137
137
  test('an alias of the WHOLE props object, accessed via property access, uses mapArray', () => {
@@ -202,7 +202,7 @@ describe('#2724 — prop-alias keyed loop stays on mapArray, not the static path
202
202
  return <div>{ITEMS.map((item) => <Item key={item.label} label={item.label} />)}</div>
203
203
  }
204
204
  `, 'ModuleConst.tsx')
205
- expect(clientJs).toMatch(/qsaChildScopes\(/)
205
+ expect(clientJs).toMatch(/childScopesBySlot\(/)
206
206
  expect(clientJs).not.toMatch(/\bmapArray(Lazy)?\s*\(/)
207
207
  })
208
208
 
@@ -221,7 +221,7 @@ describe('#2724 — prop-alias keyed loop stays on mapArray, not the static path
221
221
  return <div>{state.items.map((item) => <Item key={item.label} label={item.label} />)}</div>
222
222
  }
223
223
  `, 'NameCollision.tsx')
224
- expect(clientJs).toMatch(/qsaChildScopes\(/)
224
+ expect(clientJs).toMatch(/childScopesBySlot\(/)
225
225
  expect(clientJs).not.toMatch(/\bmapArray(Lazy)?\s*\(/)
226
226
  })
227
227
 
@@ -70,10 +70,13 @@ describe('#2754 — a caller-props forward earns a slot and an init', () => {
70
70
  test('a spread of an ordinary object still inlines into the template and earns no slot', () => {
71
71
  // Reverse direction: only the caller-props forward is unknowable at
72
72
  // compile time. An ordinary object spread is fully emitted by both
73
- // templates and must not start allocating slot ids.
73
+ // templates and must not start allocating slot ids. (Its value reads a
74
+ // name, so it stays a spread: a static literal one is expanded per key
75
+ // in Phase 1, #3844.)
74
76
  const { clientJs, template } = compile(`
75
77
  "use client";
76
- const extra = { title: 'x' }
78
+ const TITLE = 'x'
79
+ const extra = { title: TITLE }
77
80
  export function Ordinary() {
78
81
  return <span className="plain" {...extra} />
79
82
  }
@@ -97,7 +97,7 @@ export function StaticNestedSignalCase() {
97
97
  const js = compileClientJs(source)
98
98
  // Pre-fix, this text was frozen at its SSR-baked value — no
99
99
  // `createEffect` at all inside the inner forEach body.
100
- expect(js).toMatch(/createEffect\(\(\) => \{ __bfw_\w+\('s\d+', String\(count\(\)\)\) \}\)/)
100
+ expect(js).toMatch(/createEffect\(\(\) => \{ __bfw_\w+\('s\d+', textOrNode\(count\(\)\)\) \}\)/)
101
101
  })
102
102
 
103
103
  test('a static outer loop with a nested .map() wires a reactive attr on the inner element', () => {
@@ -169,7 +169,7 @@ describe('#2835 — name collision with a whole-props type member is not prop-de
169
169
  }
170
170
  `, 'DestructuredRegression.tsx')
171
171
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
172
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
172
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
173
173
  })
174
174
 
175
175
  test('regression guard: a renamed destructure ({ base: rows }) still resolves to mapArray', () => {
@@ -183,7 +183,7 @@ describe('#2835 — name collision with a whole-props type member is not prop-de
183
183
  }
184
184
  `, 'RenamedDestructureRegression.tsx')
185
185
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
186
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
186
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
187
187
  })
188
188
 
189
189
  test('regression guard: a renamed destructure keeps a same-named module const static (no name collision through the rename)', () => {
@@ -212,7 +212,7 @@ describe('#2835 — name collision with a whole-props type member is not prop-de
212
212
  }
213
213
  `, 'WholePropsBodyDestructure.tsx')
214
214
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
215
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
215
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
216
216
  })
217
217
 
218
218
  test('regression guard: direct `props.base` access still resolves to mapArray', () => {
@@ -226,7 +226,7 @@ describe('#2835 — name collision with a whole-props type member is not prop-de
226
226
  }
227
227
  `, 'DirectMemberAccessRegression.tsx')
228
228
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
229
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
229
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
230
230
  })
231
231
 
232
232
  test('regression guard: a rest-spread sibling name is unaffected (no collision to guard against)', () => {
@@ -84,7 +84,7 @@ describe('#3044 — nested array off a destructured object prop uses mapArray, n
84
84
  }
85
85
  `, 'ReproChild.tsx')
86
86
  expect(clientJs).toMatch(/\bmapArray(Lazy)?\s*\(/)
87
- expect(clientJs).not.toMatch(/qsaChildScopes\(/)
87
+ expect(clientJs).not.toMatch(/childScopesBySlot\(/)
88
88
  })
89
89
 
90
90
  test('flags: `data.items.map(...)` is classified isPropDerivedArray / non-static', () => {
@@ -0,0 +1,143 @@
1
+ /**
2
+ * #3688 — a `{...props}` spread onto a child component in the client JS.
3
+ *
4
+ * Phase 1 marks a child-component spread of the component's own props
5
+ * object (`SpreadAttr.propsObject`). The client then keeps that spread at
6
+ * its source position in the registration template's `renderChild(...)`
7
+ * props, and reads an explicit prop written before it from the caller's
8
+ * props first in `initChild`'s `forwardProps(...)` overrides, so both merge
9
+ * like the JSX call does. A `{...rest}` bag is not the caller's props (it
10
+ * leaves out the destructured keys) and is not marked.
11
+ *
12
+ * The end-to-end runtime check lives in
13
+ * `packages/client/__tests__/runtime/issue-3688-props-spread-merge.test.ts`;
14
+ * the rendered output is pinned by the `component-spread-*` conformance
15
+ * fixtures.
16
+ */
17
+ import { describe, test, expect } from 'bun:test'
18
+ import { compileJSX } from '../compiler'
19
+ import { TestAdapter } from '../adapters/test-adapter'
20
+ import { analyzeComponent } from '../analyzer'
21
+ import { jsxToIR } from '../jsx-to-ir'
22
+ import type { IRNode, IRComponent } from '../types'
23
+
24
+ const adapter = new TestAdapter()
25
+
26
+ function clientJs(source: string): string {
27
+ const result = compileJSX(source, 'Repro.tsx', { adapter })
28
+ expect(result.errors.filter(e => e.severity === 'error')).toHaveLength(0)
29
+ return result.files.find(f => f.type === 'clientJs')!.content
30
+ }
31
+
32
+ function findComponent(node: IRNode, name: string): IRComponent | null {
33
+ if (node.type === 'component' && node.name === name) return node
34
+ const children = 'children' in node && Array.isArray(node.children) ? (node.children as IRNode[]) : []
35
+ for (const child of children) {
36
+ const found = findComponent(child, name)
37
+ if (found) return found
38
+ }
39
+ return null
40
+ }
41
+
42
+ function tagSpread(source: string, componentName: string) {
43
+ const ctx = analyzeComponent(source, 'Repro.tsx', componentName)
44
+ const ir = jsxToIR(ctx)!
45
+ const tag = findComponent(ir, 'Tag')!
46
+ return tag.props.find(p => p.name === '...')!.value
47
+ }
48
+
49
+ describe('#3688 — Phase 1 marks a props-object spread onto a child', () => {
50
+ test('the props object, directly and through an alias, is marked', () => {
51
+ expect(tagSpread(`
52
+ import { Tag } from './tag'
53
+ export function A(props: { tone?: string }) { return <p><Tag {...props} /></p> }
54
+ `, 'A')).toMatchObject({ kind: 'spread', propsObject: true })
55
+ expect(tagSpread(`
56
+ import { Tag } from './tag'
57
+ export function B(props: { tone?: string }) { const p2 = props; return <p><Tag {...p2} /></p> }
58
+ `, 'B')).toMatchObject({ kind: 'spread', propsObject: true })
59
+ })
60
+
61
+ test('an open rest bag and an ordinary object are not marked', () => {
62
+ const rest = tagSpread(`
63
+ import { Tag } from './tag'
64
+ export function C({ title, ...rest }: { title?: string; [key: string]: any }) {
65
+ return <p title={title}><Tag {...rest} /></p>
66
+ }
67
+ `, 'C')
68
+ expect(rest.kind).toBe('spread')
69
+ expect(rest).not.toHaveProperty('propsObject')
70
+ const local = tagSpread(`
71
+ import { Tag } from './tag'
72
+ export function D(props: { tone?: string }) { const extra = { tone: props.tone }; return <p><Tag {...extra} /></p> }
73
+ `, 'D')
74
+ expect(local.kind).toBe('spread')
75
+ expect(local).not.toHaveProperty('propsObject')
76
+ })
77
+ })
78
+
79
+ describe('#3688 — the client JS merges a props-object spread in source order', () => {
80
+ const source = `
81
+ import { Tag } from './tag'
82
+ export function Parent(props: { tone?: string; size?: string; label?: string }) {
83
+ return <p><Tag tone="first" size="s" {...props} label="last" /></p>
84
+ }
85
+ `
86
+
87
+ test('the registration template keeps the spread between the explicit props', () => {
88
+ expect(clientJs(source)).toContain(`renderChild('Tag', {tone: "first", size: "s", ..._p, label: "last"}`)
89
+ })
90
+
91
+ test("initChild reads an explicit prop written before the spread from the caller's props first", () => {
92
+ const js = clientJs(source)
93
+ expect(js).toContain(`get tone() { return ("tone" in _p ? _p["tone"] : "first") }`)
94
+ expect(js).toContain(`get size() { return ("size" in _p ? _p["size"] : "s") }`)
95
+ // A prop after the spread always wins: a plain override.
96
+ expect(js).toContain(`label: "last" }`)
97
+ })
98
+
99
+ test('both reactive DOM mirrors read an overridden explicit prop caller-first, like initChild', () => {
100
+ const js = clientJs(`
101
+ 'use client'
102
+ import { createSignal } from '@barefootjs/client'
103
+ import { Tag } from './tag'
104
+ export function Live(props: { title?: string }) {
105
+ const [title, setTitle] = createSignal('first')
106
+ return <p onClick={() => setTitle('second')}><Tag title={title()} {...props} last={title()} /></p>
107
+ }
108
+ `)
109
+ const callerFirst = `("title" in _p ? _p["title"] : bfSignal_title())`
110
+ expect(js).toContain(`get title() { return ${callerFirst} }`)
111
+ // The signal-getter mirror (`ctx.reactiveProps`) and the child-prop
112
+ // mirror (`ctx.reactiveChildProps`) write the same merged value.
113
+ expect(js).toContain(`const __v = ${callerFirst};`)
114
+ expect(js).toContain(`const __x = ${callerFirst}`)
115
+ // A prop after the spread is never shadowed.
116
+ expect(js).not.toContain(`"last" in _p`)
117
+ })
118
+
119
+ test('a conditional branch template keeps the spread too', () => {
120
+ const js = clientJs(`
121
+ 'use client'
122
+ import { createSignal } from '@barefootjs/client'
123
+ import { Tag } from './tag'
124
+ export function Toggle(props: { tone?: string }) {
125
+ const [on, setOn] = createSignal(true)
126
+ return <div onClick={() => setOn(!on())}>{on() ? <Tag {...props} tone="x" /> : <i>off</i>}</div>
127
+ }
128
+ `)
129
+ expect(js).toContain(`renderChild('Tag', {..._p, tone: "x"}`)
130
+ expect(js).not.toContain(`"tone" in _p`)
131
+ })
132
+
133
+ test('an open rest bag stays out of the template props', () => {
134
+ const js = clientJs(`
135
+ import { Tag } from './tag'
136
+ export function Rest({ title, ...rest }: { title?: string; [key: string]: any }) {
137
+ return <p title={title}><Tag title="x" {...rest} /></p>
138
+ }
139
+ `)
140
+ expect(js).toContain(`renderChild('Tag', {title: "x"}`)
141
+ expect(js).not.toContain(`"title" in _p`)
142
+ })
143
+ })
@@ -0,0 +1,65 @@
1
+ /**
2
+ * #3713 — Phase 1's props-object spread marker (`SpreadAttr.propsObject`)
3
+ * on a child component inside a loop row. The client's loop-row props
4
+ * builders merge a marked spread in source order through the shared
5
+ * `childPropsObjectExpr`, so the marker must be set on a row's
6
+ * `{...props}` and must not be set when a row binding named `props`
7
+ * shadows the props object.
8
+ *
9
+ * The end-to-end runtime check (mount, row update, hydration) lives in
10
+ * `packages/client/__tests__/runtime/issue-3713-props-spread-loop-row.test.ts`;
11
+ * the rendered output is pinned by the `component-*-in-loop-row` and
12
+ * `component-spread-props-in-static-loop-row` conformance fixtures.
13
+ */
14
+ import { describe, test, expect } from 'bun:test'
15
+ import { analyzeComponent } from '../analyzer'
16
+ import { jsxToIR } from '../jsx-to-ir'
17
+ import type { IRNode, IRComponent, AttrValue } from '../types'
18
+
19
+ function findComponents(node: IRNode, name: string, out: IRComponent[] = []): IRComponent[] {
20
+ if (node.type === 'component' && node.name === name) out.push(node)
21
+ const children: IRNode[] = []
22
+ if ('children' in node && Array.isArray(node.children)) children.push(...(node.children as IRNode[]))
23
+ if (node.type === 'conditional') children.push(node.whenTrue, node.whenFalse)
24
+ for (const child of children) findComponents(child, name, out)
25
+ return out
26
+ }
27
+
28
+ function tagSpreads(source: string, componentName: string): AttrValue[] {
29
+ const ctx = analyzeComponent(source, 'Repro.tsx', componentName)
30
+ const ir = jsxToIR(ctx)!
31
+ return findComponents(ir, 'Tag').map(tag => tag.props.find(p => p.name.startsWith('...'))!.value)
32
+ }
33
+
34
+ describe('#3713 — the props-object spread marker in loop rows', () => {
35
+ test('a row spread of the props object is marked in every row shape', () => {
36
+ const spreads = tagSpreads(`
37
+ import { Tag } from './tag'
38
+ export function List(props: { items: string[]; groups: { id: string; cells: string[] }[]; tone?: string }) {
39
+ const fixed = ['x']
40
+ return (
41
+ <div>
42
+ <ul>{props.items.map((it) => <Tag key={it} {...props} label={it} />)}</ul>
43
+ <ol>{props.items.map((it) => <li key={it}>{props.tone ? <Tag {...props} /> : null}</li>)}</ol>
44
+ <nav>{fixed.map((it) => <Tag key={it} {...props} />)}</nav>
45
+ <dl>{props.groups.map((g) => <dd key={g.id}>{g.cells.map((c) => <Tag key={c} {...props} />)}</dd>)}</dl>
46
+ </div>
47
+ )
48
+ }
49
+ `, 'List')
50
+ expect(spreads).toHaveLength(4)
51
+ for (const spread of spreads) expect(spread).toMatchObject({ kind: 'spread', propsObject: true })
52
+ })
53
+
54
+ test('a loop row named `props` shadows the props object and is not marked', () => {
55
+ const [spread] = tagSpreads(`
56
+ import { Tag } from './tag'
57
+ export function Shadow(props: { rows: { tone: string }[] }) {
58
+ const rows = props.rows
59
+ return <ul>{rows.map((props) => <Tag key={props.tone} {...props} />)}</ul>
60
+ }
61
+ `, 'Shadow')
62
+ expect(spread.kind).toBe('spread')
63
+ expect(spread).not.toHaveProperty('propsObject')
64
+ })
65
+ })
@@ -13,6 +13,8 @@ describe('lookupLiteralConst (#3312)', () => {
13
13
  const consts = constantsOf(`
14
14
  const enabled = false
15
15
  const limit = -2
16
+ const nz = -0
17
+ const big = 1e21
16
18
  const missing = null
17
19
  export function C() {
18
20
  const on = true
@@ -20,7 +22,7 @@ export function C() {
20
22
  const ratio = 1.5
21
23
  const multiline = 'a\\nb'
22
24
  const derived = mode + '!'
23
- return <div data-x={on && enabled ? mode : String(limit + ratio) + derived + multiline} data-m={missing ?? 'm'}>x</div>
25
+ return <div data-x={on && enabled ? mode : String(limit + ratio + nz + big) + derived + multiline} data-m={missing ?? 'm'}>x</div>
24
26
  }
25
27
  `)
26
28
  const never = () => false
@@ -28,8 +30,12 @@ export function C() {
28
30
  test('resolves boolean, number, string and null literals at module and function scope', () => {
29
31
  expect(lookupLiteralConst('on', consts, never)).toEqual({ kind: 'boolean', text: 'true' })
30
32
  expect(lookupLiteralConst('enabled', consts, never)).toEqual({ kind: 'boolean', text: 'false' })
31
- expect(lookupLiteralConst('limit', consts, never)).toEqual({ kind: 'number', text: '-2' })
32
- expect(lookupLiteralConst('ratio', consts, never)).toEqual({ kind: 'number', text: '1.5' })
33
+ expect(lookupLiteralConst('limit', consts, never)).toEqual({ kind: 'number', text: '-2', value: -2 })
34
+ expect(lookupLiteralConst('ratio', consts, never)).toEqual({ kind: 'number', text: '1.5', value: 1.5 })
35
+ // A number carries its value: `-0` keeps its sign, which `text` cannot (#3824 step 6).
36
+ const nz = lookupLiteralConst('nz', consts, never)
37
+ expect(nz?.kind === 'number' && Object.is(nz.value, -0)).toBe(true)
38
+ expect(lookupLiteralConst('big', consts, never)).toEqual({ kind: 'number', text: '1e+21', value: 1e21 })
33
39
  expect(lookupLiteralConst('mode', consts, never)).toEqual({ kind: 'string', text: 'on' })
34
40
  expect(lookupLiteralConst('multiline', consts, never)).toEqual({ kind: 'string', text: 'a\nb' })
35
41
  expect(lookupLiteralConst('missing', consts, never)).toEqual({ kind: 'null', text: 'null' })
@@ -137,7 +137,7 @@ describe('nested loop: referencing an OUTER loop\'s own index (#2861)', () => {
137
137
  // outer accessor must be read directly by name, exactly as `item()`
138
138
  // reads the outer ITEM in the sibling case #2865 already covers.
139
139
  expect(content).toMatch(
140
- /mapArray\(\(\) => g\(\)\.items \|\| \[\], .*?, \(it, __innerIdx\d+_\d+, __existing\) => \{[\s\S]*?createEffect\(\(\) => \{ __bfw_s0\('s0', String\(gi\(\)\)\) \}\)/
140
+ /mapArray\(\(\) => g\(\)\.items \|\| \[\], .*?, \(it, __innerIdx\d+_\d+, __existing\) => \{[\s\S]*?createEffect\(\(\) => \{ __bfw_s0\('s0', textOrNode\(gi\(\)\)\) \}\)/
141
141
  )
142
142
  })
143
143
 
@@ -202,7 +202,7 @@ describe('nested loop: referencing an OUTER loop\'s own index (#2861)', () => {
202
202
  // ONE LEVEL UP (the one whose conditional this branch belongs to) was
203
203
  // classified 'none' and baked once into the branch's initial template.
204
204
  expect(content).toMatch(
205
- /mapArray\(\(\) => o\(\)\.items \|\| \[\], .*?, \(item, __bidxbr_\d+, __existing\) => \{[\s\S]*?createEffect\(\(\) => \{ __bfw_s1\('s1', String\(oi\(\)\)\) \}\)/
205
+ /mapArray\(\(\) => o\(\)\.items \|\| \[\], .*?, \(item, __bidxbr_\d+, __existing\) => \{[\s\S]*?createEffect\(\(\) => \{ __bfw_s1\('s1', textOrNode\(oi\(\)\)\) \}\)/
206
206
  )
207
207
  })
208
208
  })
@@ -235,7 +235,7 @@ describe('.map() row: object-literal key / shorthand / member positions vs. the
235
235
  // The genuine index references (passed to the child, and read directly
236
236
  // in the row's own text) are still wrapped as accessor calls.
237
237
  expect(js).toContain('return i()')
238
- expect(js).toContain('String(i())')
238
+ expect(js).toContain('textOrNode(i())')
239
239
  })
240
240
  })
241
241
 
@@ -117,7 +117,7 @@ describe('planLoop', () => {
117
117
  refuse: (message) => refusals.push(message),
118
118
  }
119
119
  expect(spellSortedSource(null, 'xs', spelling)).toBe('xs')
120
- const evaluated = spellSortedSource({ kind: 'eval', helper: 'sort_eval', operands: [{ kind: 'string', value: 'body' }], captured: ['k'] }, 'xs', spelling)
120
+ const evaluated = spellSortedSource({ kind: 'eval', helper: 'sort_eval', operands: [{ kind: 'string', value: 'body' }], captured: [{ name: 'k', value: { kind: 'identifier', name: 'k' } }] }, 'xs', spelling)
121
121
  expect(evaluated).toBe(`sort_eval(xs, 'body', {k: v.k})`)
122
122
  const structured = plan(`export function Test(props: { items: { name: string }[] }) { return <ul>{props.items.toSorted((a, b) => a.name.localeCompare(b.name)).map(x => <li key={x.name}>{x.name}</li>)}</ul> }`)
123
123
  expect(spellSortedSource(structured.sort, 'xs', spelling)).toBe('sort(xs, name)')