Commit Graph

8 Commits

Author SHA1 Message Date
Boshen 38e4b535f7 fix(minifier): validate RegExp patterns before marking as pure (#18125)
## Summary

Invalid RegExp patterns like `RegExp("[")` or invalid flags like `RegExp("a", "xyz")` throw `SyntaxError` at runtime, but the minifier was incorrectly removing them.

This change uses `oxc_regular_expression` to validate patterns at compile time:
- Valid patterns are marked as pure and can be removed when unused
- Invalid patterns or non-literal arguments are kept (preserving runtime errors)

### Behavior

| Input | Valid? | Removed? |
|-------|--------|----------|
| `RegExp()` | ✅ | ✅ |
| `RegExp('a', 'g')` | ✅ | ✅ |
| `RegExp(/foo/)` | ✅ | ✅ |
| `RegExp('[')` | ❌ | ❌ (throws SyntaxError) |
| `RegExp('a', 'xyz')` | ❌ | ❌ (throws SyntaxError) |
| `RegExp(variable)` | ? | ❌ (can't determine) |

Fixes #18050

## Test plan

- [x] Updated existing tests to reflect correct behavior
- [x] Added tests for invalid patterns and flags
- [x] `cargo test -p oxc_minifier` passes
- [x] `cargo test -p oxc_ecmascript` passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-18 12:24:39 +08:00
Boshen 830b757f81 feat(regular_expression): add Unicode 17.0 script properties (#18140)
## Summary

Add support for 4 new scripts introduced in Unicode 17.0:
- `Beria_Erfe` (`Berf`)
- `Sidetic` (`Sidt`)
- `Tai_Yo` (`Tayo`)
- `Tolong_Siki` (`Tols`)

## Test plan

- [x] 8 parser_test262 tests now pass (from 46547 → 46555 positive passed)
- [x] 1 minifier_node_compat test now passes (from 930 → 931 positive passed)
- [x] 8 semantic_test262 tests now pass (from 44911 → 44919 positive passed)
- [x] `cargo test -p oxc_regular_expression` passes

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-17 16:47:06 +00:00
Boshen 82471c8d5a chore(submodules): update submodule SHAs to latest commits (#15825)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `fd594a0` → `c125a8d`
- babel: `777ded7` → `c92c491`
- TypeScript: `48244d8` → `cc2610f`
- prettier: `9e9f65e` → `d7fe2da`
- acorn-test262: `9cce4c9` → `fd0b12c`
- node-compat-table: `6822522` → `499beb6`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2025-11-18 03:31:03 +00:00
Boshen 9b8f41459e chore(submodules): update submodule SHAs to latest commits (#15586)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `d2940bd` → `fd594a0`
- babel: `4cc3d88` → `777ded7`
- TypeScript: `8ea03f8` → `48244d8`
- prettier: `011791f` → `9e9f65e`
- acorn-test262: `994d763` → `9cce4c9`
- node-compat-table: `17ac85c` → `6822522`


This PR is automatically generated by the [update_submodules
workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-11-11 17:43:08 +08:00
sapphi-red 8b14ec9370 fix(minifier): handle { __proto__: null } instanceof Object correctly (#15217)
`{ __proto__: null } instanceof Object` should be `false` or kept as-is, or it was compressed to `true`.
2025-11-02 12:20:56 +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
sapphi-red 5198a01191 fix(minifier): handle __proto__ when inlining single-use variables (#13926)
```js
function wrapper() { var __proto__ = []; return { __proto__ } }
```
was compressed to
```js
function wrapper() { return { [] } }
```
. This PR fixes this bug.
2025-09-20 03:16:04 +00:00
sapphi-red 638416e291 feat(tasks/coverage): add node compat table tests for minifier (#13925)
Added test cases from https://github.com/williamkapke/node-compat-table for the minifier.
2025-09-20 03:16:04 +00:00