@barefootjs/jsx 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer-context.d.ts.map +1 -1
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1072 -903
- package/dist/ir-to-client-js/collect-elements.d.ts +22 -2
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-branch-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-component-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-composite-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts +14 -2
- package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-lazy-row.d.ts +11 -0
- package/dist/ir-to-client-js/control-flow/plan/build-lazy-row.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts +6 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-plain-row.d.ts +52 -0
- package/dist/ir-to-client-js/control-flow/plan/build-plain-row.d.ts.map +1 -0
- package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts +5 -2
- package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts +24 -44
- package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/lazy-conditional.d.ts +6 -7
- package/dist/ir-to-client-js/control-flow/plan/lazy-conditional.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/lazy-preamble.d.ts +5 -7
- package/dist/ir-to-client-js/control-flow/plan/lazy-preamble.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/lazy-row-eligibility.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts +14 -0
- package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +10 -6
- package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/shared.d.ts +11 -9
- package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/composite-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/inner-loop.d.ts +6 -14
- package/dist/ir-to-client-js/control-flow/stringify/inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/lazy-row.d.ts +1 -3
- package/dist/ir-to-client-js/control-flow/stringify/lazy-row.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts +19 -3
- package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/reactive-effects.d.ts +5 -1
- package/dist/ir-to-client-js/control-flow/stringify/reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/csr-substitute.d.ts +16 -0
- package/dist/ir-to-client-js/csr-substitute.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-reactive.d.ts +54 -0
- package/dist/ir-to-client-js/emit-reactive.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-registration.d.ts.map +1 -1
- package/dist/ir-to-client-js/html-template.d.ts +2 -2
- package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
- package/dist/ir-to-client-js/imports.d.ts +2 -2
- package/dist/ir-to-client-js/imports.d.ts.map +1 -1
- package/dist/ir-to-client-js/index.d.ts.map +1 -1
- package/dist/ir-to-client-js/markup-slots.d.ts +21 -0
- package/dist/ir-to-client-js/markup-slots.d.ts.map +1 -0
- package/dist/ir-to-client-js/reactivity.d.ts +62 -18
- package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
- package/dist/ir-to-client-js/safe-html.d.ts +158 -0
- package/dist/ir-to-client-js/safe-html.d.ts.map +1 -0
- package/dist/ir-to-client-js/types.d.ts +18 -2
- package/dist/ir-to-client-js/types.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +34 -1
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/jsx-to-ir.d.ts.map +1 -1
- package/dist/prop-rewrite.d.ts +8 -3
- package/dist/prop-rewrite.d.ts.map +1 -1
- package/dist/props-binding.d.ts +22 -1
- package/dist/props-binding.d.ts.map +1 -1
- package/dist/reactivity-checker.d.ts +18 -0
- package/dist/reactivity-checker.d.ts.map +1 -1
- package/dist/ssr-defaults.d.ts.map +1 -1
- package/dist/types.d.ts +5 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +138 -22
- package/src/__tests__/binding-scope-ratchet.test.ts +25 -2
- package/src/__tests__/build-plain-row-consolidation.test.ts +120 -0
- package/src/__tests__/child-prop-fallback-wrap.test.ts +4 -2
- package/src/__tests__/client-template-escape-soundness.test.ts +538 -0
- package/src/__tests__/compiler-stress-1244.test.ts +8 -8
- package/src/__tests__/csr-template-loop-shadowing.test.ts +4 -2
- package/src/__tests__/flatmap-segments.test.ts +1 -1
- package/src/__tests__/issue-2868-cond-arm-tag-collision.test.ts +185 -0
- package/src/__tests__/issue-2869-attr-dedup-guard.test.ts +141 -0
- package/src/__tests__/lazy-conditional.test.ts +52 -12
- package/src/__tests__/lazy-preamble.test.ts +11 -11
- package/src/__tests__/lazy-row-eligibility.test.ts +8 -3
- package/src/__tests__/loop-child-reactive-attr-const-shadow.test.ts +25 -3
- package/src/__tests__/loop-index-reactivity.test.ts +208 -0
- package/src/__tests__/loop-item-conditional-codegen.test.ts +4 -2
- package/src/__tests__/map-arbitrary-body.test.ts +1 -1
- package/src/__tests__/map-body-brand-checker.test.ts +176 -0
- package/src/__tests__/nested-loop-index-param.test.ts +41 -8
- package/src/__tests__/nested-loop-non-outer-reactivity.test.ts +177 -0
- package/src/__tests__/nested-loop-plain.test.ts +39 -25
- package/src/__tests__/nested-loop-reactive-attrs.test.ts +16 -6
- package/src/__tests__/preamble-branch-arm-rerun.test.ts +135 -0
- package/src/__tests__/reactive-attrs-in-map.test.ts +13 -10
- package/src/__tests__/rewrite-destructured-props.test.ts +37 -0
- package/src/__tests__/safe-html-splice-door.test.ts +61 -0
- package/src/__tests__/ssr-defaults.test.ts +59 -0
- package/src/__tests__/style-css-var-reactive.test.ts +4 -1
- package/src/analyzer-context.ts +12 -10
- package/src/analyzer.ts +4 -0
- package/src/index.ts +8 -2
- package/src/ir-to-client-js/collect-elements.ts +126 -32
- package/src/ir-to-client-js/control-flow/plan/build-branch-loop.ts +20 -28
- package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +9 -7
- package/src/ir-to-client-js/control-flow/plan/build-composite-loop.ts +12 -6
- package/src/ir-to-client-js/control-flow/plan/build-inner-loop.ts +36 -59
- package/src/ir-to-client-js/control-flow/plan/build-lazy-row.ts +25 -4
- package/src/ir-to-client-js/control-flow/plan/build-loop-child-arm.ts +36 -9
- package/src/ir-to-client-js/control-flow/plan/build-loop.ts +35 -35
- package/src/ir-to-client-js/control-flow/plan/build-plain-row.ts +116 -0
- package/src/ir-to-client-js/control-flow/plan/build-reactive-effects.ts +23 -8
- package/src/ir-to-client-js/control-flow/plan/inner-loop.ts +24 -45
- package/src/ir-to-client-js/control-flow/plan/lazy-conditional.ts +11 -10
- package/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts +11 -13
- package/src/ir-to-client-js/control-flow/plan/lazy-row-eligibility.ts +13 -3
- package/src/ir-to-client-js/control-flow/plan/loop-child-arm.ts +14 -0
- package/src/ir-to-client-js/control-flow/plan/loop.ts +10 -6
- package/src/ir-to-client-js/control-flow/shared.ts +40 -17
- package/src/ir-to-client-js/control-flow/stringify/composite-loop.ts +2 -1
- package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +20 -66
- package/src/ir-to-client-js/control-flow/stringify/insert.ts +4 -2
- package/src/ir-to-client-js/control-flow/stringify/lazy-row.ts +22 -15
- package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +53 -11
- package/src/ir-to-client-js/control-flow/stringify/loop.ts +4 -2
- package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +29 -18
- package/src/ir-to-client-js/csr-substitute.ts +29 -0
- package/src/ir-to-client-js/emit-reactive.ts +92 -6
- package/src/ir-to-client-js/emit-registration.ts +2 -4
- package/src/ir-to-client-js/html-template.ts +67 -245
- package/src/ir-to-client-js/imports.ts +3 -0
- package/src/ir-to-client-js/index.ts +4 -4
- package/src/ir-to-client-js/markup-slots.ts +25 -0
- package/src/ir-to-client-js/reactivity.ts +73 -27
- package/src/ir-to-client-js/safe-html.ts +243 -0
- package/src/ir-to-client-js/types.ts +19 -3
- package/src/ir-to-client-js/utils.ts +58 -10
- package/src/jsx-to-ir.ts +136 -24
- package/src/prop-rewrite.ts +8 -4
- package/src/props-binding.ts +37 -1
- package/src/reactivity-checker.ts +60 -0
- package/src/ssr-defaults.ts +45 -0
- package/src/types.ts +5 -10
- package/src/__tests__/text-slot-escaping.test.ts +0 -65
|
@@ -11,6 +11,7 @@ import type { ClientJsContext } from './types.ts'
|
|
|
11
11
|
import { toHtmlAttrName, varSlotId, PROPS_PARAM } from './utils.ts'
|
|
12
12
|
import { claimPlanLiteral, claimWriterVarName, type ClaimSlotSpec } from './control-flow/stringify/claim-plan.ts'
|
|
13
13
|
import { createTemplateAwareStringProtector } from './html-template.ts'
|
|
14
|
+
import { DYNAMIC_ELEMENT_WRITER_KIND } from './markup-slots.ts'
|
|
14
15
|
import { datePlugin, DATE_METHODS } from '../date-lowering.ts'
|
|
15
16
|
import { toLocaleDatePlugin, foldedArgToClientJs } from '../to-locale-date-lowering.ts'
|
|
16
17
|
import { tsNodeToParsedExpr } from '../expression-parser.ts'
|
|
@@ -84,6 +85,9 @@ function emitChildValueMirrorStatements(target: string, expression: string): str
|
|
|
84
85
|
* Generate JS statements to update a DOM attribute reactively.
|
|
85
86
|
* Centralizes the attribute-type dispatch (value, class, boolean, presence, generic)
|
|
86
87
|
* so that new AttrMeta flags are handled in one place.
|
|
88
|
+
*
|
|
89
|
+
* Per-kind WRITE dispatch only — an effect body must never call this
|
|
90
|
+
* directly, only through `emitDedupedAttrUpdate` below (#2869).
|
|
87
91
|
*/
|
|
88
92
|
export function emitAttrUpdate(target: string, attrName: string, expression: string, meta: AttrMeta): string[] {
|
|
89
93
|
const htmlName = toHtmlAttrName(attrName)
|
|
@@ -125,6 +129,81 @@ export function emitAttrUpdate(target: string, attrName: string, expression: str
|
|
|
125
129
|
]
|
|
126
130
|
}
|
|
127
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Last-value store every deduped attribute write in one emitting block
|
|
134
|
+
* shares — `const __l = []`, declared ONCE in the block that creates the
|
|
135
|
+
* effect(s), so the effect closure (a stable object across its own reruns)
|
|
136
|
+
* captures it and no other effect can see it. Each binding owns a fixed
|
|
137
|
+
* numeric ordinal into it. The lazy row graph (`control-flow/stringify/
|
|
138
|
+
* lazy-row.ts`) declares the same `__l` from the reconciler's `entry.last`
|
|
139
|
+
* instead — `applyItem` / `applyOuter` are separate invocations with no
|
|
140
|
+
* closure of their own to own the array — but the guard, the temp name,
|
|
141
|
+
* the ordinal scheme and the record-after-write rule below are shared with
|
|
142
|
+
* it (#2869).
|
|
143
|
+
*/
|
|
144
|
+
export const DEDUP_STORE_DECL = 'const __l = []'
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* `__l`-backed dedup test. `in` (not a truthiness check) so a legitimately
|
|
148
|
+
* `undefined` value still records and still writes once; `!(N in __l)` on
|
|
149
|
+
* the first run is what makes the first write unconditional — the same
|
|
150
|
+
* "dedup, no trust-first-run" contract `claim-slots.ts` documents for
|
|
151
|
+
* 'markup' slots. Moved here from `control-flow/stringify/lazy-row.ts`
|
|
152
|
+
* so the eager paths below and the lazy row graph share one guard (#2869).
|
|
153
|
+
*/
|
|
154
|
+
export function dedupGuard(ordinal: number): string {
|
|
155
|
+
return `!(${ordinal} in __l) || !Object.is(__l[${ordinal}], __x)`
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The ONLY way an effect body should write a reactive attribute (#2869).
|
|
160
|
+
* Wraps `emitAttrUpdate`'s per-kind write in a previous-value guard:
|
|
161
|
+
* compute once into `__x`, write only when `guard` holds, then record
|
|
162
|
+
* `__x` into `__l[ordinal]` whether or not the write happened, so the
|
|
163
|
+
* stored value always tracks the latest computation. Without this, every
|
|
164
|
+
* rerun of a shared effect — a keyed row's fused effect (#2869's report),
|
|
165
|
+
* or even a plain per-slot effect covering two attrs on one element — rewrote
|
|
166
|
+
* every attribute in it on every rerun, no matter which binding actually
|
|
167
|
+
* changed. `untrack()` cannot fix this on its own: it only suppresses
|
|
168
|
+
* dependency REGISTRATION for the read inside it, not re-execution of the
|
|
169
|
+
* surrounding effect when an unrelated sibling binding legitimately changes
|
|
170
|
+
* — so an `<iframe srcdoc={untrack(...)}>` kept reloading every time a
|
|
171
|
+
* sibling attribute in the same row effect changed.
|
|
172
|
+
*
|
|
173
|
+
* Self-contained block: `__x` (and `emitAttrUpdate`'s own `__v` / bare
|
|
174
|
+
* `const __val`) never leak into the caller's scope, so several bindings
|
|
175
|
+
* can sit in one effect body without a wrapper block of their own.
|
|
176
|
+
*
|
|
177
|
+
* Compares the RAW value, exactly like the lazy-row path always has: an
|
|
178
|
+
* object-valued `style` / `dangerouslySetInnerHTML` is a fresh object per
|
|
179
|
+
* run and simply keeps writing as before (no regression, no gain — a
|
|
180
|
+
* follow-up could compare the coerced value instead).
|
|
181
|
+
*
|
|
182
|
+
* `guard` is overridable for the lazy row graph's `__seed`-run DOM
|
|
183
|
+
* read-compare (`__seed ? <DOM read-compare> : <dedupGuard>`) and `null`
|
|
184
|
+
* for its `createRow` (fresh clone: write unconditionally, still record).
|
|
185
|
+
*/
|
|
186
|
+
export function emitDedupedAttrUpdate(
|
|
187
|
+
target: string,
|
|
188
|
+
attrName: string,
|
|
189
|
+
expression: string,
|
|
190
|
+
meta: AttrMeta,
|
|
191
|
+
ordinal: number,
|
|
192
|
+
guard: string | null = dedupGuard(ordinal),
|
|
193
|
+
): string[] {
|
|
194
|
+
const write = emitAttrUpdate(target, attrName, '__x', meta)
|
|
195
|
+
const lines = [`{ const __x = ${expression}`]
|
|
196
|
+
if (guard) {
|
|
197
|
+
lines.push(`if (${guard}) {`)
|
|
198
|
+
for (const stmt of write) lines.push(` ${stmt}`)
|
|
199
|
+
lines.push(`}`)
|
|
200
|
+
} else {
|
|
201
|
+
lines.push(...write)
|
|
202
|
+
}
|
|
203
|
+
lines.push(`__l[${ordinal}] = __x }`)
|
|
204
|
+
return lines
|
|
205
|
+
}
|
|
206
|
+
|
|
128
207
|
/**
|
|
129
208
|
* Rewrite destructured prop names in an expression to `(props.xxx ?? default)`.
|
|
130
209
|
* Only applies when the component uses destructured props (not props.xxx style).
|
|
@@ -393,9 +472,11 @@ export function emitDynamicTextUpdates(lines: string[], ctx: ClientJsContext): v
|
|
|
393
472
|
// 'text') because the value may be a live Node (e.g. a JSX-returning
|
|
394
473
|
// call like `{themeLogo(id)}`) — the writer splices a Node in by
|
|
395
474
|
// identity, exactly the contract `__bfText` used to provide (#1663).
|
|
475
|
+
// The kind is a named constant so the initial-render side
|
|
476
|
+
// (`markup-slots.ts` → `escapeTextOrMarkup`) reads the same decision.
|
|
396
477
|
let writer = ''
|
|
397
478
|
if (normalElems.length > 0) {
|
|
398
|
-
const slots: ClaimSlotSpec[] = normalElems.map(elem => ({ id: elem.slotId, kind:
|
|
479
|
+
const slots: ClaimSlotSpec[] = normalElems.map(elem => ({ id: elem.slotId, kind: DYNAMIC_ELEMENT_WRITER_KIND, path: [] }))
|
|
399
480
|
writer = claimWriterVarName(slots, varSlotId)
|
|
400
481
|
lines.push(` const ${writer} = lazySlots(__scope, ${claimPlanLiteral(slots)})`)
|
|
401
482
|
}
|
|
@@ -491,20 +572,22 @@ export function emitReactiveAttributeUpdates(lines: string[], ctx: ClientJsConte
|
|
|
491
572
|
|
|
492
573
|
for (const [slotId, attrs] of attrsBySlot) {
|
|
493
574
|
const v = varSlotId(slotId)
|
|
575
|
+
lines.push(` { ${DEDUP_STORE_DECL}`)
|
|
494
576
|
lines.push(` createEffect(() => {`)
|
|
495
577
|
lines.push(` if (_${v}) {`)
|
|
578
|
+
let ordinal = 0
|
|
496
579
|
for (const attr of attrs) {
|
|
497
580
|
// Catalogued-lowering MUST run before the bare-prop-name rewrite:
|
|
498
581
|
// the matcher needs the source-form receiver (a bare identifier or
|
|
499
582
|
// `props.x`), the exact two shapes `resolveReceiverType` supports —
|
|
500
583
|
// same ordering `jsx-to-ir.ts`'s static-template path documents.
|
|
501
584
|
const expression = rewriteDestructuredPropsInExpr(lower(attr.expression), ctx)
|
|
502
|
-
for (const stmt of
|
|
585
|
+
for (const stmt of emitDedupedAttrUpdate(`_${v}`, attr.attrName, expression, attr, ordinal++)) {
|
|
503
586
|
lines.push(` ${stmt}`)
|
|
504
587
|
}
|
|
505
588
|
}
|
|
506
589
|
lines.push(` }`)
|
|
507
|
-
lines.push(` }${bindingIdArg(ctx, slotId)})`)
|
|
590
|
+
lines.push(` }${bindingIdArg(ctx, slotId)}) }`)
|
|
508
591
|
lines.push('')
|
|
509
592
|
}
|
|
510
593
|
}
|
|
@@ -577,6 +660,7 @@ export function emitReactiveChildProps(lines: string[], ctx: ClientJsContext): v
|
|
|
577
660
|
if (ctx.reactiveChildProps.length > 0) {
|
|
578
661
|
lines.push('')
|
|
579
662
|
lines.push(` // Reactive child component props`)
|
|
663
|
+
lines.push(` { ${DEDUP_STORE_DECL}`)
|
|
580
664
|
lines.push(` createEffect(() => {`)
|
|
581
665
|
|
|
582
666
|
const propsByComponent = new Map<string, typeof ctx.reactiveChildProps>()
|
|
@@ -588,6 +672,7 @@ export function emitReactiveChildProps(lines: string[], ctx: ClientJsContext): v
|
|
|
588
672
|
propsByComponent.get(key)!.push(prop)
|
|
589
673
|
}
|
|
590
674
|
|
|
675
|
+
let ordinal = 0
|
|
591
676
|
for (const [, props] of propsByComponent) {
|
|
592
677
|
const first = props[0]
|
|
593
678
|
// The component's own `comment: true` root child IS `__scope` — query
|
|
@@ -606,10 +691,11 @@ export function emitReactiveChildProps(lines: string[], ctx: ClientJsContext): v
|
|
|
606
691
|
// `value` is the CHILD-ROOT MIRROR case, not a developer-authored
|
|
607
692
|
// attribute — route it through the no-SSR-fallback helper instead
|
|
608
693
|
// of `emitAttrUpdate`'s generic (attribute-fallback) dispatch;
|
|
609
|
-
// see `emitChildValueMirrorStatements`'s docstring (#2716).
|
|
694
|
+
// see `emitChildValueMirrorStatements`'s docstring (#2716). It has
|
|
695
|
+
// its own DOM-compare and consumes no dedup ordinal (#2869).
|
|
610
696
|
const stmts = toHtmlAttrName(prop.attrName) === 'value'
|
|
611
697
|
? emitChildValueMirrorStatements(varName, prop.expression)
|
|
612
|
-
:
|
|
698
|
+
: emitDedupedAttrUpdate(varName, prop.attrName, prop.expression, prop, ordinal++)
|
|
613
699
|
for (const stmt of stmts) {
|
|
614
700
|
lines.push(` ${stmt}`)
|
|
615
701
|
}
|
|
@@ -617,6 +703,6 @@ export function emitReactiveChildProps(lines: string[], ctx: ClientJsContext): v
|
|
|
617
703
|
lines.push(` }`)
|
|
618
704
|
}
|
|
619
705
|
|
|
620
|
-
lines.push(` }${bindingIdArg(ctx, ctx.reactiveChildProps[0]?.slotId ?? undefined)})`)
|
|
706
|
+
lines.push(` }${bindingIdArg(ctx, ctx.reactiveChildProps[0]?.slotId ?? undefined)}) }`)
|
|
621
707
|
}
|
|
622
708
|
}
|
|
@@ -9,6 +9,7 @@ import type { ClientJsContext } from './types.ts'
|
|
|
9
9
|
import { PROPS_PARAM } from './utils.ts'
|
|
10
10
|
import { computeInlinability, toLegacyInlinability } from './compute-inlinability.ts'
|
|
11
11
|
import { canGenerateStaticTemplate, irToComponentTemplate, generateCsrTemplate, createStringProtector } from './html-template.ts'
|
|
12
|
+
import { markupSlotIdsOf } from './markup-slots.ts'
|
|
12
13
|
import { nameForRegistryRef } from './component-scope.ts'
|
|
13
14
|
import { resolveRestSpreadNames } from './prop-handling.ts'
|
|
14
15
|
|
|
@@ -219,10 +220,7 @@ export function emitRegistrationAndHydration(
|
|
|
219
220
|
// Build ComponentDef object for hydrate()
|
|
220
221
|
const defParts: string[] = [`init: init${name}`]
|
|
221
222
|
if (canGenerateStaticTemplate(_ir.root, propNamesForStaticCheck, inlinableConstants, unsafeLocalNames)) {
|
|
222
|
-
|
|
223
|
-
// (#2651) — see `generateCsrTemplate`'s identical derivation below
|
|
224
|
-
// for why this is reused as-is rather than re-derived.
|
|
225
|
-
const markupSlotIds = new Set(ctx.dynamicElements.map(e => e.slotId))
|
|
223
|
+
const markupSlotIds = markupSlotIdsOf(ctx)
|
|
226
224
|
const templateHtml = irToComponentTemplate(_ir.root, inlinableConstants, restSpreadNames, ctx.propsObjectName, markupSlotIds, ctx.restPropsName)
|
|
227
225
|
if (templateHtml) {
|
|
228
226
|
defParts.push(buildTemplateDefPart(ctx, templateHtml))
|