Commit Graph

229 Commits

Author SHA1 Message Date
camc314 65cda29177 fix(transform_conformance): record missing expected errors (#25306)
Fix the transformer conformance runner incorrectly marking a fixture as passed that specified `throws` when Oxc produces no error.

Failed conformance cases now always record a diagnostic. This exposes previously hidden failures in the Babel snapshot, including the nested ambient-module fixtures.
2026-08-12 10:30:24 +00:00
Boshen 030857b509 refactor(diagnostics): update oxc-miette to v4 (#25395)
Remove the miette `Report` wrapper and update oxc-miette to v4's narrowed diagnostic and source protocol.

AI-assisted by OpenAI Codex.
2026-08-10 07:48:02 +00:00
Boshen 7a24911846 perf(codegen)!: borrow sourcemaps from codegen (#23422)
Summary:
- Upgrade oxc_sourcemap to 8.0.1.
- Return borrowed SourceMap from CodegenReturn.
- Support no-sourcemap feature builds used by benchmarks.

AI-assisted: yes
2026-06-15 19:07:21 +08:00
Boshen 777f02ae10 refactor(diagnostics)!: return a Diagnostics type instead of Vec<OxcDiagnostic> (#23217)
## Summary

Introduces `oxc_diagnostics::Diagnostics` — a `Vec<OxcDiagnostic>` newtype that knows the difference between errors and warnings — and makes it the standard diagnostics return value across oxc.

- **New type**: `Diagnostics` with `has_errors()`, `has_warnings()`, `errors()`, `warnings()`, plus `Vec`-like ergonomics (Deref, `IntoIterator`, `Extend`, `From`/`Into<Vec>`) so most call sites are unchanged.
- **Return types**: `ParserReturn`, `SemanticBuilderReturn`, `IsolatedDeclarationsReturn`, the React Compiler `TransformResult`/`LintResult`, and `TransformerReturn` now expose `diagnostics: Diagnostics` instead of `errors: Vec<OxcDiagnostic>` (the React Compiler's separate `errors`/`warnings` are merged into one severity-tagged list).
- **Behaviour**: a React Compiler **error** now stops the transform (no output), while **warnings** flow through and the transform continues. `compile()` aborts codegen only when `diagnostics.has_errors()` — warnings alone no longer abort (previously any diagnostic did).

## Breaking change

Consumers reading `*.errors` on these return values must read `*.diagnostics`. React Compiler consumers that read `.errors`/`.warnings` separately should use `diagnostics.has_errors()` / `diagnostics.errors()` / `diagnostics.warnings()`.

Parser/semantic/isolated-declarations fatality is otherwise unchanged. Builds on the React Compiler transform feature (#23201).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-06-10 14:46:52 +00:00
Dunqing 33756270c8 fix(transformer): remove false positive duplicate __source/__self prop error (#20678)
Fixes #20654

The JSX source and self plugins were erroneously reporting "Duplicate `__source` prop found" / "Duplicate `__self` prop found" warnings when a user wrote `<div __source={{}} />` or `<div __self={this} />`. This prevented valid code from being transformed.

In Babel, the duplicate error only exists to warn users who have both the automatic runtime AND the deprecated standalone plugins enabled simultaneously ([source](https://github.com/babel/babel/blob/9137617716e200cb440948562789ae3744559fcb/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts#L847-L853)). It's not relevant for oxc as a standalone transformer.

Now the plugins silently skip adding `__source`/`__self` when the user has already provided one, matching the behavior of Babel's standalone plugins.
2026-03-24 10:47:59 +00:00
Boshen e7e72e27df fix(transform_conformance): skip tests that expect parser errors (#18914)
## Summary

- Skip tests in transform conformance that expect parser errors
- Parser errors are already tested by parser conformance tests
- Transform conformance should only test transformation logic

When a test has a `throws` option, we now try parsing the input first. If parsing fails, the test is skipped since it's a parser error test (not a transformer error test).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-02-04 03:41:29 +00:00
Dunqing 4d97ba3952 chore(tasks): unify printing differences for mismatch code (#18441)
Instead of implementing printing diffs everywhere, use a unified method to make the code cleaner and maintain consistency.
2026-01-26 05:16:44 +00:00
Dunqing 7ba9fa19f8 refactor(tasks): improve terminal diff output with context lines (#18437)
## Summary

Improves the `print_diff_in_terminal` function with better readability and a simpler API:

**API Changes:**
- `print_diff_in_terminal(expected, result)` - Simple API that takes two strings
- `print_text_diff(diff)` - For when you already have a `TextDiff` (e.g., to use `diff.ratio()`)

**Features:**
- Show 3 lines of context above and below each change
- Add line numbers with gutter separator (`│`)
- Add blank line between adjacent hunks for visual separation
- Add `...` separator when lines are skipped between hunks
- Use single-pass streaming algorithm with small fixed-size buffer
- Colors: red (`-`) for deletions, green (`+`) for insertions, dim for context

**Formatter Example:**
- Added `--diff` flag to show diff between original and formatted code

Example output:
```
    1 │class A {
    2 │  #x;
    3 │}
-   4 │var _x = /* @__PURE__ */ new WeakMap();
-   5 │var _B_brand = /* @__PURE__ */ new WeakSet();
    4 │class B {

-   7 │  constructor() {
-   8 │    babelHelpers.classPrivateMethodInitSpec(this, _B_brand);
-   9 │    babelHelpers.classPrivateFieldInitSpec(this, _x, void 0);
+   5 │  #x;
+   6 │  #y() {
+   7 │    this.#x;
    8 │  }

-  11 │}
-  12 │function _y() {
-  13 │  babelHelpers.classPrivateFieldGet2(_x, this);
    9 │}
```

## Test plan

- [x] `cargo check -p oxc_tasks_common` passes
- [x] Clippy passes
- [x] Verified output with `just test-transform --filter "plugins-integration/class-features-node-12/input.js"`

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-23 08:53:25 +00:00
Dunqing 30a4899dd8 feat(oxc)!: remove CompilerInterface::semantic_child_scope_ids (#18361)
No usage in the Oxc and Rolldown (see https://github.com/rolldown/rolldown/pull/7995), and it will be removed in #18362, so remove this first.
2026-01-22 07:46:26 +00:00
Dunqing 1b18457e05 feat(transformer): support tagged template expression with </script transformation (#15664)
Implement a transformation plugin for tagged template expressions containing </script> tags to prevent script tag issues in browser environments.

  This plugin transforms tagged template literals containing `</script` (case-insensitive) to use a helper function call with template caching, matching esbuild's behavior.

 ### Example

  Transforms tagged templates to use cached template objects with a helper function:

  Input:
```js
foo`</script>`
bar`<script>${content}</script>`
```
  Output:
```js
var _templateObject, _templateObject2;
foo(_templateObject || (_templateObject = babelHelpers.taggedTemplateLiteral(["<\/script>"])));
bar(_templateObject2 || (_templateObject2 = babelHelpers.taggedTemplateLiteral(["<script>", "<\/script>"])), content);
```

 Closes #15306
2025-11-17 11:55:13 +00:00
Copilot bc4f0a1ffa feat(transformer): add ES2020 export namespace from transformation (#14277)
✅ **Implementation Complete: ES2020 Export Namespace From
Transformation**

Successfully implemented the transformation for `export * as ns from
"mod"` to convert it to:
```js
import * as _ns from "mod";
export { _ns as ns };
```

## Changes Made:
- [x] Core transformation in `es2020/export_namespace_from.rs`
- [x] ES2020 module integration and options
- [x] Browser compatibility mapping in `oxc_compat` (auto-generated from
custom compat data)
- [x] Babel plugin support (`transform-export-namespace-from`)
- [x] Target-based transformation (works with old browsers, skips modern
ones)
- [x] Code optimizations (removed clones, reserved capacity, used vec1)
- [x] Custom compat data infrastructure for features not in compat-table
- [x] Early return optimization to avoid unnecessary allocations
- [x] Implemented `GatherNodeParts` for `ModuleExportName` to avoid
string allocations
- [x] All tests passing ✅

## Code Review Addressed:
- Reserved capacity for statements vector
- Removed unnecessary clones via destructuring
- Used `ctx.ast.vec1()` for single-element vectors
- Created custom compat data system to avoid manual edits
- Imported `TransformCtx` directly
- Added early return when no export namespace declarations exist
- Implemented `GatherNodeParts` for `ModuleExportName` and use
`generate_uid_based_on_node`

## Example:
**Input:**
```js
export * as ns from "mod";
```

**Output:**
```js
import * as _ns from 'mod';
export { _ns as ns };
```

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>transformer: transform `export * as ns from "mod";` to
`import * as ns from "mod"; export { ns }`</issue_title>
> <issue_description>This transformation is supported by babel:
https://babeljs.io/docs/babel-plugin-transform-export-namespace-from
> ```js
> export * as ns from "mod";
> 
> // to
> 
> import * as _ns from "mod";
> export { _ns as ns };
> ```</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>
Fixes oxc-project/oxc#14257

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for
you](https://github.com/oxc-project/oxc/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Signed-off-by: Dunqing <dengqing0821@gmail.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dunqing <dengqing0821@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-10-11 11:25:34 +08:00
sapphi-red ee4546f379 test(transformer): enable export-type-star-from test (#14323)
I believe this is a valid code now. The test passes as well.

https://github.com/babel/babel/blob/main/packages/babel-generator/test/fixtures/typescript/export-type-star-from/input.ts
2025-10-04 03:47:35 +00:00
renovate f3b61d8e87 chore(deps): update crate-ci/typos action to v1.37.0 (#14271)
> [!NOTE]
> Mend has cancelled [the proposed renaming](https://redirect.github.com/renovatebot/renovate/discussions/37842) of the Renovate GitHub app being renamed to `mend[bot]`.
>
> This notice will be removed on 2025-10-07.

<hr>

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [crate-ci/typos](https://redirect.github.com/crate-ci/typos) | action | minor | `v1.36.3` -> `v1.37.0` |

---

### Release Notes

<details>
<summary>crate-ci/typos (crate-ci/typos)</summary>

### [`v1.37.0`](https://redirect.github.com/crate-ci/typos/blob/HEAD/CHANGELOG.md#014---2019-11-03)

[Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.36.3...v1.37.0)

##### Bug Fixes

- Ignore numbers as identifiers ([a00831c8](https://redirect.github.com/crate-ci/typos/commit/a00831c847b7efd81be520ea9b5d02f70555351f))
- Improve the organization of --help ([a48a457c](https://redirect.github.com/crate-ci/typos/commit/a48a457cc3ca817850118e2a2fb8b20fecdd40b8))

##### Features

- Dump files, identifiers, and words ([ce365ae1](https://redirect.github.com/crate-ci/typos/commit/ce365ae12e12fddfb6fc42a7f1e5ea71834d6051), closes [#&#8203;41](https://redirect.github.com/crate-ci/typos/issues/41))
- Give control over allowed identifier characters for leading vs rest ([107308a6](https://redirect.github.com/crate-ci/typos/commit/107308a655a425eb593bf5e4928572c16e6a9bdd))

##### Performance

- Use standard identifier rules to avoid doing umber checks ([107308a6](https://redirect.github.com/crate-ci/typos/commit/107308a655a425eb593bf5e4928572c16e6a9bdd))
- Only do hex check if digits are in identifiers ([68cd36d0](https://redirect.github.com/crate-ci/typos/commit/68cd36d0de90226dbc9d31c2ce6d8bf6b69adb5c))

<!-- next-url -->

[Unreleased]: https://redirect.github.com/crate-ci/typos/compare/v1.37.0...HEAD

[1.37.0]: https://redirect.github.com/crate-ci/typos/compare/v1.36.3...v1.37.0

[1.36.3]: https://redirect.github.com/crate-ci/typos/compare/v1.36.2...v1.36.3

[1.36.2]: https://redirect.github.com/crate-ci/typos/compare/v1.36.1...v1.36.2

[1.36.1]: https://redirect.github.com/crate-ci/typos/compare/v1.36.0...v1.36.1

[1.36.0]: https://redirect.github.com/crate-ci/typos/compare/v1.35.8...v1.36.0

[1.35.8]: https://redirect.github.com/crate-ci/typos/compare/v1.35.7...v1.35.8

[1.35.7]: https://redirect.github.com/crate-ci/typos/compare/v1.35.6...v1.35.7

[1.35.6]: https://redirect.github.com/crate-ci/typos/compare/v1.35.5...v1.35.6

[1.35.5]: https://redirect.github.com/crate-ci/typos/compare/v1.35.4...v1.35.5

[1.35.4]: https://redirect.github.com/crate-ci/typos/compare/v1.35.3...v1.35.4

[1.35.3]: https://redirect.github.com/crate-ci/typos/compare/v1.35.2...v1.35.3

[1.35.2]: https://redirect.github.com/crate-ci/typos/compare/v1.35.1...v1.35.2

[1.35.1]: https://redirect.github.com/crate-ci/typos/compare/v1.35.0...v1.35.1

[1.35.0]: https://redirect.github.com/crate-ci/typos/compare/v1.34.0...v1.35.0

[1.34.0]: https://redirect.github.com/crate-ci/typos/compare/v1.33.1...v1.34.0

[1.33.1]: https://redirect.github.com/crate-ci/typos/compare/v1.33.0...v1.33.1

[1.33.0]: https://redirect.github.com/crate-ci/typos/compare/v1.32.0...v1.33.0

[1.32.0]: https://redirect.github.com/crate-ci/typos/compare/v1.31.2...v1.32.0

[1.31.2]: https://redirect.github.com/crate-ci/typos/compare/v1.31.1...v1.31.2

[1.31.1]: https://redirect.github.com/crate-ci/typos/compare/v1.31.0...v1.31.1

[1.31.0]: https://redirect.github.com/crate-ci/typos/compare/v1.30.3...v1.31.0

[1.30.3]: https://redirect.github.com/crate-ci/typos/compare/v1.30.2...v1.30.3

[1.30.2]: https://redirect.github.com/crate-ci/typos/compare/v1.30.1...v1.30.2

[1.30.1]: https://redirect.github.com/crate-ci/typos/compare/v1.30.0...v1.30.1

[1.30.0]: https://redirect.github.com/crate-ci/typos/compare/v1.29.10...v1.30.0

[1.29.10]: https://redirect.github.com/crate-ci/typos/compare/v1.29.9...v1.29.10

[1.29.9]: https://redirect.github.com/crate-ci/typos/compare/v1.29.8...v1.29.9

[1.29.8]: https://redirect.github.com/crate-ci/typos/compare/v1.29.7...v1.29.8

[1.29.7]: https://redirect.github.com/crate-ci/typos/compare/v1.29.6...v1.29.7

[1.29.6]: https://redirect.github.com/crate-ci/typos/compare/v1.29.5...v1.29.6

[1.29.5]: https://redirect.github.com/crate-ci/typos/compare/v1.29.4...v1.29.5

[1.29.4]: https://redirect.github.com/crate-ci/typos/compare/v1.29.3...v1.29.4

[1.29.3]: https://redirect.github.com/crate-ci/typos/compare/v1.29.2...v1.29.3

[1.29.2]: https://redirect.github.com/crate-ci/typos/compare/v1.29.1...v1.29.2

[1.29.1]: https://redirect.github.com/crate-ci/typos/compare/v1.29.0...v1.29.1

[1.29.0]: https://redirect.github.com/crate-ci/typos/compare/v1.28.4...v1.29.0

[1.28.4]: https://redirect.github.com/crate-ci/typos/compare/v1.28.3...v1.28.4

[1.28.3]: https://redirect.github.com/crate-ci/typos/compare/v1.28.2...v1.28.3

[1.28.2]: https://redirect.github.com/crate-ci/typos/compare/v1.28.1...v1.28.2

[1.28.1]: https://redirect.github.com/crate-ci/typos/compare/v1.28.0...v1.28.1

[1.28.0]: https://redirect.github.com/crate-ci/typos/compare/v1.27.3...v1.28.0

[1.27.3]: https://redirect.github.com/crate-ci/typos/compare/v1.27.2...v1.27.3

[1.27.2]: https://redirect.github.com/crate-ci/typos/compare/v1.27.1...v1.27.2

[1.27.1]: https://redirect.github.com/crate-ci/typos/compare/v1.27.0...v1.27.1

[1.27.0]: https://redirect.github.com/crate-ci/typos/compare/v1.26.8...v1.27.0

[1.26.8]: https://redirect.github.com/crate-ci/typos/compare/v1.26.7...v1.26.8

[1.26.7]: https://redirect.github.com/crate-ci/typos/compare/v1.26.6...v1.26.7

[1.26.6]: https://redirect.github.com/crate-ci/typos/compare/v1.26.5...v1.26.6

[1.26.5]: https://redirect.github.com/crate-ci/typos/compare/v1.26.4...v1.26.5

[1.26.4]: https://redirect.github.com/crate-ci/typos/compare/v1.26.3...v1.26.4

[1.26.3]: https://redirect.github.com/crate-ci/typos/compare/v1.26.2...v1.26.3

[1.26.2]: https://redirect.github.com/crate-ci/typos/compare/v1.26.1...v1.26.2

[1.26.1]: https://redirect.github.com/crate-ci/typos/compare/v1.26.0...v1.26.1

[1.26.0]: https://redirect.github.com/crate-ci/typos/compare/v1.25.0...v1.26.0

[1.25.0]: https://redirect.github.com/crate-ci/typos/compare/v1.24.6...v1.25.0

[1.24.6]: https://redirect.github.com/crate-ci/typos/compare/v1.24.5...v1.24.6

[1.24.5]: https://redirect.github.com/crate-ci/typos/compare/v1.24.4...v1.24.5

[1.24.4]: https://redirect.github.com/crate-ci/typos/compare/v1.24.3...v1.24.4

[1.24.3]: https://redirect.github.com/crate-ci/typos/compare/v1.24.2...v1.24.3

[1.24.2]: https://redirect.github.com/crate-ci/typos/compare/v1.24.1...v1.24.2

[1.24.1]: https://redirect.github.com/crate-ci/typos/compare/v1.24.0...v1.24.1

[1.24.0]: https://redirect.github.com/crate-ci/typos/compare/v1.23.7...v1.24.0

[1.23.7]: https://redirect.github.com/crate-ci/typos/compare/v1.23.6...v1.23.7

[1.23.6]: https://redirect.github.com/crate-ci/typos/compare/v1.23.5...v1.23.6

[1.23.5]: https://redirect.github.com/crate-ci/typos/compare/v1.23.4...v1.23.5

[1.23.4]: https://redirect.github.com/crate-ci/typos/compare/v1.23.3...v1.23.4

[1.23.3]: https://redirect.github.com/crate-ci/typos/compare/v1.23.2...v1.23.3

[1.23.2]: https://redirect.github.com/crate-ci/typos/compare/v1.23.1...v1.23.2

[1.23.1]: https://redirect.github.com/crate-ci/typos/compare/v1.23.0...v1.23.1

[1.23.0]: https://redirect.github.com/crate-ci/typos/compare/v1.22.9...v1.23.0

[1.22.9]: https://redirect.github.com/crate-ci/typos/compare/v1.22.8...v1.22.9

[1.22.8]: https://redirect.github.com/crate-ci/typos/compare/v1.22.7...v1.22.8

[1.22.7]: https://redirect.github.com/crate-ci/typos/compare/v1.22.6...v1.22.7

[1.22.6]: https://redirect.github.com/crate-ci/typos/compare/v1.22.5...v1.22.6

[1.22.5]: https://redirect.github.com/crate-ci/typos/compare/v1.22.4...v1.22.5

[1.22.4]: https://redirect.github.com/crate-ci/typos/compare/v1.22.3...v1.22.4

[1.22.3]: https://redirect.github.com/crate-ci/typos/compare/v1.22.2...v1.22.3

[1.22.2]: https://redirect.github.com/crate-ci/typos/compare/v1.22.1...v1.22.2

[1.22.1]: https://redirect.github.com/crate-ci/typos/compare/v1.22.0...v1.22.1

[1.22.0]: https://redirect.github.com/crate-ci/typos/compare/v1.21.0...v1.22.0

[1.21.0]: https://redirect.github.com/crate-ci/typos/compare/v1.20.10...v1.21.0

[1.20.10]: https://redirect.github.com/crate-ci/typos/compare/v1.20.9...v1.20.10

[1.20.9]: https://redirect.github.com/crate-ci/typos/compare/v1.20.8...v1.20.9

[1.20.8]: https://redirect.github.com/crate-ci/typos/compare/v1.20.7...v1.20.8

[1.20.7]: https://redirect.github.com/crate-ci/typos/compare/v1.20.6...v1.20.7

[1.20.6]: https://redirect.github.com/crate-ci/typos/compare/v1.20.5...v1.20.6

[1.20.5]: https://redirect.github.com/crate-ci/typos/compare/v1.20.4...v1.20.5

[1.20.4]: https://redirect.github.com/crate-ci/typos/compare/v1.20.3...v1.20.4

[1.20.3]: https://redirect.github.com/crate-ci/typos/compare/v1.20.2...v1.20.3

[1.20.2]: https://redirect.github.com/crate-ci/typos/compare/v1.20.1...v1.20.2

[1.20.1]: https://redirect.github.com/crate-ci/typos/compare/v1.20.0...v1.20.1

[1.20.0]: https://redirect.github.com/crate-ci/typos/compare/v1.19.0...v1.20.0

[1.19.0]: https://redirect.github.com/crate-ci/typos/compare/v1.18.2...v1.19.0

[1.18.2]: https://redirect.github.com/crate-ci/typos/compare/v1.18.1...v1.18.2

[1.18.1]: https://redirect.github.com/crate-ci/typos/compare/v1.18.0...v1.18.1

[1.18.0]: https://redirect.github.com/crate-ci/typos/compare/v1.17.2...v1.18.0

[1.17.2]: https://redirect.github.com/crate-ci/typos/compare/v1.17.1...v1.17.2

[1.17.1]: https://redirect.github.com/crate-ci/typos/compare/v1.17.0...v1.17.1

[1.17.0]: https://redirect.github.com/crate-ci/typos/compare/v1.16.26...v1.17.0

[1.16.26]: https://redirect.github.com/crate-ci/typos/compare/v1.16.25...v1.16.26

[1.16.25]: https://redirect.github.com/crate-ci/typos/compare/v1.16.24...v1.16.25

[1.16.24]: https://redirect.github.com/crate-ci/typos/compare/v1.16.23...v1.16.24

[1.16.23]: https://redirect.github.com/crate-ci/typos/compare/v1.16.22...v1.16.23

[1.16.22]: https://redirect.github.com/crate-ci/typos/compare/v1.16.21...v1.16.22

[1.16.21]: https://redirect.github.com/crate-ci/typos/compare/v1.16.20...v1.16.21

[1.16.20]: https://redirect.github.com/crate-ci/typos/compare/v1.16.19...v1.16.20

[1.16.19]: https://redirect.github.com/crate-ci/typos/compare/v1.16.18...v1.16.19

[1.16.18]: https://redirect.github.com/crate-ci/typos/compare/v1.16.17...v1.16.18

[1.16.17]: https://redirect.github.com/crate-ci/typos/compare/v1.16.16...v1.16.17

[1.16.16]: https://redirect.github.com/crate-ci/typos/compare/v1.16.15...v1.16.16

[1.16.15]: https://redirect.github.com/crate-ci/typos/compare/v1.16.14...v1.16.15

[1.16.14]: https://redirect.github.com/crate-ci/typos/compare/v1.16.13...v1.16.14

[1.16.13]: https://redirect.github.com/crate-ci/typos/compare/v1.16.12...v1.16.13

[1.16.12]: https://redirect.github.com/crate-ci/typos/compare/v1.16.11...v1.16.12

[1.16.11]: https://redirect.github.com/crate-ci/typos/compare/v1.16.10...v1.16.11

[1.16.10]: https://redirect.github.com/crate-ci/typos/compare/v1.16.9...v1.16.10

[1.16.9]: https://redirect.github.com/crate-ci/typos/compare/v1.16.8...v1.16.9

[1.16.8]: https://redirect.github.com/crate-ci/typos/compare/v1.16.7...v1.16.8

[1.16.7]: https://redirect.github.com/crate-ci/typos/compare/v1.16.6...v1.16.7

[1.16.6]: https://redirect.github.com/crate-ci/typos/compare/v1.16.5...v1.16.6

[1.16.5]: https://redirect.github.com/crate-ci/typos/compare/v1.16.4...v1.16.5

[1.16.4]: https://redirect.github.com/crate-ci/typos/compare/v1.16.3...v1.16.4

[1.16.3]: https://redirect.github.com/crate-ci/typos/compare/v1.16.2...v1.16.3

[1.16.2]: https://redirect.github.com/crate-ci/typos/compare/v1.16.1...v1.16.2

[1.16.1]: https://redirect.github.com/crate-ci/typos/compare/v1.16.0...v1.16.1

[1.16.0]: https://redirect.github.com/crate-ci/typos/compare/v1.15.10...v1.16.0

[1.15.10]: https://redirect.github.com/crate-ci/typos/compare/v1.15.9...v1.15.10

[1.15.9]: https://redirect.github.com/crate-ci/typos/compare/v1.15.8...v1.15.9

[1.15.8]: https://redirect.github.com/crate-ci/typos/compare/v1.15.7...v1.15.8

[1.15.7]: https://redirect.github.com/crate-ci/typos/compare/v1.15.6...v1.15.7

[1.15.6]: https://redirect.github.com/crate-ci/typos/compare/v1.15.5...v1.15.6

[1.15.5]: https://redirect.github.com/crate-ci/typos/compare/v1.15.4...v1.15.5

[1.15.4]: https://redirect.github.com/crate-ci/typos/compare/v1.15.3...v1.15.4

[1.15.3]: https://redirect.github.com/crate-ci/typos/compare/v1.15.2...v1.15.3

[1.15.2]: https://redirect.github.com/crate-ci/typos/compare/v1.15.1...v1.15.2

[1.15.1]: https://redirect.github.com/crate-ci/typos/compare/v1.15.0...v1.15.1

[1.15.0]: https://redirect.github.com/crate-ci/typos/compare/v1.14.12...v1.15.0

[1.14.12]: https://redirect.github.com/crate-ci/typos/compare/v1.14.11...v1.14.12

[1.14.11]: https://redirect.github.com/crate-ci/typos/compare/v1.14.10...v1.14.11

[1.14.10]: https://redirect.github.com/crate-ci/typos/compare/v1.14.9...v1.14.10

[1.14.9]: https://redirect.github.com/crate-ci/typos/compare/v1.14.8...v1.14.9

[1.14.8]: https://redirect.github.com/crate-ci/typos/compare/v1.14.7...v1.14.8

[1.14.7]: https://redirect.github.com/crate-ci/typos/compare/v1.14.6...v1.14.7

[1.14.6]: https://redirect.github.com/crate-ci/typos/compare/v1.14.5...v1.14.6

[1.14.5]: https://redirect.github.com/crate-ci/typos/compare/v1.14.4...v1.14.5

[1.14.4]: https://redirect.github.com/crate-ci/typos/compare/v1.14.3...v1.14.4

[1.14.3]: https://redirect.github.com/crate-ci/typos/compare/v1.14.2...v1.14.3

[1.14.2]: https://redirect.github.com/crate-ci/typos/compare/v1.14.1...v1.14.2

[1.14.1]: https://redirect.github.com/crate-ci/typos/compare/v1.14.0...v1.14.1

[1.14.0]: https://redirect.github.com/crate-ci/typos/compare/v1.13.26...v1.14.0

[1.13.26]: https://redirect.github.com/crate-ci/typos/compare/v1.13.25...v1.13.26

[1.13.25]: https://redirect.github.com/crate-ci/typos/compare/v1.13.24...v1.13.25

[1.13.24]: https://redirect.github.com/crate-ci/typos/compare/v1.13.23...v1.13.24

[1.13.23]: https://redirect.github.com/crate-ci/typos/compare/v1.13.22...v1.13.23

[1.13.22]: https://redirect.github.com/crate-ci/typos/compare/v1.13.21...v1.13.22

[1.13.21]: https://redirect.github.com/crate-ci/typos/compare/v1.13.20...v1.13.21

[1.13.20]: https://redirect.github.com/crate-ci/typos/compare/v1.13.19...v1.13.20

[1.13.19]: https://redirect.github.com/crate-ci/typos/compare/v1.13.18...v1.13.19

[1.13.18]: https://redirect.github.com/crate-ci/typos/compare/v1.13.17...v1.13.18

[1.13.17]: https://redirect.github.com/crate-ci/typos/compare/v1.13.16...v1.13.17

[1.13.16]: https://redirect.github.com/crate-ci/typos/compare/v1.13.15...v1.13.16

[1.13.15]: https://redirect.github.com/crate-ci/typos/compare/v1.13.14...v1.13.15

[1.13.14]: https://redirect.github.com/crate-ci/typos/compare/v1.13.13...v1.13.14

[1.13.13]: https://redirect.github.com/crate-ci/typos/compare/v1.13.12...v1.13.13

[1.13.12]: https://redirect.github.com/crate-ci/typos/compare/v1.13.11...v1.13.12

[1.13.11]: https://redirect.github.com/crate-ci/typos/compare/v1.13.10...v1.13.11

[1.13.10]: https://redirect.github.com/crate-ci/typos/compare/v1.13.9...v1.13.10

[1.13.9]: https://redirect.github.com/crate-ci/typos/compare/v1.13.8...v1.13.9

[1.13.8]: https://redirect.github.com/crate-ci/typos/compare/v1.13.7...v1.13.8

[1.13.7]: https://redirect.github.com/crate-ci/typos/compare/v1.13.6...v1.13.7

[1.13.6]: https://redirect.github.com/crate-ci/typos/compare/v1.13.5...v1.13.6

[1.13.5]: https://redirect.github.com/crate-ci/typos/compare/v1.13.4...v1.13.5

[1.13.4]: https://redirect.github.com/crate-ci/typos/compare/v1.13.3...v1.13.4

[1.13.3]: https://redirect.github.com/crate-ci/typos/compare/v1.13.2...v1.13.3

[1.13.2]: https://redirect.github.com/crate-ci/typos/compare/v1.13.1...v1.13.2

[1.13.1]: https://redirect.github.com/crate-ci/typos/compare/v1.13.0...v1.13.1

[1.13.0]: https://redirect.github.com/crate-ci/typos/compare/v1.12.14...v1.13.0

[1.12.14]: https://redirect.github.com/crate-ci/typos/compare/v1.12.13...v1.12.14

[1.12.13]: https://redirect.github.com/crate-ci/typos/compare/v1.12.12...v1.12.13

[1.12.12]: https://redirect.github.com/crate-ci/typos/compare/v1.12.11...v1.12.12

[1.12.11]: https://redirect.github.com/crate-ci/typos/compare/v1.12.10...v1.12.11

[1.12.10]: https://redirect.github.com/crate-ci/typos/compare/v1.12.9...v1.12.10

[1.12.9]: https://redirect.github.com/crate-ci/typos/compare/v1.12.8...v1.12.9

[1.12.8]: https://redirect.github.com/crate-ci/typos/compare/v1.12.7...v1.12.8

[1.12.7]: https://redirect.github.com/crate-ci/typos/compare/v1.12.6...v1.12.7

[1.12.6]: https://redirect.github.com/crate-ci/typos/compare/v1.12.5...v1.12.6

[1.12.5]: https://redirect.github.com/crate-ci/typos/compare/v1.12.4...v1.12.5

[1.12.4]: https://redirect.github.com/crate-ci/typos/compare/v1.12.3...v1.12.4

[1.12.3]: https://redirect.github.com/crate-ci/typos/compare/v1.12.2...v1.12.3

[1.12.2]: https://redirect.github.com/crate-ci/typos/compare/v1.12.1...v1.12.2

[1.12.1]: https://redirect.github.com/crate-ci/typos/compare/v1.12.0...v1.12.1

[1.12.0]: https://redirect.github.com/crate-ci/typos/compare/v1.11.5...v1.12.0

[1.11.5]: https://redirect.github.com/crate-ci/typos/compare/v1.11.4...v1.11.5

[1.11.4]: https://redirect.github.com/crate-ci/typos/compare/v1.11.3...v1.11.4

[1.11.3]: https://redirect.github.com/crate-ci/typos/compare/v1.11.2...v1.11.3

[1.11.2]: https://redirect.github.com/crate-ci/typos/compare/v1.11.1...v1.11.2

[1.11.1]: https://redirect.github.com/crate-ci/typos/compare/v1.11.0...v1.11.1

[1.11.0]: https://redirect.github.com/crate-ci/typos/compare/v1.10.3...v1.11.0

[1.10.3]: https://redirect.github.com/crate-ci/typos/compare/v1.10.2...v1.10.3

[1.10.2]: https://redirect.github.com/crate-ci/typos/compare/v1.10.1...v1.10.2

[1.10.1]: https://redirect.github.com/crate-ci/typos/compare/v1.10.0...v1.10.1

[1.10.0]: https://redirect.github.com/crate-ci/typos/compare/v1.9.0...v1.10.0

[1.9.0]: https://redirect.github.com/crate-ci/typos/compare/v1.8.1...v1.9.0

[1.8.1]: https://redirect.github.com/crate-ci/typos/compare/v1.8.0...v1.8.1

[1.8.0]: https://redirect.github.com/crate-ci/typos/compare/v1.7.3...v1.8.0

[1.7.3]: https://redirect.github.com/crate-ci/typos/compare/v1.7.2...v1.7.3

[1.7.2]: https://redirect.github.com/crate-ci/typos/compare/v1.7.1...v1.7.2

[1.7.1]: https://redirect.github.com/crate-ci/typos/compare/v1.7.0...v1.7.1

[1.7.0]: https://redirect.github.com/crate-ci/typos/compare/v1.6.0...v1.7.0

[1.6.0]: https://redirect.github.com/crate-ci/typos/compare/v1.5.0...v1.6.0

[1.5.0]: https://redirect.github.com/crate-ci/typos/compare/v1.4.1...v1.5.0

[1.4.1]: https://redirect.github.com/crate-ci/typos/compare/v1.4.0...v1.4.1

[1.4.0]: https://redirect.github.com/crate-ci/typos/compare/v1.3.9...v1.4.0

[1.3.9]: https://redirect.github.com/crate-ci/typos/compare/v1.3.8...v1.3.9

[1.3.8]: https://redirect.github.com/crate-ci/typos/compare/v1.3.7...v1.3.8

[1.3.7]: https://redirect.github.com/crate-ci/typos/compare/v1.3.6...v1.3.7

[1.3.6]: https://redirect.github.com/crate-ci/typos/compare/v1.3.5...v1.3.6

[1.3.5]: https://redirect.github.com/crate-ci/typos/compare/v1.3.4...v1.3.5

[1.3.4]: https://redirect.github.com/crate-ci/typos/compare/v1.3.3...v1.3.4

[1.3.3]: https://redirect.github.com/crate-ci/typos/compare/v1.3.2...v1.3.3

[1.3.2]: https://redirect.github.com/crate-ci/typos/compare/v1.3.1...v1.3.2

[1.3.1]: https://redirect.github.com/crate-ci/typos/compare/v1.3.0...v1.3.1

[1.3.0]: https://redirect.github.com/crate-ci/typos/compare/v1.2.1...v1.3.0

[1.2.1]: https://redirect.github.com/crate-ci/typos/compare/v1.2.0...v1.2.1

[1.2.0]: https://redirect.github.com/crate-ci/typos/compare/v1.1.9...v1.2.0

[1.1.9]: https://redirect.github.com/crate-ci/typos/compare/v1.1.8...v1.1.9

[1.1.8]: https://redirect.github.com/crate-ci/typos/compare/v1.1.7...v1.1.8

[1.1.7]: https://redirect.github.com/crate-ci/typos/compare/v1.1.6...v1.1.7

[1.1.6]: https://redirect.github.com/crate-ci/typos/compare/v1.1.5...v1.1.6

[1.1.5]: https://redirect.github.com/crate-ci/typos/compare/v1.1.4...v1.1.5

[1.1.4]: https://redirect.github.com/crate-ci/typos/compare/v1.1.3...v1.1.4

[1.1.3]: https://redirect.github.com/crate-ci/typos/compare/v1.1.2...v1.1.3

[1.1.2]: https://redirect.github.com/crate-ci/typos/compare/v1.1.1...v1.1.2

[1.1.1]: https://redirect.github.com/crate-ci/typos/compare/v1.1.0...v1.1.1

[1.1.0]: https://redirect.github.com/crate-ci/typos/compare/v1.0.11...v1.1.0

[1.0.11]: https://redirect.github.com/crate-ci/typos/compare/v1.0.10...v1.0.11

[1.0.10]: https://redirect.github.com/crate-ci/typos/compare/v1.0.9...v1.0.10

[1.0.9]: https://redirect.github.com/crate-ci/typos/compare/v1.0.8...v1.0.9

[1.0.8]: https://redirect.github.com/crate-ci/typos/compare/v1.0.7...v1.0.8

[1.0.7]: https://redirect.github.com/crate-ci/typos/compare/v1.0.6...v1.0.7

[1.0.6]: https://redirect.github.com/crate-ci/typos/compare/v1.0.5...v1.0.6

[1.0.5]: https://redirect.github.com/crate-ci/typos/compare/v1.0.4...v1.0.5

[1.0.4]: https://redirect.github.com/crate-ci/typos/compare/v1.0.3...v1.0.4

[1.0.3]: https://redirect.github.com/crate-ci/typos/compare/v1.0.2...v1.0.3

[1.0.2]: https://redirect.github.com/crate-ci/typos/compare/v1.0.1...v1.0.2

[1.0.1]: https://redirect.github.com/crate-ci/typos/compare/v1.0.0...v1.0.1

[1.0.0]: https://redirect.github.com/crate-ci/typos/compare/v0.4.0...v1.0.0

[0.4.0]: https://redirect.github.com/crate-ci/typos/compare/v0.3.0...v0.4.0

[0.3.0]: https://redirect.github.com/crate-ci/typos/compare/v0.2.0...v0.3.0

[0.2.0]: https://redirect.github.com/crate-ci/typos/compare/v0.1.4...v0.2.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2025-10-01 05:19:11 +00:00
Boshen 5dcc64c5ae feat(transformer): replace tab-to-space hack with native indent configuration (#14191)
## Summary
- Closes oxc-project/backlog#150
- Replaces manual tab-to-space replacement hack with native indentation configuration

## Changes
- Configure `Driver::codegen_options()` to use spaces with width 2
- Configure `TestCase` Codegen instance to use spaces with width 2
- Remove three instances of `cow_replace("\t", "  ")` hack
- Add `IndentChar` imports where needed

## Context
The `CodegenOptions` struct already had `indent_char` and `indent_width` fields available. This change leverages existing infrastructure to provide cleaner, more maintainable code instead of post-processing the output with string replacement.

This addresses the issue mentioned in oxc-project/backlog#150 where transformer conformance output was replacing tabs with spaces as a workaround.

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-09-28 02:00:40 +00:00
overlookmotel 911a5d0ce1 test(coverage): clarify code (#12921)
We can now use `if let` chains. Previously we had to use an early return pattern in some places because one branch had multiple nested `if` statements. Now that they're combined into a single `if`, we don't need to use this pattern any more, and can convert to `if` / `else`. Usually this is shorter, but even when it's not, in my opinion it's a bit clearer.
2025-08-08 21:16:54 +00:00
camc314 84794ebdbf refactor(all): enable collapsible_if lint (#12902) 2025-08-08 11:27:58 +00:00
Copilot 65e211296d refactor(transformer): Use to @babel/plugin-transform-explicit-resource-management (#12874) 2025-08-08 12:03:33 +08:00
Dunqing 19b97c06a3 feat(transformer): support styled components plugin (#12066)
close: #11876

This plugin adds comprehensive support for styled-components with server-side rendering, style minification, and enhanced debugging capabilities. The implementation is ported from the [official Babel plugin](https://github.com/styled-components/babel-plugin-styled-components) to ensure compatibility and feature parity.

## Current Limitations

⚠️ **Import Support**: This plugin currently only supports styled-components imported via ES modules (`import` statements). CommonJS imports using `require("styled-components")` are not yet supported.

## Feature Support

### Options:
 **✅ Fully Supported:**
 - `displayName`: Adds display names for debugging
 - `fileName`: Controls filename prefixing in display names
 - `ssr`: Adds unique component IDs for server-side rendering
 - `transpileTemplateLiterals`: Converts template literals to function calls
 - `minify`: Minifies CSS content in template literals
 - `namespace`: Adds namespace prefixes to component IDs
 - `meaninglessFileNames`: Controls which filenames are considered meaningless

 **⚠️ Partially Supported:**
 - `pure`: Only supports call expressions, not tagged template expressions (bundler limitation)

 **❌ Not Yet Implemented:**
 - `cssProp`: JSX css prop transformation
 - `topLevelImportPaths`: Custom import path handling

## Testing

The test suite is adapted from the [official Babel plugin tests](https://github.com/styled-components/babel-plugin-styled-components) with modifications to integrate with our testing infrastructure.

**Note**: Some test outputs differ from the original due to our different hashing algorithm for component IDs. This is intentional and follows the same approach used by SWC's implementation.
2025-07-10 00:39:52 +00:00
Boshen 8b30a5bbd6 feat(codegen)!: introduce CommentOptions (#12114)
Control printing of comments more precisely via more options:

The logic change here is that jsdoc is no longer part of annotation
comments.

```rust
pub struct CommentOptions {
    /// Print normal comments that do not have special meanings.
    ///
    /// At present only statement level comments are printed.
    ///
    /// Default is `true`.
    pub normal: bool,

    /// Print jsdoc comments.
    ///
    /// * jsdoc: `/** jsdoc */`
    ///
    /// Default is `true`.
    pub jsdoc: bool,

    /// Print annotation comments.
    ///
    /// * pure: `/* #__PURE__ */` and `/* #__NO_SIDE_EFFECTS__ */`
    /// * webpack: `/* webpackChunkName */`
    /// * vite: `/* @vite-ignore */`
    /// * coverage: `v8 ignore`, `c8 ignore`, `node:coverage`, `istanbul ignore`
    ///
    /// Default is `true`.
    pub annotation: bool,

    /// Print legal comments.
    ///
    /// * starts with `//!` or `/*!`.
    /// * contains `/* @license */` or `/* @preserve */`
    ///
    /// Default is [LegalComment::Inline].
    pub legal: LegalComment,
}
```

closes #12030
related https://github.com/rolldown/tsdown/issues/357
2025-07-07 08:57:59 +00:00
renovate[bot] f524552e06 chore(deps): update dependency rust to v1.87.0 (#11063) 2025-05-16 12:16:07 +08:00
Boshen 4e5c73b87c fix(span)!: SourceType::from_path(".js") return js instead of jsx (#11038)
closes #11020

Previously `SourceType::from_path(".js")` treats a `.js` file as `.jsx`
to maximize parse rate for the linter.

Force the `.jsx` change in the linter instead of a generic solution for
`SourceType::from_path`.
2025-05-15 16:58:00 +08:00
Boshen 1673ffb05a feat(codegen): rework printing normal / legal / annotation comments (#10997)
fixes #10948

This PR changes how comment options are interpreted.

`CodegenOptions::comments`, `CodegenOptions::annotation_comments` and
`CodegenOptions::legal_comments` are now independent of each other.

### `CodegenOptions::comments`

Controls printing of normal comments. At present, only some leading
comments are preserved. It does not control legal and annotation
comments.


### `CodegenOptions::annotation_comments`

Controls printing of annotation comments

* jsdoc: `/** jsdoc */`                                                 
* pure: `/* #__PURE__ */` and `/* #__NO_SIDE_EFFECTS__ */`              
* webpack: `/* webpackChunkName */`                                     
* vite: `/* @vite-ignore */`                                            
* coverage: `v8 ignore`, `c8 ignore`, `node:coverage`, `istanbul ignore`

### `CodegenOptions::legal_comments`

Controls printing of legal comments

* starts with `//!` or `/*!`.                   
* contains `/* @license */` or `/* @preserve */`

---

Comment generation is also changed:

codegen first builds a comments map by keeping only the needed comments.
Printing functions will then print out comments in their respective
positions.

---

This PR reveals some incorrect comment interpretation:  

* https://github.com/oxc-project/oxc/issues/10998
2025-05-13 19:24:42 +08:00
overlookmotel 27a21a7d05 fix(transformer/jsx): fix parsing JSX pragma comments (#10983)
Fixes #10955.

Allow multiple JSX pragmas in a single comment, or even in the same line. e.g.

```js
/* @jsx h @jsxRuntime classic */

// @jsx h @jsxRuntime classic

/**
  * @jsx h
  * @jsxRuntime classic
  */
```

Also, allow pragmas to be anywhere in the comment, including surrounded by unrelated text.

```js
// Unrelated text @jsx h Unrelated text @jsxRuntime classic

/**
  * Unrelated text.
  * @jsx h
  * Unrelated text.
  * @jsxRuntime classic
  */
```

This is more liberal than Babel, which [has a test](https://github.com/babel/babel/blob/226318d54eaff275500b2723c46ee608c0632df0/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-allow-jsx-pragma-to-be-anywhere-in-comment/input.js) specifically to outlaw placing pragmas amongst other text in a comment - this test is disabled in this PR.

Instead, we're aligning with ESBuild ([ESBuild playground](https://esbuild.github.io/try/#dAAwLjI1LjQALS1sb2FkZXI9anN4IC0tanN4PWF1dG9tYXRpYwAvLyBAanN4IFNvbWV0aGluZyBibGFoIGJsYWggQGpzeFJ1bnRpbWUgY2xhc3NpYwo8YmxhaC8+Cg)) which seems to allow a `@jsx` pragma anywhere in the text of the comment.
2025-05-13 00:29:27 +00:00
Boshen 315143ae42 refactor(codegen)!: remove useless CodeGenerator type alias (#10702) 2025-04-29 17:01:07 +00:00
Dunqing 2eb1f88a7d feat(tasks/transforme_conformance): support --override for tests have been passed (#10536)
Before, we could only override the failed tests, now we support `--override` for the passed tests. This is useful for fixing the Babel itself bugs/misalignments. See #10538 and #10491
2025-04-23 03:52:49 +00:00
Boshen 78f1b3afa1 feat(transformer): enable using by default (#10286)
closes #9744
2025-04-07 09:23:26 +00:00
overlookmotel d6917010bd fix(various): unwrap Result of write! macro (#10228)
#10196 replaced the anti-pattern of `str.push_str(&format!("..."));` with `let _ = write!(str, "...");`.

However, this ignores the `Result` returned by `write!` macro. It's unspecified what happens when the `String` reaches capacity - it may return `Result::Err`, or may panic. Ensure we get a panic, rather than silently generating incorrect output by calling `unwrap()` on the `Result`.

This problem could never arise in practice on 64-bit systems because max capacity of `String` is enormous, but it's not impossible on 32-bit systems (e.g. WASM).
2025-04-04 14:38:26 +00:00
renovate a788a64649 chore(deps): update dependency rust to v1.86.0 (#10196)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust) | minor | `1.85.1` -> `1.86.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.86.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1860-2025-04-03)

[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.85.1...1.86.0)

\==========================

<a id="1.86.0-Language"></a>

## Language

-   [Stabilize upcasting trait objects to supertraits.](https://redirect.github.com/rust-lang/rust/pull/134367)
-   [Allow safe functions to be marked with the `#[target_feature]` attribute.](https://redirect.github.com/rust-lang/rust/pull/134090)
-   [The `missing_abi` lint now warns-by-default.](https://redirect.github.com/rust-lang/rust/pull/132397)
-   Rust now lints about double negations, to catch cases that might have intended to be a prefix decrement operator (`--x`) as written in other languages. This was previously a clippy lint, `clippy::double_neg`, and is [now available directly in Rust as `double_negations`.](https://redirect.github.com/rust-lang/rust/pull/126604)
-   [More pointers are now detected as definitely not-null based on their alignment in const eval.](https://redirect.github.com/rust-lang/rust/pull/133700)
-   [Empty `repr()` attribute applied to invalid items are now correctly rejected.](https://redirect.github.com/rust-lang/rust/pull/133925)
-   [Inner attributes `#![test]` and `#![rustfmt::skip]` are no longer accepted in more places than intended.](https://redirect.github.com/rust-lang/rust/pull/134276)

<a id="1.86.0-Compiler"></a>

## Compiler

-   [Debug-assert that raw pointers are non-null on access.](https://redirect.github.com/rust-lang/rust/pull/134424)
-   [Change `-O` to mean `-C opt-level=3` instead of `-C opt-level=2` to match Cargo's defaults.](https://redirect.github.com/rust-lang/rust/pull/135439)
-   [Fix emission of `overflowing_literals` under certain macro environments.](https://redirect.github.com/rust-lang/rust/pull/136393)

<a id="1.86.0-Platform-Support"></a>

## Platform Support

-   [Replace `i686-unknown-redox` target with `i586-unknown-redox`.](https://redirect.github.com/rust-lang/rust/pull/136698)
-   [Increase baseline CPU of `i686-unknown-hurd-gnu` to Pentium 4.](https://redirect.github.com/rust-lang/rust/pull/136700)
-   New tier 3 targets:
    -   [`{aarch64-unknown,x86_64-pc}-nto-qnx710_iosock`](https://redirect.github.com/rust-lang/rust/pull/133631).
        For supporting Neutrino QNX 7.1 with `io-socket` network stack.
    -   [`{aarch64-unknown,x86_64-pc}-nto-qnx800`](https://redirect.github.com/rust-lang/rust/pull/133631).
        For supporting Neutrino QNX 8.0 (`no_std`-only).
    -   [`{x86_64,i686}-win7-windows-gnu`](https://redirect.github.com/rust-lang/rust/pull/134609).
        Intended for backwards compatibility with Windows 7. `{x86_64,i686}-win7-windows-msvc` are the Windows MSVC counterparts that already exist as Tier 3 targets.
    -   [`amdgcn-amd-amdhsa`](https://redirect.github.com/rust-lang/rust/pull/134740).
    -   [`x86_64-pc-cygwin`](https://redirect.github.com/rust-lang/rust/pull/134999).
    -   [`{mips,mipsel}-mti-none-elf`](https://redirect.github.com/rust-lang/rust/pull/135074).
        Initial bare-metal support.
    -   [`m68k-unknown-none-elf`](https://redirect.github.com/rust-lang/rust/pull/135085).
    -   [`armv7a-nuttx-{eabi,eabihf}`, `aarch64-unknown-nuttx`, and `thumbv7a-nuttx-{eabi,eabihf}`](https://redirect.github.com/rust-lang/rust/pull/135757).

Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.

<a id="1.86.0-Libraries"></a>

## Libraries

-   The type of `FromBytesWithNulError` in `CStr::from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>` was [changed from an opaque struct to an enum](https://redirect.github.com/rust-lang/rust/pull/134143), allowing users to examine why the conversion failed.
-   [Remove `RustcDecodable` and `RustcEncodable`.](https://redirect.github.com/rust-lang/rust/pull/134272)
-   [Deprecate libtest's `--logfile` option.](https://redirect.github.com/rust-lang/rust/pull/134283)
-   [On recent versions of Windows, `std::fs::remove_file` will now remove read-only files.](https://redirect.github.com/rust-lang/rust/pull/134679)

<a id="1.86.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`{float}::next_down`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_down)
-   [`{float}::next_up`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_up)
-   [`<[_]>::get_disjoint_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_mut)
-   [`<[_]>::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_unchecked_mut)
-   [`slice::GetDisjointMutError`](https://doc.rust-lang.org/stable/std/slice/enum.GetDisjointMutError.html)
-   [`HashMap::get_disjoint_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_mut)
-   [`HashMap::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_unchecked_mut)
-   [`NonZero::count_ones`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.count_ones)
-   [`Vec::pop_if`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pop_if)
-   [`sync::Once::wait`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait)
-   [`sync::Once::wait_force`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait_force)
-   [`sync::OnceLock::wait`](https://doc.rust-lang.org/stable/std/sync/struct.OnceLock.html#method.wait)

These APIs are now stable in const contexts:

-   [`hint::black_box`](https://doc.rust-lang.org/stable/std/hint/fn.black_box.html)
-   [`io::Cursor::get_mut`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_mut)
-   [`io::Cursor::set_position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.set_position)
-   [`str::is_char_boundary`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.is_char_boundary)
-   [`str::split_at`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at)
-   [`str::split_at_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_checked)
-   [`str::split_at_mut`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut)
-   [`str::split_at_mut_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut_checked)

<a id="1.86.0-Cargo"></a>

## Cargo

-   [When merging, replace rather than combine configuration keys that refer to a program path and its arguments.](https://redirect.github.com/rust-lang/cargo/pull/15066/)
-   [Error if both `--package` and `--workspace` are passed but the requested package is missing.](https://redirect.github.com/rust-lang/cargo/pull/15071/) This was previously silently ignored, which was considered a bug since missing packages should be reported.
-   [Deprecate the token argument in `cargo login` to avoid shell history leaks.](https://redirect.github.com/rust-lang/cargo/pull/15057/)
-   [Simplify the implementation of `SourceID` comparisons.](https://redirect.github.com/rust-lang/cargo/pull/14980/) This may potentially change behavior if the canonicalized URL compares differently in alternative registries.

<a id="1.86.0-Rustdoc"></a>

## Rustdoc

-   [Add a sans-serif font setting.](https://redirect.github.com/rust-lang/rust/pull/133636)

<a id="1.86.0-Compatibility-Notes"></a>

## Compatibility Notes

-   [The `wasm_c_abi` future compatibility warning is now a hard error.](https://redirect.github.com/rust-lang/rust/pull/133951)
    Users of `wasm-bindgen` should upgrade to at least version 0.2.89, otherwise compilation will fail.
-   [Remove long-deprecated no-op attributes `#![no_start]` and `#![crate_id]`.](https://redirect.github.com/rust-lang/rust/pull/134300)
-   [The future incompatibility lint `cenum_impl_drop_cast` has been made into a hard error.](https://redirect.github.com/rust-lang/rust/pull/135964) This means it is now an error to cast a field-less enum to an integer if the enum implements `Drop`.
-   [SSE2 is now required for "i686" 32-bit x86 hard-float targets; disabling it causes a warning that will become a hard error eventually.](https://redirect.github.com/rust-lang/rust/pull/137037)
    To compile for pre-SSE2 32-bit x86, use a "i586" target instead.

<a id="1.86.0-Internal-Changes"></a>

## Internal Changes

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

-   [Build the rustc on AArch64 Linux with ThinLTO + PGO.](https://redirect.github.com/rust-lang/rust/pull/133807)
    The ARM 64-bit compiler (AArch64) on Linux is now optimized with ThinLTO and PGO, similar to the optimizations we have already performed for the x86-64 compiler on Linux. This should make it up to 30% faster.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMjcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjIyNy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2025-04-04 07:43:00 +00:00
Boshen a8331f7b49 feat(transformer): Turn off explicit resource management by default (#9749) 2025-03-13 11:09:20 +00:00
camc314 a10ead8913 feat(transformer): transform explicit resource management (#9310)
~~wanted to have a shot at implementing this, this is rough draft.~~

~~Dunqing or overlookmotel feel free to take over or close out this PR. not sure how much time i'll have to finish it off~~

@Dunqing @overlookmotel this should be ready when you guys have time 🙏

closes #9168
2025-03-11 05:42:47 +00:00
Boshen 23738bf9db refactor(semantic)!: introduce Scoping (#9611)
part of #9607
2025-03-09 10:28:11 +00:00
Dunqing 45ace4419b feat(transformer): add /* @_PURE__ */ annotation for pure calls (#9424)
close: #6072

Many tests outputs are updated because we need to print `/* @_PURE__ */` for the pure calls.
2025-03-04 06:13:21 +00:00
Boshen 1d81adac48 Rust Edition 2024 (#9289)
closes #9271

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-22 11:56:25 +08:00
Boshen ef856f505d refactor(oxc): apply clippy::needless_pass_by_ref_mut (#9253) 2025-02-20 02:13:09 +00:00
Boshen 63bb214555 refactor(oxc): apply clippy::redundant_clone (#9252) 2025-02-20 01:28:55 +00:00
Dunqing cad04d6a3f chore(transformer): add legacy decorator tests that come from TypeScript (#8692)
Part of #8614

All tests copy over from https://github.com/microsoft/TypeScript/blob/8da951cbb629b648753454872df4e1754982aef1/tests/cases/conformance/decorators/class, in addition, several multi-file tests were also adjusted.

The output is generated by
```ts
transpileModule(
  source,
  {
    compilerOptions: {
      target: 'esnext',
      experimentalDecorators: true,
      noEmitHelpers: true
    },
  }
)
```
and replace all `__decorate` with `babelHelpers.decorate` and `__param` with `babelHelpers.decorateParam`
2025-02-07 15:19:47 +00:00
overlookmotel a4a8e7deda style(all): replace #[allow] with #[expect] (#8930)
Replace `#[allow]` with `#[expect]` through the whole codebase.

This also surfaced many places where the `#[allow]` attributes were outdated/pointless and could be removed entirely.

Only places `#[allow]` remains are:

1. In generated code and macros, where lint errors may or may not be triggered depending on the generated code.
2. A few places where clippy malfunctions. These use e.g. `#[allow(unused, clippy::allow_attributes)]`.
2025-02-07 14:50:02 +00:00
Yuji Sugiura b3a57696a1 feat(tasks/prettier): Show total match ratio with updating snapshot format (#8788)
Previously, #8634 visualized each spec result, but this was not enough.

If the implementation has been updated but the spec still fails, there
is no way to know if there is an improvement or not.

This time, finally, all progress is visualized! 🤩 


![image](https://github.com/user-attachments/assets/df5b4658-450a-4b0c-8348-ffc9b977c50c)

e.g. here `arrow_function_expression` is mostly passing, except for
comment handling.
2025-01-30 22:27:34 +08:00
overlookmotel ca02c16f8f test(transformer): handle more exec tests (#8493)
Some of Babel's exec tests contain a return statement at top level, in order to return a Promise.

e.g. https://github.com/babel/babel/blob/ad572fd1a1615f53c4e3b85941760bdb1a1aefd9/packages/babel-plugin-transform-private-methods/test/fixtures/private-method-loose/async/exec.js

These test files could not be parsed due to illegal position of `return`, and the tests were silently excluded.

This PR:

1. Includes those tests by passing `allow_return_outside_function: true` option to parser for exec tests.
2. Includes a "transform error" message in snapshot for any exec tests which produce errors in parser/transformer.
2025-01-15 02:07:04 +00:00
Dunqing 80c16526fb chore(transformer): enable Babel's private-property-in-property plugin tests (#8201) 2024-12-31 12:30:57 +00:00
Dunqing 6af5870a7d chore(transformer): enable Babel's private-methods plugin tests (#8098)
part of #8052
2024-12-31 12:30:51 +00:00
overlookmotel 3858221f45 refactor(global): sort imports (#7883)
Pure refactor. Re-order imports for clarity:

1. `std`
2. External crates
3. `oxc_*` crates
4. Current crate `use crate::...`
5. Super `use super::...`
6. Local modules

This order is from "furthest away" to "closest". This makes it clearer to see what is coming from where.

`cargo +nightly fmt` (#7877) did a lot of the work, but unfortunately `rustfmt` does not have an option to (a) put workspace crates in a separate block from external crates and (b) move `mod` statements to after `use` statements.
2024-12-14 15:07:21 +00:00
Boshen 7fb9d47460 style(rust): cargo +nightly fmt (#7877) 2024-12-14 06:03:31 +00:00
overlookmotel 588df9f366 test(transformer): transformer conformance runner --override output with spaces not tabs (#7865)
When running `just test-transform --override`, generate override files with indentation as double spaces, instead of tabs. This matches our convention for formatting JS files.
2024-12-14 04:57:00 +00:00
Dunqing b290ebd2b0 refactor(transformer): handle <CWD> in test runner (#7799)
We should move the handling of  `<CWD>` to the test runner because this is just only used in testing, and it causes us always get a path by `self.ctx.source_path` like `<CWD>/xxx/xxx.js`, we should get a real path for this.
2024-12-12 17:22:01 +00:00
Dunqing 4d33ffbbc8 chore(tasks/transform-conformance): support --override flag (#7774)
The `--override` flag used to write the output which is generated by the transformer to the `overrides` folder according to the test path. The acting is similar to the previous `takeover` mode
2024-12-11 16:18:16 +00:00
Dunqing b089e8b519 chore(tasks/transform-conformance): support override to replace takeover mode (#7771)
This PR does the following things.

1. Move the override output of the `snapshots` folder to the `overrides` folder.
2. Support `override` mode to replace `takeover` mode
3. The `update_fixtures.js` no longer uses `overrides`'s `output.js` to replace Babel's `output.js`.

### How does `override` mode work?

When running each test, it checks whether an output file for that test exists in the ⁠`overrides` directory. If it does, the output file will be used to compare with the transformed code.
2024-12-11 16:18:14 +00:00
overlookmotel 450bb334da test(transformer): conformance runner use HelperLoaderMode::External in takeover mode (#7807)
In "takeover" mode, transformer conformance test runner was using `HelperLoaderMode::Runtime`. Switch this to `HelperLoaderMode::External` to match standard test runner mode.
2024-12-11 16:07:01 +00:00
overlookmotel 37709cec18 test(transformer): transform conformance print code with double-space indent (#7707)
Transform conformance tester (`just test-transform`) print code with double-space indent, instead of tabs. This matches our formatting convention for JS files.
2024-12-08 02:58:18 +00:00
Boshen 5891166c80 feat(transform_conformance): custom reporter for exec test (#7715)
closes #7704
2024-12-07 11:25:00 +00:00