Commit Graph

418 Commits

Author SHA1 Message Date
oxc-bot 0fa9b8a8ab release(crates): v0.79.0 (#12600) 2025-07-30 10:31:53 +08:00
oxc-bot ccf1fb4241 release(crates): v0.78.0 (#12486) 2025-07-24 12:02:16 +08:00
Dunqing ccbcf3eff7 feat(transformer, minifier, syntax)!: remove ESTarget::ES5 (#12448)
* close https://github.com/oxc-project/oxc/issues/11296

Both `Transformer` and `Minifier` have a minimum ES version support of `ES2015`. However, we can set the `ESTarget` to `ES5` now, which might mislead users into thinking we already support `ES5`, so for now, let's remove the `ESTarget::ES5` option to eliminate the confusion.

Suggested by @shulaoda
2025-07-24 01:07:20 +00:00
Dunqing 986c48e2a9 fix(transformer/decorator): transformed decorators should be injected after class-properties has run (#12418)
* close https://github.com/rolldown/rolldown/issues/5374

Example:

Input:
```ts
function myPropertyDecorator() {
  return (target: any, propertyKey: number) => {
    console.log(target.constructor.modelName, propertyKey);
  };
}

class Test {
  public static modelName = 'Test';

  @myPropertyDecorator()
  public myProperty = 1;
}

const instance = new Test();

export default instance;
```

Output diff:
```diff
function myPropertyDecorator() {
        return (target, propertyKey) => {
                console.log(target.constructor.modelName, propertyKey);
        };
}
class Test {
        constructor() {
                babelHelpers.defineProperty(this, "myProperty", 1);
        }
}
-babelHelpers.decorate([myPropertyDecorator()], Test.prototype, "myProperty", void 0);
-babelHelpers.defineProperty(Test, "modelName", "Test");
+babelHelpers.defineProperty(Test, "modelName", "Test");
+babelHelpers.decorate([myPropertyDecorator()], Test.prototype, "myProperty", void 0);

const instance = new Test();
export default instance;
```

The cause is that we transform class fields and decorators in two different plugins, and the decorator plugin should be transformed first, and then run the class-properties plugin, because class-properties might erase some decorator information. However, this cause transformed decorators injected before transformed class fields.

This PR fixes this problem by collecting all transformed decorators that wait for injection, and injecting them in batch after the `class-properties` plugin has run.
2025-07-21 15:14:41 +00:00
oxc-bot 11cad7d0f6 release(crates): v0.77.3 (#12407) 2025-07-20 22:34:27 +08:00
Boshen 8bae4176ff perf(codegen): remove the useless tokens generated by some expressions (#12394) 2025-07-20 03:58:15 +00:00
Boshen fa2d3f1481 chore(deps): napi v3 (#12388) 2025-07-18 11:45:19 +00:00
oxc-bot f4e06c89ab release(crates): v0.77.2 (#12372) 2025-07-17 23:40:00 +08:00
Boshen a55b9708c5 chore(deps): oxc-sourcemap v4.0 (#12347)
This release removes rayon support from oxc-sourcemap.

Parallelizing functions calls locally inside sourcemap generation is not optimal,
they interfere with thread scheduling with the rest of the system
2025-07-17 03:53:23 +00:00
oxc-bot ab68d5c7b4 release(crates): v0.77.1 (#12319) 2025-07-16 19:28:15 +08:00
oxc-bot 95b13e8c00 release(crates): v0.77.0 (#12234) 2025-07-12 10:15:34 +08:00
Dunqing bfd47f89b5 fix(transformer/styled-components): should use source path to generate file hash when the path is absoulte path (#12199)
related: https://github.com/oxc-project/oxc/issues/11876#issuecomment-3058036852
2025-07-11 04:54:35 +00:00
Dunqing 75ee3a17e5 feat(napi/transform): support enabling StyledComponent plugin (#12155) 2025-07-10 01:57:47 +00: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 407429a09c feat(napi/parser,napi/transform): accept lang=dts (#12154) 2025-07-09 09:13:18 +00:00
camc314 baa372641e refactor(tests/napi): add build-test script for tests (#12132) 2025-07-08 17:08:14 +00:00
oxc-bot 671b596ab1 release(crates): v0.76.0 (#12125) 2025-07-08 17:33:59 +08: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
oxc-bot a257d9732c release(crates): v0.75.1 (#12057) 2025-07-03 21:51:31 +08:00
oxc-bot d25dc35b19 release(crates): v0.75.0 (#11897) 2025-06-25 19:49:12 +08:00
oxc-bot 94a418d201 release(crates): v0.74.0 (#11853) 2025-06-23 13:27:08 +08:00
oxc-bot 3de6b99990 release(crates): v0.73.2 (#11785) 2025-06-18 13:23:17 +08:00
oxc-bot 14f7033f66 release(crates): v0.73.1 (#11774) 2025-06-17 21:17:38 +08:00
LongYinan 81ef44329f feat(napi): add aarch64-linux-android target (#11769)
- Close https://github.com/oxc-project/oxc/issues/11566
2025-06-17 15:46:41 +08:00
oxc-bot e7af8c470c release(crates): v0.73.0 (#11669) 2025-06-13 18:33:56 +08:00
Boshen b5a6a6e78f docs(napi): add stackblitz examples 2025-06-06 20:27:35 +08:00
oxc-bot 958849ca05 release(crates): v0.72.3 (#11504) 2025-06-06 15:40:07 +08:00
LongYinan ab0dd29a2b fix(napi): napi build cache problem (#11479) 2025-06-05 12:16:08 +08:00
Boshen 1401839036 feat(napi): add webcontainer fallback to transform and minify packages (#11471) 2025-06-04 08:11:01 +00:00
Boshen 0c2d1c1e80 Revert "chore(napi): upgrade to napi@3.0.0-beta.4" (#11474)
Reverts oxc-project/oxc#11466
2025-06-04 16:03:12 +08:00
LongYinan 81af6b3988 chore(napi): upgrade to napi@3.0.0-beta.4 (#11466)
Regenerate the binding files
2025-06-04 11:49:19 +08:00
oxc-bot 972c76572b release(crates): v0.72.2 (#11411) 2025-05-31 13:45:07 +08:00
oxc-bot 01a4647a18 release(crates): v0.72.1 (#11345) 2025-05-28 16:54:01 +08:00
oxc-bot 3efc25fdeb release(crates): v0.72.0 (#11267) 2025-05-24 14:53:50 +08:00
Boshen 9a2a6c6c37 chore(napi): remove --no-dts-cache 2025-05-20 15:20:12 +08:00
oxc-bot 4086e24083 release(crates): v0.71.0 (#11182) 2025-05-20 13:11:01 +08:00
Boshen d67c9e583b feat(napi): bump napi to beta (#11159) 2025-05-19 15:05:34 +00:00
Boshen 963167dc76 fix(napi): fix cfg feature on global_allocator 2025-05-15 22:20:42 +08:00
oxc-bot 58d2e6effe release(crates): v0.70.0 (#11061) 2025-05-15 21:55:38 +08:00
Boshen 635aa96219 fix(napi): computed final source type from lang then sourceType (#11060)
closes #10980

Previously final source type was only computed when `lang` is not set.

It is changed to:

* compute source type from `lang`, use filename extension if `lang` is
not set
* reset the computed source type with 'script` or `module` if provided
2025-05-15 21:41:42 +08:00
Boshen 584d8b93b7 fix(napi): enable mimalloc no_opt_arch feature on linux aarch64 (#11053)
fixes #11045

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-15 17:09:43 +08:00
Boshen 2787193e7f chore(napi): adjust test commands (#11021)
so we can run `pnpm run test -u`
2025-05-14 04:04:52 +00:00
Bernd Storath 647b6f3177 feat(napi): add arm musl (#10958)
closes #10954

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2025-05-12 20:13:58 +08:00
oxc-bot 2b890aba8f release(crates): v0.69.0 (#10925) 2025-05-10 00:06:12 +08:00
Dunqing 6de0bc29bd feat(transformer/typescript): support transforming class fields into this assignment (#10854)
Close https://github.com/oxc-project/oxc/issues/10649
2025-05-09 08:43:13 +00:00
Boshen 22ba60b6c4 feat(napi): add s390x-unknown-linux-gnu build (#10892) 2025-05-08 20:13:41 +08:00
Boshen 308fe732d9 feat(napi): add x86_64-unknown-freebsd and riscv64gc-unknown-linux-gnu builds (#10886)
closes #10822
2025-05-08 18:26:22 +08:00
oxc-bot e6074275ae release(crates): v0.68.1 (#10796) 2025-05-05 00:53:44 +08:00
oxc-bot 61dfcfdfd8 release(crates): v0.68.0 (#10777) 2025-05-04 09:06:24 +08:00
overlookmotel 88249f77f0 perf(napi/transform): do not create temp String (#10752)
Avoid an allocation. `to_string` here clones a `String` and then immediately converts it back to a `&str`. Avoid that intermediate allocation.
2025-05-01 13:38:01 +00:00