This follows up on #24741 and addresses API feedback received after it was merged.
### Feature
`mangleProps.include` and `mangleProps.exclude` now accept JavaScript `RegExp` values instead of strings.
The binding copies the regular expression source and flags before async minification starts, then compiles the pattern once with Rust's regex engine. Native and WASI bindings expose the same API. The core Rust minifier API is unchanged.
### Example
```js
mangleProps: {
include: /^_/,
exclude: /^__public/,
}
```
### Limitation
Matching uses Rust regex syntax. The `i`, `m`, `s`, and `u` flags are supported. Unsupported JavaScript syntax or flags are returned as option errors.
### AI assistance
OpenAI Codex was used for research, implementation, review, and testing. I reviewed and take responsibility for the changes.
The property mangler added in #24740 is not available through `oxc-minify`. This adds `mangleProps` for configuring it and `mangleCache` for reusing chosen property names.
### Feature
- `include` selects property names to mangle. `exclude` and `reserved` keep names unchanged.
- `quoted` also mangles quoted property names. `debug` produces readable output names.
- `cache` fixes a property to a chosen name. A `false` value keeps the original name.
- Property mangling works in both sync and async APIs. It is separate from identifier mangling.
- When property mangling is enabled and the call succeeds, the result includes the updated `mangleCache`.
- Invalid `mangleProps` regexes and cache entries are returned in `result.errors`.
### Design
The binding converts JavaScript values into core minifier options and results. The core minifier still chooses names and rewrites properties, so both APIs follow the same rules.
A parser error may leave an incomplete AST. In that case, property mangling is skipped and no partial cache is returned.
### Example
```js
const result = minifySync(
"test.js",
"let local; obj._often; obj._rare; obj._often;",
{
compress: false,
mangle: false,
mangleProps: { include: "^_" },
},
);
result.code; // "let local;obj.e;obj.t;obj.e;"
result.mangleCache; // { _often: "e", _rare: "t" }
```
### Limitation
- `include` and `exclude` use Rust regex syntax. They match anywhere unless the pattern includes anchors.
- Do not reuse the cache on already-mangled output. A mapping is not always safe to apply twice.
- The cache only remembers recorded mappings. It cannot find unchanged names in another input or in external code. Reserve, exclude, or pin those names before the first call.
- String cache targets must be valid JavaScript `IdentifierName` values and cannot be `__proto__`, `constructor`, or `prototype`. The original name `__proto__` cannot be a cache key.
AI assistance: OpenAI Codex and Claude were used for research, implementation, adversarial review, and verification. The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
## Summary
- Update homepage links to point to specific documentation pages (e.g., `https://oxc.rs/docs/guide/usage/linter`)
- Add usage instruction links to napi package READMEs
- Add relevant keywords for better npm discoverability
🤖 Generated with [Claude Code](https://claude.com/claude-code)