@tsrx/core 0.1.36 → 0.1.37

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/plugin.js +9 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core compiler infrastructure for TSRX syntax",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.1.36",
6
+ "version": "0.1.37",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
package/src/plugin.js CHANGED
@@ -2888,9 +2888,18 @@ export function TSRXPlugin(config) {
2888
2888
  this.exprAllowed = false;
2889
2889
  }
2890
2890
 
2891
+ // A `/` or `#` in template TEXT position joins the text run as a
2892
+ // literal character (`<div>5/2</div>`, `<div>#tag</div>`). This must
2893
+ // not fire in the JS positions that can sit under a template element
2894
+ // on the path: inside a `{ … }` expression container (an attribute or
2895
+ // child expression — `<rect x={a / 2}/>`, `{this.#x}`) or inside a
2896
+ // control-flow directive header (`@if (a / 2 > 1)`), where `/` is
2897
+ // division and `#` is a private-field access.
2891
2898
  if (
2892
2899
  (code === CharCode.numberSign || code === CharCode.slash) &&
2893
2900
  this.#functionBodyDepth === 0 &&
2901
+ this.#jsxExpressionContainerDepth === 0 &&
2902
+ !this.#readingJSXControlFlowHeader &&
2894
2903
  this.#isNativeTemplateNode(this.#path.at(-1)) &&
2895
2904
  !(
2896
2905
  code === CharCode.slash &&