Commit Graph

892 Commits

Author SHA1 Message Date
sapphi-red 732205e27b fix(parser): reject using / await using in a switch case / default clause (#15225)
`using` / `await using` directly nested within a `case` or `default` clause are now disallowed (https://github.com/rbuckton/ecma262/pull/14). This PR implements this change.

Note that TypeScript does not disallow them yet (https://github.com/microsoft/TypeScript/issues/62708) and the test failing in `tasks/coverage/snapshots/parser_typescript.snap` is caused by that.
2025-11-08 10:29:37 +00:00
sapphi-red 73f9e29a14 feat(parser): show allowed modifiers in invalid modifier error messages (#15442)
Add allowed modifiers for that context so that it's easier to understand what is wrong.
2025-11-08 06:46:31 +00:00
sapphi-red e1704a4527 feat(parser): improve error message for missing closing tokens that may be followed by a rest element (#15444)
Improves error message for imbalanced tokens that allows rest elements.

**Before**
```
  × Expected `,` but found `Identifier`
   ╭─[typescript/tests/cases/compiler/restParamModifier.ts:2:27]
 1 │ class C {
 2 │     constructor(...public rest: string[]) {}
   ·                           ──┬─
   ·                             ╰── `,` expected
 3 │ }
   ╰────
```
**After**
```
  × Expected `,` or `)` but found `Identifier`
   ╭─[typescript/tests/cases/compiler/restParamModifier.ts:2:27]
 1 │ class C {
 2 │     constructor(...public rest: string[]) {}
   ·                ┬          ──┬─
   ·                │            ╰── `,` or `)` expected
   ·                ╰── Opened here
 3 │ }
   ╰────
```
2025-11-08 04:34:28 +00:00
sapphi-red b7e3849cf0 feat(parser): add more help messages to diagnostics (#15440)
Added more helps to parser errors to make it easier to understand why the error happens or how it can be resolved.
2025-11-08 04:28:18 +00:00
overlookmotel 6c09c1f3ee test(transformer): update transformer conformance snapshots (#15330)
#15232 updated `vitest` package, which caused changes in transform conformance snapshots, which were not committed. Updated snapshots so conformance passes again.
2025-11-05 15:06:05 +00:00
Copilot 7a5c011a14 fix(transformer): convert enum numbers to strings in template literals (#15183)
- [x] Explore repository structure and understand the issue
- [x] Identify the bug in enum.rs (lines 430-434) - missing
number-to-string conversion in template literals
- [x] Create test case for enum template literal with numbers
- [x] Fix the bug by converting numbers to strings in template literal
evaluation
- [x] Verify the fix with manual testing (regular numbers, mixed types,
negative numbers, floats, Infinity, NaN)
- [x] Run unit tests - all passing
- [x] Run code review - reviewed, minor comment about exhaustiveness
(already handled)
- [x] Run security check - no issues found
- [x] Update transform conformance snapshots per CI feedback
- [x] Fix template literal quasi bug (use enumerate instead of zip)
- [x] Add test case for trailing quasi edge case
- [x] Task completed

## Summary
Fixed a bug where numeric enum values in TypeScript were not converted
to strings when used in template literals. The fix converts
`ConstantValue::Number` to strings using `to_js_string()` method.

Fixed an additional bug where the last quasi (suffix) in template
literals was being dropped due to using `zip` instead of properly
iterating over all quasis with conditional expression access.

Updated the transform conformance snapshots to include both test cases.

## Security Summary
No security vulnerabilities were found in the changes.

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



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>transformer: computed enum with number in string template
is incorrect</issue_title>
>
<issue_description>[playground](https://playground.oxc.rs/#eNptVMFOGzEQ/ZXI6gGkgELggFL1UAGRKgFJC5RLpOLdnQSD197aswlotf/eZyfeTQWneN945s28eU4jcjER9FZZxwMydTm4rcuM3FU4NgszGNw+3Pw5GXwbnIxGo2ECxgDG+8ApgNN94AzA2RZoF2Zh9ikubFnVTEVPcjG7mT/cX11GpqcvTd/EceRvjz5g4/YpknWpoaePqaefpJ7F1NhWbo23mo61XR3MshfK+XgtdU3+YL/Jw8OvCyOGwopJI1xtwo9WhsVkKbWnoVhaV0pmch3CThofYDFhVwNQ4JGod0m5lk6yAnN3e/OsmHwlc+qgUpqV7j9ztOPI9yk+txXC2+L+vcysTl/5crW71g5FJZ0PfTXYMpPx4MXG2b9hHqm13fwirp2Z1exVQdPa5KG1VCpwklvTXDrkJjTm/T7/YdgpVMy7gCe0zSq/cs66HYoeglaxB5z3pGpE7eleZv1QLLNHVfCzmIyHgkwxW14rgymFXqLdCmy8i5+PwKaCRD9ry71OL/7t7hP4b/iaO1uBS0h/ZIgKKlATe1Job4V1lzLEtAaKOVQ3LGbZpPkR38h3jyuZk/kr8R2WhvR0OaGypG3nO34bvfXoZIUaSdRAFHv9zhAyg9vm5P5Lw6shp0oyLPUMR8nWza1X2xUFhQQk7by2FZWlWxG8Kcjj2TFYIPMlLVF4at2Flt5PFemi29o+C+xpI00fLRV36A2xLCRDqd1qP7d1IzwmqmAQckbCmMmNuS1oRfEBmWCEzrMvvrD4K9pJbozlWCshmlbpbqySHkNwVHopmNxW17SmrugrUXWLVSSDxVSY1uopDBwy1uQy65PgYR4TFhVC3akFXET5Atyd2oAHmdNM7T8OrNw+)
> Original report: https://github.com/vitejs/rolldown-vite/issues/472
> 
> ### Input
> ```ts
> export enum NumberEnum {
>   NUM_1 = 1000,
>   NUM_2 = 2000,
>   NUM_3 = 3000,
>   NUM_4 = 4000,
> }
> 
> export enum ComputedEnum {
>   COMPUTED_1 = `${NumberEnum.NUM_1}-${NumberEnum.NUM_2}`,
>   COMPUTED_2 = `${NumberEnum.NUM_3}-${NumberEnum.NUM_4}`,
> }
> 
> console.log(Object.values(ComputedEnum));
> ```
> ### Actual
> ```js
> export let NumberEnum = /* @__PURE__ */ function(NumberEnum) {
> 	NumberEnum[NumberEnum["NUM_1"] = 1e3] = "NUM_1";
> 	NumberEnum[NumberEnum["NUM_2"] = 2e3] = "NUM_2";
> 	NumberEnum[NumberEnum["NUM_3"] = 3e3] = "NUM_3";
> 	NumberEnum[NumberEnum["NUM_4"] = 4e3] = "NUM_4";
> 	return NumberEnum;
> }({});
> export let ComputedEnum = /* @__PURE__ */ function(ComputedEnum) {
> 	ComputedEnum["COMPUTED_1"] = "-";
> 	ComputedEnum["COMPUTED_2"] = "-";
> 	return ComputedEnum;
> }({});
> console.log(Object.values(ComputedEnum));
> ```
> 
> ### Expected
> ```js
> export let NumberEnum = /* @__PURE__ */ function(NumberEnum) {
> 	NumberEnum[NumberEnum["NUM_1"] = 1e3] = "NUM_1";
> 	NumberEnum[NumberEnum["NUM_2"] = 2e3] = "NUM_2";
> 	NumberEnum[NumberEnum["NUM_3"] = 3e3] = "NUM_3";
> 	NumberEnum[NumberEnum["NUM_4"] = 4e3] = "NUM_4";
> 	return NumberEnum;
> }({});
> export let ComputedEnum = /* @__PURE__ */ function(ComputedEnum) {
> 	ComputedEnum["COMPUTED_1"] = "1000-2000";
> 	ComputedEnum["COMPUTED_2"] = "3000-4000";
> 	return ComputedEnum;
> }({});
> console.log(Object.values(ComputedEnum));
> ```
> </issue_description>
> 
> <agent_instructions>We should take a look at
./crates/oxc_transformer/src/typescript/enum.rs to check if there is a
bug</agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>

- Fixes oxc-project/oxc#15182

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

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
2025-11-04 11:44:34 +08:00
sapphi-red 682dca2ea7 feat(parser): add more helps to parser errors (#15186)
Added more helps to parser errors to make it easier to understand how the error can be resolved.
2025-10-31 07:10:45 +00:00
Boshen bf09033cf6 chore(submodules): update submodule SHAs to latest commits (#15012)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `baa48a4` → `d2940bd`
- babel: `41d9651` → `4cc3d88`
- TypeScript: `261630d` → `8ea03f8`
- prettier: `7584432` → `011791f`
- acorn-test262: `090bba4` → `994d763`
- node-compat-table: `ed0d6ba` → `17ac85c`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2025-10-28 02:38:20 +00:00
leaysgur a8e5181ab7 chore(infra): dogfooding oxfmt (#14979)
Fixes #14803

- Added `oxfmt` and `oxfmtrc.jsonc`
- Remove `dprint` plugin and useless ignore paths
- Apply `dprint` again
- Apply `oxfmt`
2025-10-28 01:16:46 +00:00
leaysgur 75cbe11b23 chore(deps): Update Node.js version to 24.10.0 (#14982)
Node.js v22 active LTS has ended last week.

> https://nodejs.org/en/about/previous-releases
2025-10-27 08:46:15 +00:00
Yuji Sugiura d9f7df8bc6 fix(ci): Update transform_conformance snapshots to make CI pass (#14981)
This fixes a CI failure caused by updating dependencies.
2025-10-27 16:45:07 +08:00
Dunqing 2bc1978d48 fix(transformer/legacy-decorator): correct generating metadata for getter/setter methods (#14495)
* Fixes: #14493

Getter and setter methods should not have `design:returntype` metadata according to TypeScript's `emitDecoratorMetadata` behavior. They should only have `design:type` and `design:paramtypes`.

**And `design:type` is different for the getter and setter:**

Getter: `design:type` is the same as the return type of method.
Setter: `design:type` is the same as the type of the first parameter of the method
2025-10-22 08:57:24 +00:00
camc314 ae2003c656 feat(semantic): add symbol_id to ts function type binding idents (#14673)
fixes #14668
2025-10-17 04:30:29 +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 802ffbe2c4 chore(deps): bump NodeJS version to 22.20.0 (#14149)
Bump NodeJS version to latest active LTS version (v22.20.0).

This is to test that Oxlint plugins written in TS work as intended (#14009). Type-stripping is only supported in NodeJS 22.18.0+ (see #13878).
2025-09-26 11:04:47 +00:00
Dunqing 5ec92095b2 fix(transformer/class-properties): don't transform properties that have declare modifier (#13766)
* Fixes #13733

Fixes the issue where `declare` fields were incorrectly transformed instead of being removed, causing inheritance issues where child `declare` fields would interfere with parent class property initialization.

Only in the `enter_*` phase do we have to skip the `declare` field; in the exit phase, the `declare` fields have already been removed in the `TypeScript` plugin.
2025-09-17 14:49:59 +00:00
Dunqing 7d0b8a1dd4 fix(transformer/typescript): panic occurs when declare property and definite property that has initializer (#13785)
Remove two incorrect assertions, which cause panic in the https://github.com/oxc-project/oxc/pull/13766.

The `declare` property with an initializer is allowed in [TypeScript](https://www.typescriptlang.org/play/?useDefineForClassFields=true&target=7&noCheck=false&stripInternal=true&ts=5.9.2#code/MYGwhgzhAEAiCmowCd4FEAeYC2AHE80A3gFDTQAmi4q0qYFA9gHYgCe0ARitALzQAiAC7wIQgQG4ylaikL0mrDgDNGjPtACMUgL4kSSKHHjKAls1MjMOfIVLk68Bi3ZcUAQg3DR4qQ4UuKmqe-NokekA)
```ts
class DeclareExample {
  declare readonly bar = "test";
  declare readonly foo = 1;
}
```

The `!` (definite) with an initializer isn't allowed in [TypeScript](https://www.typescriptlang.org/play/?useDefineForClassFields=true&target=7&noCheck=false&stripInternal=true&ts=5.9.2#code/MYGwhgzhAEAiCmowCd4FEAeYC2AHE80A3gFDTQAmi4q0qYFA9gHYgCe0ARitALzQAiAC7wIQgQG4ylaikL0mrDgDNGjPtACMUgL5A), but this is a recoverable error, so the AST can have such.

```ts
class DefiniteExample {
   readonly bar! = "test";
   readonly foo! = 1;
}
```
2025-09-16 12:56:47 +00:00
Dunqing bb2bcf0361 fix(transformer): improve legacy decorator handling and fix constructor parameter decorators (#13632)
Fixes https://github.com/rolldown/rolldown/issues/6079. Regressed introduced by https://github.com/oxc-project/oxc/pull/13227.

The root cause is that the class plugin will insert a constructor method in some cases, but metadata handling is processed before the constructor is inserted, which causes the method count not to be exactly the same as the method metadata count. Thus, decorator metadata is inserted in the incorrect place.

This PR refactors the core transformation logic to ensure that the new methods and properties inserted by other plugins won't affect the decorator transformation.

### Transformation Flow Changes

  Before: Complex upfront analysis with separate processing paths
  - Used check_class_has_decorated() to analyze entire class tree
  - Separate handling for class vs element decorators
  - Multiple disconnected stacks for state tracking

  After: Unified incremental processing
  - Process decorators as we traverse (exit_method_definition,
  exit_property_definition, etc.)
  - Accumulate decoration statements in single stack during traversal
  - Unified processing in transform_class() using consolidated state
2025-09-11 08:07:20 +00:00
sapphi-red 9184911eac fix(regular_expression): detect usage of unsupported syntax recursively (#13470)
unsupported syntax inside groups and others were not detected properly.
2025-08-31 15:15:49 +00:00
sapphi-red 0eea7da1c8 fix(regular_expression): don't lower capture groups that are not named ones (#13469)
Capture groups that are not named ones are lowered even though it's not needed to.
2025-08-31 15:15:49 +00:00
overlookmotel 7ee19e2c88 fix(transformer/styled-components): remove leading whitespace when literal starts with block comment containing interpolation in CSS minification (#13391)
Remove leading whitespace when template literal starts with a block comment which contains interpolations.

Previously we didn't remove it because we checked if we're at start of the template literal with `quasi_index == 0`, but that wasn't right because the 1st quasi gets merged into the 2nd. So the 2nd quasi is the 1st *output* quasi. Introduce `is_first_output` var to track this state.

Input:

```js
styled.div` /* ${x} */ color: red; `;
```

Previous output post-minification:

```js
styled.div` color:red;`;
```

After this PR:

```js
styled.div`color:red;`;
```
2025-08-30 04:23:58 +00:00
overlookmotel cf5175c2f4 fix(transformer/styled-components): remove unnecessary whitespace when removing block comments in CSS minification (#13390)
Remove special logic for inserting spaces when removing comments. Instead, treat comments as equivalent to whitespace, and apply the same rules.

This fixes 2 problems:

1. Don't add unnecessary space when a block comment appears after a character like `{`.
2. *Do* add a space when a block comment is the whole quasi between 2 interpolations, to prevent them being merged.

Simplifying this logic also gives 1%-2% speed-up on transformer benchmarks.

Input:

```js
styled.div`.a {/* blah */color: green; }`;
styled.div`${x}/* blah */${y}`;
```

Previous output post-minification:

```js
styled.div`.a{ color:green;}`;
styled.div`${x}${y}`;
```

After this PR:

```js
styled.div`.a{color:green;}`;
styled.div`${x} ${y}`;
```
2025-08-30 04:23:57 +00:00
overlookmotel c900b3eff3 fix(transformer/styled-components): remove more escaped line breaks in CSS minification (#13380)
The change in approach to whitespace in #13379 means we can remove more escaped line breaks (`\r` and `\n`).

Previously when processing `\r\n`, the next character after `\r` was seen as `\`, and therefore a space was unnecessarily inserted.

Now we only look backwards, not forwards, so this problem goes away. We just treat `\r` and `\n` like any other whitespace.
2025-08-29 05:26:27 +00:00
overlookmotel 6dc5b708ba fix(transformer/styled-components): remove unnecessary whitespace around block comments in CSS minification (#13379)
Previously we included whitespace around block comments when the following character means it could have been removed. e.g.:

Input:

```js
styled.div`.a /* blah */ { color: blue }`
```

Previous output post-minification:

```js
styled.div`.a {color:blue}`
```

After this PR:

```js
styled.div`.a{color:blue}`
```

This is achieved by a significant change to how spaces are inserted.

Previous logic: When encountering whitespace, determine whether to print a space or not based on what came before it, and what's after it. Problem is that this doesn't work correctly when the whitespace is followed by a block comment, because next char is `/` (start of the comment) - whereas what you really want to know is what's *after* the comment.

New logic: When encountering whitespace, print a space if the preceding character isn't `:`, `;`, etc. Don't take into account what the next char is. But later on when encounter e.g. `{`, check if previous character is a space, and if so, remove it. So in the case of `.a /* blah */ {}`, a space gets printed after `.a`, but then it gets deleted again when `{` is found after the comment.

This also has the benefit of making the code simpler.
2025-08-29 05:26:26 +00:00
overlookmotel 5a25c06af5 fix(transformer/legacy-decorator): simplify enum type inference (#13357)
Follow-on after #13327.

It seems that TS infers the type of `+x`, `-x`, and `~x` as `Number`, no matter what `x` is.

All other `UnaryOperator`s (`!x`, `void x`, `typeof x`, `delete x`) are illegal as enum initializers, so we can ignore those cases and just say all `UnaryExpression`s are `Number`s.

[TS Playground](https://www.typescriptlang.org/play/?experimentalDecorators=true&emitDecoratorMetadata=true&target=99#code/GYVwdgxgLglg9mABAcwKZQMpQE4zMgCgEpEBvRbdEbJAcgGcc9laBuRAXwCgvUwQAtogCqYAIbYAngHkoAC1TYAovyGkuiRGFTIxsAG6pEAXkQBaNJib5iAGg2IADnHowDR0wGpLWXDaL2mgBGbgDuMPQeiAB+PtaEAVzcXKCQsAiIACaoEHDYeqgEAPpQEpYAXIhiYJK2iEWO2HCOilCSlYx+yCSkyagAHs7YUIgQADZi9PSIAGJwcGQOAALZuflQqA7gEjLyigAKTY6VojuyCsqqJiLiUueKKoIAdNq67qxJXEA)

Additionally, `BigInt`s are illegal as enum initializers, so we can ignore them too.

[TS Playground](https://www.typescriptlang.org/play/?experimentalDecorators=true&emitDecoratorMetadata=true&target=99#code/KYOwrgtgBAQglgcwJIgC4FFzQN4CgpQBGiUAvFAIwAMVIANPkYgsAE5mU0324C+uQA)

We can therefore simplify type inference for decorators.
2025-08-29 04:56:12 +00:00
overlookmotel f02b05e938 test(transformer/styled-components): fix test case (#13377)
Fix a test case which was previously failing. The original test case in `babel-plugin-styled-components` *does* include a space before `height:`. Our copy of the test had got changed somehow (wrongly). This PR brings the case back into alignment with the original and, thanks to #13346, it now passes.

https://github.com/styled-components/babel-plugin-styled-components/blob/4e2eb388d9c90f2921c306c760657d059d01a518/test/fixtures/minify-single-line-comments-with-interpolations/output.js#L26-L29
2025-08-29 03:15:29 +00:00
overlookmotel df38b2c18b fix(transformer/styled-components): remove space before line comment in CSS minification (#13371)
Previously we'd include an unnecessary space when removing a line comment in cases like:

Input:

```js
styled.div`
  .a // comment
  { color: red; }
`
```

Previous output post-minification:

```js
styled.div`.a {color:red;}`
```

After this PR:

```js
styled.div`.a{color:red;}`
```

We still include excess spaces when removing block comments (e.g. ``styled.div`.a /* */ {}` `` -> ``styled.div`.a {}` ``), but that's more complicated to fix, so leaving it for now.
2025-08-29 03:15:28 +00:00
overlookmotel a7a06b7902 fix(transformer/styled-components): fix block comment containing expression in CSS minification (#13370)
Fix handling block comments which contain an expression. Previously if that block comment ended exactly before another expression, the comment wouldn't be considered closed, and all remaining parts of the template literal would be removed.

Input:

```js
styled.div`${x}/* ${y} */${z}`
```

Previous output post-minification:

```js
styled.div`${x}`
```

After this PR:

```js
styled.div`${x}${z}`
```

This bug was introduced way back in #12224 (my fault!), but had gone unnoticed.
2025-08-29 03:15:28 +00:00
overlookmotel 35d83ca89b fix(transformer/styled-components): remove repeat whitespace in CSS minification (#13369)
Follow-on after #13346. Remove multiple spaces preceding `{`, `}`, `,`, or `;`.

Previously we removed a single space, but wouldn't remove multiple whitespace characters in a row.
2025-08-29 03:15:28 +00:00
Dunqing 7aff3b6af4 fix(transformer/styled-components): preserve spaces between consecutive interpolations in CSS minification (#13346)
Fixes #13312

When minifying CSS in styled-components, spaces between consecutive interpolations were incorrectly removed, breaking CSS selectors.

**Before:** `&:hover ${A}${B}` (incorrect - space removed)
**After:** `&:hover ${A} ${B}` (correct - space preserved)

The fix modifies the whitespace handling logic to preserve spaces between consecutive interpolations while still removing unnecessary spaces elsewhere.
2025-08-28 17:10:12 +00:00
Dunqing 24fee158e2 fix(transformer/legacy-decorator): emit correct metadata types for enum (#13327)
* close:  #13319

---------

Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2025-08-28 16:23:21 +01:00
renovate[bot] 7e1635a057 chore(deps): lock file maintenance npm packages (#13282)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Boshen <boshenc@gmail.com>
2025-08-25 15:52:58 +08:00
Dunqing e7a49ed717 refactor(transformer/legacy-decorator): eliminate unreliable identification of metadata (#13227)
Fixes: https://github.com/oxc-project/oxc/pull/13215#pullrequestreview-3132979634

Collect metadata and store them in a `VecDeque`, and take them when transforming the class decorators in the `exit_class` side, which can eliminate the unreliable check of `span.is_unspanned` for metadata decorators. However, it introduces a little complexity.
2025-08-24 08:36:04 +00:00
Boshen f897e303eb chore(tasks): update test262, babel and TypeScript (#13217) 2025-08-20 01:22:35 +00:00
Dunqing 76a9865af0 fix(transformer/legacy-decorator): metadata should be inserted after all params decorators (#13215)
* Fixes https://github.com/oxc-project/oxc/issues/13210
2025-08-19 16:08:53 +00:00
overlookmotel ea1e0a66c2 refactor(conformance): fix lint errors in conformance update fixtures script (#13187)
Fix lint errors in script which updates transformer fixtures.
2025-08-18 13:45:12 +00:00
Dunqing 6fe0bb5619 fix(transformer/react): spread props optimization breaks __self and __source injection (#13009) (#13020)
* Fixes #13009

The optimization that converts `{...props}` to `props` when it's the only attribute was incorrectly applied even when `jsx_self` or `jsx_source` plugins are enabled. This caused `__self` and `__source` props to not be merged properly,
resulting in incorrect transformation output in development mode.

This fix disables the optimization when these dev plugins are active, ensuring spread props are preserved for proper merging.
2025-08-12 11:59:13 +00:00
Copilot df68910f8b test(transformer): rename babel-plugin-proposal-explicit-resource-management test directory (#12894) 2025-08-09 17:59:08 +08: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 d02e17c79d fix(transformer/class-properties): preserve computed keys if they may have side effects when remove_class_fields_without_initializer is enabled (#12772)
When `remove_class_fields_without_initializer` is enabled, fields without initializers would be removed. However, if the key is computed, and it may have side effects, then we should extract it and place it before class, so that it can keep the same behavior as before.

**Example:**

Input:
```ts
import { Collection } from './collection.ts';

export class Obj {
  public readonly [Collection.identifier] = true;
  public readonly [Collection.identifier2];
  public static readonly [Collection.identifier3] = true;
  public static readonly  [Collection.identifier4];
}
```

Options:
```json
{
  "assumptions": {
    "setPublicClassFields": true
  },
  "plugins": [
    "transform-class-properties",
    [
      "transform-typescript",
      {
        "removeClassFieldsWithoutInitializer": true
      }
    ]
  ]
}
```

Output:
```js
import { Collection } from "./collection.ts";
let _Collection$identifie, _Collection$identifie2;
_Collection$identifie = Collection.identifier;
Collection.identifier2;
_Collection$identifie2 = Collection.identifier3;
Collection.identifier4;
export class Obj {
  constructor() {
    this[_Collection$identifie] = true;
  }
}
Obj[_Collection$identifie2] = true;
```
2025-08-03 07:16:26 +00:00
Dunqing 701399ee4e fix(transformer/typescript): don't remove class fields without initializers when class-properties plugin is enabled (#12771)
* close #12770

Both `typescript` and `class-properties` have the same transformation for class fields. They would conflict when both are run, so we have to stop transforming class fields in the `typescript` plugin when `class-properties` is enabled.
2025-08-03 03:22:49 +00:00
Copilot 8854c1aa94 fix(transformer/typescript): revert "remove properties with definite assignment assertion" (#12759) 2025-08-02 23:54:40 +08:00
Dunqing 0e1e79dc6b fix(transformer/typescript): remove properties with definite assignment assertion (#12713)
close: https://github.com/rolldown/tsdown/issues/399

Here is a [TypeScript Playground](https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAYwDYEMDOa4FkCeBhVDOAbwCg44A7FAW2AEIAuONGKAS0oHNyXQmWbTjwC+pUrgLo0AOjBQIMRTjDAZ1OnAC8cAOQAvABYpuaE7on5Cs+YuWqZaUNr00USYBaA), which shows the expected output.
2025-08-02 11:12:43 +00:00
Dunqing 2f66dd2306 fix(transformer/styled-components): preserve whitespace before interpolations in minification (#12558)
close: #12556

Fixed an issue where spaces before template literal interpolations were incorrectly removed during CSS minification in the styled-components plugin.

The fix ensures spaces are preserved (e.g., `padding: 0 ${PADDING}px` stays as `padding:0 ${PADDING}px` instead of becoming `padding:0${PADDING}px`).
2025-07-28 13:34:01 +00:00
Dunqing 7c2d2c664e fix(transformer/top-level-statements): should not inject statements after non-import statement (#12463)
* close https://github.com/oxc-project/oxc/issues/12460

Injecting top-level statements after the last import statement is unsound because once there is an import statement in the last line, it would be broken if other code relies on the injected statements. Learn more to see the following example.

I suppose the reason we did this is that we had a test case that misled us. I overrode that test with the expected output.

For example:

Input:

```js
import { observer } from 'mobx-react-lite'
import { useFoo } from './useFoo'

export const BazComponent = observer(function BazComponent_() {
  const foo = useFoo()
  return (
    <>
      {foo}
      {bar}
    </>
  )
})

import { bar } from './bar'
```

Before output:
```js
import { observer } from "mobx-react-lite";
import { useFoo } from "./useFoo";
export const BazComponent = _s(observer(_c = _s(function BazComponent_() {
        _s();
        const foo = useFoo();
        return /* @__PURE__ */ _jsxs(_Fragment, { children: [foo, bar] });
}, "useFoo{foo}", false, function() {
        return [useFoo];
})), "useFoo{foo}", false, function() {
        return [useFoo];
});
_c2 = BazComponent;
import { bar } from "./bar";
import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
var _s = $RefreshSig$();
var _c, _c2;
$RefreshReg$(_c, "BazComponent$observer");
$RefreshReg$(_c2, "BazComponent");

```

After output:

```js
import { observer } from "mobx-react-lite";
import { useFoo } from "./useFoo";
import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
var _s = $RefreshSig$();
export const BazComponent = _s(observer(_c = _s(function BazComponent_() {
        _s();
        const foo = useFoo();
        return /* @__PURE__ */ _jsxs(_Fragment, { children: [foo, bar] });
}, "useFoo{foo}", false, function() {
        return [useFoo];
})), "useFoo{foo}", false, function() {
        return [useFoo];
});
_c2 = BazComponent;
import { bar } from "./bar";
var _c, _c2;
$RefreshReg$(_c, "BazComponent$observer");
$RefreshReg$(_c2, "BazComponent");
```

The difference is that `import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; var _s = $RefreshSig$();` has injected after `import { useFoo } from "./useFoo";`
2025-07-24 00:58:59 +00:00