Skip to content

[Bug]: tsrx-core: a pending changeset says a comment in an unbraced attribute value's element is text, but #713 made it a comment #729

Closed

Description

@leonidaz

Issue Category

Documentation Issue

Bug Description

Two pending @tsrx/core changesets describe the same input in opposite ways, so the next release's changelog will contradict itself and what the parser does.

The parser does what #713 says. The comment is left out of the text's value, and compiled output drops it.

Reproduction Steps

At f73b6760, run pnpm install --frozen-lockfile, then save this as repro.mjs in the repository root and run node repro.mjs:

import { parseModule } from './packages/tsrx/src/index.js';

// The first JSXText node in the tree.
function findText(node) {
	if (!node || typeof node !== 'object') return;
	if (node.type === 'JSXText') return node;
	for (const [key, child] of Object.entries(node)) {
		if (key === 'loc' || key === 'metadata') continue;
		const found = findText(child);
		if (found) return found;
	}
}

const source = `export function App() @{
	<div title=<b>a /* c */ b</b> />
}`;
const text = findText(parseModule(source, 'App.tsrx'));
console.log(`value ${JSON.stringify(text.value)}, raw ${JSON.stringify(text.raw)}`);
value "a  b", raw "a /* c */ b"

Expected: the changelog describes this. parser-element-value-crashes.md says the comment is text, which would give value "a /* c */ b".

Cause

#695 added parser-element-value-crashes.md while acorn-typescript's JSX parser still read that element, where a comment is text. #713 then read the element as template markup and added its own changeset, but left #695's sentence as it was.

Fix Direction

Edit .changeset/parser-element-value-crashes.md before the next release: keep the out-of-memory fix, and drop "The comment is text there, as in TSX, and as a line comment on its own line already was", or say it's a comment, as parser-spread-argument-markup.md does.

Environment

  • OS: macOS 26.6.2
  • Browser: n/a
  • TSRX package and version: @tsrx/core 0.4.0 (origin/main at f73b6760, pending changesets)
  • Compiler target and version: n/a (parser)
  • Node Version: 24.18.0

Additional Context

Found while checking how the next @tsrx/core release affects Ripple (Ripple-TS/ripple). In Ripple, the same input (<div title=<b>a /* c */ b</b> />) runs out of memory on @tsrx/core 0.3.3 and 0.4.0 and compiles on main with the comment dropped.

Checklist

  • I've searched for existing issues
  • I'm willing to help implement a fix

Activity

  1. jonkwheeler commented on Oct 29, 2026

    @jonkwheeler
    Contributor

    Closing: nothing contradicts any more. Both changesets have been released, in separate versions:

    So the changelog reads correctly as history: the earlier release described the behaviour at that point, and #713's release changed it. The parser does what the later entry says.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions