PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: Rich-Harris/buble (js)

Issue:
Error on parsing JSX with hard spaces in a new line and end of line
For example

``` jsx
<div>
  <a>1</a>&nbsp;
  &nbsp;
</div>
```

is compiled to

``` js
React.createElement( 'div', null,
  React.createElement( 'a', null, "1" )&nbsp;
  &nbsp;
)
```

here `&nbsp;` is an unexpected token.

BTW I think it would be nice to update the report bug link at https://buble.surge.sh to this repo

Pull request:
Correctly handle nbsp (closes #46)

Patch:
diff --git a/src/program/types/JSXElement.js b/src/program/types/JSXElement.js
index 4cb4de1..7fa7468 100644
--- a/src/program/types/JSXElement.js
+++ b/src/program/types/JSXElement.js
@@ -21,7 +21,7 @@ export default class JSXElement extends Node {
 			if (child.type !== 'Literal') return true;
 
 			// remove whitespace-only literals, unless on a single line
-			return /\S/.test(child.value) || !/\n/.test(child.value);
+			return /\S/.test(child.raw) || !/\n/.test(child.raw);
 		});
 
 		if (children.length) {
@@ -43,7 +43,7 @@ export default class JSXElement extends Node {
 				}
 
 				if (child.type === 'Literal') {
-					const str = normalise(child.value, i === children.length - 1);
+					const str = normalise(child.raw, i === children.length - 1);
 					code.overwrite(child.start, child.end, str);
 				}
 


Test patch:
diff --git a/test/samples/jsx.js b/test/samples/jsx.js
index 745ca81..da5b146 100644
--- a/test/samples/jsx.js
+++ b/test/samples/jsx.js
@@ -272,5 +272,20 @@ module.exports = [
 		output: `
 			React.createElement( Thing, { 'data-foo': true })
 		`
+	},
+
+	{
+		description: 'handles non-breaking white-space entities',
+
+		input: `
+			<div>
+				<a>1</a>&nbsp;
+				&nbsp;
+			</div>
+		`,
+		output: `
+			React.createElement( 'div', null,
+				React.createElement( 'a', null, "1" ), "&nbsp; &nbsp;")
+		`
 	}
 ];