PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: swc-project/swc (rust)

Issue:
Misleading "failed to process js file" error message on failing to process non-.js extension
### Describe the bug

"js file" is misleading if the file is, say, a `.ts` or `.tsx`.

### Input code

```typescript
let let let;
```


### Config

```json
{}
```


### Playground link

https://play.swc.rs/?version=1.2.143&code=H4sIAAAAAAAAA8tJLVHIgWBrAB7YUcAMAAAA&config=H4sIAAAAAAAAA0WNSwrDMAxE76J1ts0id%2BghjKsEF%2F%2FQKBBjfPfawSU7aebpqdIXlrZK2QhYxoQS1Vy0kZbMsOKy0kKKHu3Gg1tfjBysHWG8eudTAs92oeCi28sw2RSyMPBUJh7%2BT7YuCulzjqDez27hSu1xzDuH9wRVTm4%2FOkwQUrUAAAA%3D

### Expected behavior

Immediately, removing `js` to be `failed to process file`.

Ideally, having the file extension in the error message could be useful to help explain what language parse mode is happening. `failed to process .ts file`, say?

### Actual behavior

failed to process file

### Version

1.2.143

### Additional context

_No response_

Pull request:
fix(es): Change error message as it can be misleading
**Description:**


**Related issue (if exists):**

 - Closes #3671

Patch:
diff --git a/crates/swc/src/lib.rs b/crates/swc/src/lib.rs
index cf5f66a8eb..28ace3bca9 100644
--- a/crates/swc/src/lib.rs
+++ b/crates/swc/src/lib.rs
@@ -980,7 +980,7 @@ impl Compiler {
 
             self.process_js_inner(handler, orig.as_ref(), config)
         })
-        .context("failed to process js file")
+        .context("failed to process input file")
     }
 
     #[tracing::instrument(level = "info", skip(self, handler, opts))]
diff --git a/crates/wasm/src/lib.rs b/crates/wasm/src/lib.rs
index 99755cabdd..82a62f3b25 100644
--- a/crates/wasm/src/lib.rs
+++ b/crates/wasm/src/lib.rs
@@ -126,7 +126,7 @@ pub fn transform_sync(s: &str, opts: JsValue) -> Result<JsValue, JsValue> {
             );
             let out = c
                 .process_js_file(fm, handler, &opts)
-                .context("failed to process js file")?;
+                .context("failed to process input file")?;
 
             JsValue::from_serde(&out).context("failed to serialize json")
         })


Test patch:
diff --git a/node-swc/__tests__/error_test.mjs b/node-swc/__tests__/error_test.mjs
index b98c7d1b2c..caf1d5dbbe 100644
--- a/node-swc/__tests__/error_test.mjs
+++ b/node-swc/__tests__/error_test.mjs
@@ -41,7 +41,7 @@ export async function getDependency(): Promise<any> {
 it("should report good error", () => {
   expect(() => {
     swc.transformFileSync(__dirname + "/../tests/error/simple.js");
-  }).toThrow("failed to process js file");
+  }).toThrow("failed to process input file");
 });
 
 it("should report good error (handler)", () => {