@tsrx/core 0.1.39 → 0.1.41
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 +12 -2
- package/src/transform/jsx/index.js +1 -1
package/package.json
CHANGED
package/src/plugin.js
CHANGED
|
@@ -1000,13 +1000,15 @@ export function TSRXPlugin(config) {
|
|
|
1000
1000
|
// following raw text belongs to an enclosing template, not to it. With no
|
|
1001
1001
|
// enclosing template (e.g. a top-level `return <div />`), the trailing
|
|
1002
1002
|
// text is plain JS and must not be read as template raw text.
|
|
1003
|
+
// Inter-token whitespace has already advanced `pos`; `lastTokEnd` still
|
|
1004
|
+
// identifies the consumed `/>` boundary.
|
|
1003
1005
|
const opening = this.#openingNativeTemplateNode;
|
|
1004
1006
|
if (
|
|
1005
1007
|
opening &&
|
|
1006
1008
|
current_template_node === opening &&
|
|
1007
1009
|
/** @type {any} */ (opening).openingElement?.selfClosing &&
|
|
1008
|
-
this.input.charCodeAt(this.
|
|
1009
|
-
this.input.charCodeAt(this.
|
|
1010
|
+
this.input.charCodeAt(this.lastTokEnd - 1) === CharCode.greaterThan &&
|
|
1011
|
+
this.input.charCodeAt(this.lastTokEnd - 2) === CharCode.slash
|
|
1010
1012
|
) {
|
|
1011
1013
|
const enclosing = this.#path.findLast(
|
|
1012
1014
|
(node) => node !== opening && this.#isNativeTemplateNode(node),
|
|
@@ -2379,6 +2381,14 @@ export function TSRXPlugin(config) {
|
|
|
2379
2381
|
const top = ctx[ci];
|
|
2380
2382
|
const second = ctx[ci - 1];
|
|
2381
2383
|
|
|
2384
|
+
// A paired JSX element/fragment finishes on the closing tag's `>`, which
|
|
2385
|
+
// leaves `exprAllowed` false even when the already-read next token is a
|
|
2386
|
+
// comma. Re-arm expression mode for the value after that comma, matching
|
|
2387
|
+
// the tokenizer state produced by a self-closing JSX element.
|
|
2388
|
+
if (this.type === tt.comma) {
|
|
2389
|
+
this.exprAllowed = true;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2382
2392
|
// Expression-bodied templates (no statement child) followed by `,`
|
|
2383
2393
|
// in an object/array literal need surgical fixups; statement-bodied
|
|
2384
2394
|
// templates fall through to the JSX-expression-container strip.
|
|
@@ -3839,7 +3839,7 @@ function create_local_statement_component_name(transform_context) {
|
|
|
3839
3839
|
* into their own component boundary to satisfy the Rules of Hooks.
|
|
3840
3840
|
*
|
|
3841
3841
|
* @param {any[]} body_nodes
|
|
3842
|
-
* @param {any} key_expression - Optional key expression to add to the component element (for for-of loops)
|
|
3842
|
+
* @param {any} key_expression - Optional key expression to add to the component element (for `for-of` loops)
|
|
3843
3843
|
* @param {TransformContext} transform_context
|
|
3844
3844
|
* @returns {any[]}
|
|
3845
3845
|
*/
|