trickle-observe 0.2.77 → 0.2.78
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/vite-plugin.js +14 -3
- package/dist-esm/vite-plugin.js +14 -3
- package/package.json +1 -1
- package/src/vite-plugin.ts +14 -3
package/dist/vite-plugin.js
CHANGED
|
@@ -658,8 +658,8 @@ function findJsxExpressions(source) {
|
|
|
658
658
|
// Skip if this looks like a template literal expression `${`
|
|
659
659
|
if (charBefore === '$')
|
|
660
660
|
continue;
|
|
661
|
-
// Skip if preceded by
|
|
662
|
-
if (charBefore === '
|
|
661
|
+
// Skip if preceded by `,` (function arguments, not JSX)
|
|
662
|
+
if (charBefore === ',')
|
|
663
663
|
continue;
|
|
664
664
|
// Must be in a JSX context: look backward for `>` or `}` (closing tag bracket or prev expression)
|
|
665
665
|
// before hitting structural JS characters like `{`, `(`, `;`
|
|
@@ -675,8 +675,19 @@ function findJsxExpressions(source) {
|
|
|
675
675
|
inJsx = true;
|
|
676
676
|
break;
|
|
677
677
|
} // After a previous JSX expression
|
|
678
|
-
if (ch === '{' || ch === '
|
|
678
|
+
if (ch === '{' || ch === ';')
|
|
679
679
|
break;
|
|
680
|
+
// `(` breaks scan in code context, but in JSX text `(` is normal
|
|
681
|
+
// Check: if `(` is preceded by `>` or text, it's JSX text
|
|
682
|
+
if (ch === '(') {
|
|
683
|
+
const before = source.slice(Math.max(0, scanPos - 20), scanPos).trim();
|
|
684
|
+
if (before.endsWith('>') || /[a-zA-Z0-9\s]$/.test(before)) {
|
|
685
|
+
// Could be JSX text like "Users ({count})" — keep scanning
|
|
686
|
+
scanPos--;
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
680
691
|
// `=` only breaks if NOT preceded by other text (could be JSX text like "count = 5")
|
|
681
692
|
if (ch === '=' && scanPos > 0 && /\s/.test(source[scanPos - 1])) {
|
|
682
693
|
// Check if this `=` is a JSX attribute assignment: look further back for tag
|
package/dist-esm/vite-plugin.js
CHANGED
|
@@ -651,8 +651,8 @@ function findJsxExpressions(source) {
|
|
|
651
651
|
// Skip if this looks like a template literal expression `${`
|
|
652
652
|
if (charBefore === '$')
|
|
653
653
|
continue;
|
|
654
|
-
// Skip if preceded by
|
|
655
|
-
if (charBefore === '
|
|
654
|
+
// Skip if preceded by `,` (function arguments, not JSX)
|
|
655
|
+
if (charBefore === ',')
|
|
656
656
|
continue;
|
|
657
657
|
// Must be in a JSX context: look backward for `>` or `}` (closing tag bracket or prev expression)
|
|
658
658
|
// before hitting structural JS characters like `{`, `(`, `;`
|
|
@@ -668,8 +668,19 @@ function findJsxExpressions(source) {
|
|
|
668
668
|
inJsx = true;
|
|
669
669
|
break;
|
|
670
670
|
} // After a previous JSX expression
|
|
671
|
-
if (ch === '{' || ch === '
|
|
671
|
+
if (ch === '{' || ch === ';')
|
|
672
672
|
break;
|
|
673
|
+
// `(` breaks scan in code context, but in JSX text `(` is normal
|
|
674
|
+
// Check: if `(` is preceded by `>` or text, it's JSX text
|
|
675
|
+
if (ch === '(') {
|
|
676
|
+
const before = source.slice(Math.max(0, scanPos - 20), scanPos).trim();
|
|
677
|
+
if (before.endsWith('>') || /[a-zA-Z0-9\s]$/.test(before)) {
|
|
678
|
+
// Could be JSX text like "Users ({count})" — keep scanning
|
|
679
|
+
scanPos--;
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
673
684
|
// `=` only breaks if NOT preceded by other text (could be JSX text like "count = 5")
|
|
674
685
|
if (ch === '=' && scanPos > 0 && /\s/.test(source[scanPos - 1])) {
|
|
675
686
|
// Check if this `=` is a JSX attribute assignment: look further back for tag
|
package/package.json
CHANGED
package/src/vite-plugin.ts
CHANGED
|
@@ -632,8 +632,8 @@ function findJsxExpressions(source: string): Array<{ exprStart: number; exprEnd:
|
|
|
632
632
|
// Skip if this looks like a template literal expression `${`
|
|
633
633
|
if (charBefore === '$') continue;
|
|
634
634
|
|
|
635
|
-
// Skip if preceded by
|
|
636
|
-
if (charBefore === '
|
|
635
|
+
// Skip if preceded by `,` (function arguments, not JSX)
|
|
636
|
+
if (charBefore === ',') continue;
|
|
637
637
|
|
|
638
638
|
// Must be in a JSX context: look backward for `>` or `}` (closing tag bracket or prev expression)
|
|
639
639
|
// before hitting structural JS characters like `{`, `(`, `;`
|
|
@@ -643,7 +643,18 @@ function findJsxExpressions(source: string): Array<{ exprStart: number; exprEnd:
|
|
|
643
643
|
const ch = source[scanPos];
|
|
644
644
|
if (ch === '>') { inJsx = true; break; }
|
|
645
645
|
if (ch === '}') { inJsx = true; break; } // After a previous JSX expression
|
|
646
|
-
if (ch === '{' || ch === '
|
|
646
|
+
if (ch === '{' || ch === ';') break;
|
|
647
|
+
// `(` breaks scan in code context, but in JSX text `(` is normal
|
|
648
|
+
// Check: if `(` is preceded by `>` or text, it's JSX text
|
|
649
|
+
if (ch === '(') {
|
|
650
|
+
const before = source.slice(Math.max(0, scanPos - 20), scanPos).trim();
|
|
651
|
+
if (before.endsWith('>') || /[a-zA-Z0-9\s]$/.test(before)) {
|
|
652
|
+
// Could be JSX text like "Users ({count})" — keep scanning
|
|
653
|
+
scanPos--;
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
647
658
|
// `=` only breaks if NOT preceded by other text (could be JSX text like "count = 5")
|
|
648
659
|
if (ch === '=' && scanPos > 0 && /\s/.test(source[scanPos - 1])) {
|
|
649
660
|
// Check if this `=` is a JSX attribute assignment: look further back for tag
|