@tsrx/core 0.1.51 → 0.1.52
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/package.json +1 -1
- package/src/plugin.js +28 -1
package/package.json
CHANGED
package/src/plugin.js
CHANGED
|
@@ -4595,7 +4595,34 @@ export function TSRXPlugin(config) {
|
|
|
4595
4595
|
// text never starts at `<`, so drop the leaked context and re-read the
|
|
4596
4596
|
// tag instead of emitting an empty node.
|
|
4597
4597
|
if (this.input.charCodeAt(this.start) === CharCode.lessThan) {
|
|
4598
|
-
if (this
|
|
4598
|
+
if (this.#jsxExpressionContainerDepth > 0) {
|
|
4599
|
+
// Inside a `{ … }` container the whole-stack counts below are
|
|
4600
|
+
// blind: the enclosing template's `tc_expr` contexts sit on the
|
|
4601
|
+
// stack but their elements are not on the container-scoped
|
|
4602
|
+
// `#path`. Scope both counts to the container instead — each
|
|
4603
|
+
// element opened inside it (all on `#path` above the container's
|
|
4604
|
+
// baseline) still owns one `tc_expr` that its closing tag's
|
|
4605
|
+
// `jsxTagEnd` pops itself, so only the run's excess above that
|
|
4606
|
+
// quota is leaked. Popping deeper would make a re-read closing
|
|
4607
|
+
// tag pop the container's brace or the enclosing tag context.
|
|
4608
|
+
const path_baseline = this.#expressionContainerPathBaselines.at(-1) ?? 0;
|
|
4609
|
+
let open_elements = 0;
|
|
4610
|
+
for (let i = path_baseline; i < this.#path.length; i++) {
|
|
4611
|
+
if (this.#isNativeTemplateNode(this.#path[i])) open_elements++;
|
|
4612
|
+
}
|
|
4613
|
+
let run = 0;
|
|
4614
|
+
for (
|
|
4615
|
+
let i = this.context.length - 1;
|
|
4616
|
+
i >= 0 && this.context[i] === tstc.tc_expr;
|
|
4617
|
+
i--
|
|
4618
|
+
) {
|
|
4619
|
+
run++;
|
|
4620
|
+
}
|
|
4621
|
+
while (run > open_elements && this.curContext() === tstc.tc_expr) {
|
|
4622
|
+
this.context.pop();
|
|
4623
|
+
run--;
|
|
4624
|
+
}
|
|
4625
|
+
} else if (this.input.charCodeAt(this.start + 1) === CharCode.slash) {
|
|
4599
4626
|
while (this.curContext() === tstc.tc_expr) {
|
|
4600
4627
|
this.context.pop();
|
|
4601
4628
|
}
|