Commit Graph

20 Commits

Author SHA1 Message Date
Boshen 2fa936fd2b docs(README.md): map npm package links to npmx.dev (#19666)
## Summary
- replace npm package links from npmjs.com to https://npmx.dev
- only update documentation files

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-24 15:26:21 +08:00
Boshen 8ccd853d91 docs(npm): update package homepage URLs and add keywords (#18509)
## 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)
2026-01-25 07:02:08 +00:00
overlookmotel 1b59f63488 docs(napi/parser): correct typo in README (#18251)
An extraneous `` ` `` had crept in to a comment. Remove it. Also remove unnecessary full stops from short comments.
2026-01-19 15:33:25 +00:00
renovate 5ac8a3e98a chore(deps): update dependency oxfmt to ^0.22.0 (#17679)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [oxfmt](https://oxc.rs) ([source](https://redirect.github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt)) | [`^0.21.0` → `^0.22.0`](https://renovatebot.com/diffs/npm/oxfmt/0.21.0/0.22.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/oxfmt/0.22.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxfmt/0.22.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxfmt/0.21.0/0.22.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxfmt/0.21.0/0.22.0?slim=true) |

---

### Release Notes

<details>
<summary>oxc-project/oxc (oxfmt)</summary>

### [`v0.22.0`](https://redirect.github.com/oxc-project/oxc/blob/HEAD/npm/oxfmt/CHANGELOG.md#0220---2026-01-05)

[Compare Source](https://redirect.github.com/oxc-project/oxc/compare/oxfmt_v0.21.0...oxfmt_v0.22.0)

##### 💥 BREAKING CHANGES

- [`f7da875`](https://redirect.github.com/oxc-project/oxc/commit/f7da875) oxlint: \[**BREAKING**] Remove oxc\_language\_server binary ([#&#8203;17457](https://redirect.github.com/oxc-project/oxc/issues/17457)) (Boshen)

##### 🚀 Features

- [`8fd4ea9`](https://redirect.github.com/oxc-project/oxc/commit/8fd4ea9) oxfmt: `options.embeddedLanguageFormatting` is now `"auto"` by default ([#&#8203;17649](https://redirect.github.com/oxc-project/oxc/issues/17649)) (leaysgur)

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, 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:eyJjcmVhdGVkSW5WZXIiOiI0Mi42OS4xIiwidXBkYXRlZEluVmVyIjoiNDIuNjkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2026-01-06 01:39:42 +00:00
Boshen ea51b0b5c8 feat(napi)!: standardize function naming with sync suffixes (#15661)
closes #15576

## Summary

Standardizes function naming across all NAPI packages (parser, transform, minify) with a consistent pattern:
- Async functions: `verb` (no suffix)
- Sync functions: `verbSync` (with Sync suffix)

## Changes

### Breaking Changes

**napi/parser:**
- `parseAsync` → `parse` (async)
- `parseSync` remains unchanged (sync)

**napi/transform:**
- `transformAsync` → `transform` (async)
- `transform` → `transformSync` (sync)
- `isolatedDeclaration` → `isolatedDeclarationSync` (sync)
- Added new `isolatedDeclaration` function (async)
- `moduleRunnerTransform` → `moduleRunnerTransformSync` (sync)
- Added new `moduleRunnerTransform` function (async)

**napi/minify:**
- `minify` → `minifySync` (sync)
- Added new `minify` function (async)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-11-13 12:28:23 +00:00
overlookmotel 56a385fe94 feat(napi/parser): add AST walker (#13930)
Add an AST visitor to `oxc-parser`.

```js
import { parseSync, Visitor } from 'oxc-parser';

const { program } = parseSync('test.js', 'let x = { y: z };');

const idents = [];
const visitor = new Visitor({
  Identifier(node) {
    idents.push(node.name);
  }
});

visitor.visit(program);

// Logs [ 'x', 'y', 'z' ]
console.log(idents);
```

Primarily we need a visitor for Oxlint plugins, but it's easier to develop and test in `oxc-parser`, so I thought I'd add it there first. Oxlint build process will copy the generated files for tree-walking from `napi/parser` dir, as it does with other files.

Notes:

* The `walk.mjs` file is large, so it's lazy-loaded only when user first constructs a `Visitor`. Adding `Visitor` to the package will not affect start-up time where user only uses `parseSync` etc.
* TS type definition for `Visitor` and the visitor object it takes are provided.
* Visitor supports enter and exit visitors e.g. `Program` and `Program:exit`.
* `src-js/visit/visitor.mjs` is copied from `apps/oxlint` with only minor modifications, and conversion from TS to JS. It'd be better if we only had this impl in one place, but that would require converting `oxc-parser` to TS and building with TSDown, like `oxlint` is. Leaving that for later - #13935.
2025-09-22 11:08:46 +00:00
overlookmotel 4ee94a3308 feat(napi/parser): export visitor keys (#13927)
Add visitor keys export to `oxc-parser` NPM package. This is useful in itself, but also the first step towards an ESTree walker.

Visitor keys are based on `@typescript-eslint/visitor-keys`.

It'd be ideal to generate visitor keys direct from Oxc's own types, but that's proving difficult due to all the custom serializers we use to translate to ESTree. So using the shortcut of borrowing from TS-ESLint for now.

Oxc's AST is slightly different from TS-ESTree (notably Oxc's AST adds `ParenthesizedExpression`). But apart from those few differences, TS-ESLint's AST and Oxc's are identical, and I made a PR to TS-ESLint earlier this year (https://github.com/typescript-eslint/typescript-eslint/pull/11279) to ensure visitor key order is correct, and matches Oxc.

To avoid adding a runtime dependency on `@typescript-eslint/visitor-keys`, extract the data from TS-ESLint in `oxc_ast_tools`, amend for Oxc/TS-ESTree differences, and re-output it as a simple object literal.

This approach will be faster at runtime, as the object's shape is consistent, and also avoids a dependency.
2025-09-22 11:08:46 +00:00
overlookmotel 7a50ad99be docs(napi/parser, napi/transform): correct README examples (#13934)
Docs were out of date. `oxc-parser` and `oxc-transform` packages are now ESM-only, so the code examples would no longer run. Correct them.
2025-09-19 19:58:04 +00:00
overlookmotel 4a408c381c docs(napi/parser): document options (#12008)
Add documentation for `oxc-parser`'s options to README. Includes the new `range` option.
2025-07-01 15:53:23 +00:00
overlookmotel 1df6732b46 feat(ast/estree): add decorators to ESTree AST (#11393)
Close #10921.

Add decorators to ESTree AST. `decorators` field is added to `ClassDeclaration`, `ClassExpression`, `PropertyDefinition`, and `MethodDefinition` - as per [ESTree spec](https://github.com/estree/estree/blob/52399d923111fe2a4dcfe1ede795e08356f35ddc/stage3/decorators.md).

Bump `acorn-test262` dependency to include https://github.com/oxc-project/acorn-test262/pull/42 and https://github.com/oxc-project/acorn-test262/pull/43, which add test fixtures for decorators.
2025-05-31 01:20:06 +00:00
overlookmotel 23182b811a feat(ast/estree): add phase field to ImportExpression in TS-ESTree AST (#11193)
Related to #10978. Add `phase` property to `ImportExpression` in TS-ESTree AST.

This aligns with ESTree spec, but does *not* align with TS-ESLint - TS-ESLint outputs a `CallExpression` with a `MetaProperty` as its `callee` instead.

We don't have the necessary information in our AST to match TS-ESLint, because we don't have the spans of `import`, `defer`, or `import.defer`, to use for the `MetaProperty`, or the `IdentifierName`s it contains.

This is not completely ideal, but I figure it's preferable to represent this syntax *somehow* in the AST, rather than completely ignoring it, in which case there's no way to distinguish between `import("x")`, `import.defer("x")`, and `import.source("x")`.

Presumably TS-ESLint will change their AST shape to conform to ESTree spec once these reach stage 4, so I don't think we should expend effort changing our AST to align with them in the meantime. TypeScript doesn't even have test cases for these (we'd know if they did, as we'd be failing them) - so I doubt these are popular constructs in TS.

`acorn-test262` submodule is bumped to include https://github.com/oxc-project/acorn-test262/pull/36 which adds the `phase` field to `ImportExpression`s in test snapshots.
2025-05-21 01:39:07 +00:00
overlookmotel d47b3057e8 feat(ast/estree): add phase field to ImportExpression in ESTree AST (#11165)
Related to #10978. Add `phase` property to `ImportExpression` in ESTree AST.

This property is *not* added in TS-ESTree, because TS-ESLint supports `import.defer(...)` and `import.source(...)`, but does not align with ESTree - it outputs a `CallExpression` with a `MetaProperty` as its `callee` instead.

We don't have the necessary information in our AST to match TS-ESLint, because we don't have the spans of `import`, `defer`, or `import.defer`, to use for the `MetaProperty`, or the `IdentifierName`s it contains.

Presumably TS-ESLint will change their AST shape to conform to ESTree spec once these reach stage 4, so I don't think we should expend and changing our AST to align with them in the meantime. TypeScript doesn't even have test cases for these (we'd know if they did, as we'd be failing them) - so I doubt these are popular constructs in TS.

`acorn-test262` submodule is bumped to include https://github.com/oxc-project/acorn-test262/pull/31.
2025-05-20 02:55:03 +00:00
overlookmotel 1bc8d29209 feat(ast/estree): add phase field to ImportDeclaration in ESTree AST (#11157)
Fixes #10978. Add `phase` property to `ImportDeclaration` in ESTree and TS-ESTree ASTs.

`ImportExpression` is not covered by this PR. That's more tricky as TS-ESLint already supports `import.defer(...)` and `import.source(...)`, but does not align with ESTree - it outputs a `MetaProperty` instead.

`acorn-test262` submodule is bumped to include https://github.com/oxc-project/acorn-test262/pull/30.
2025-05-19 15:13:31 +00:00
overlookmotel e92bf1f96b docs(napi): update docs for oxc-parser (#11156)
Update docs for `oxc-parser` NPM package to clarify:

1. TS AST now aligns with TS-ESLint.
2. We align with Acorn for plain JS ESTree.
3. We add a non-standard `hashbang` property to `Program`.
2025-05-19 14:15:40 +00:00
Boshen 590a258776 docs(napi/parser): add stackblitz link for wasm build 2025-03-18 18:07:07 +08:00
Boshen a6c9b0949c docs(napi/minifier): improve documentation (#9736) 2025-03-13 06:28:23 +00:00
Boshen c6edafe08d refactor(napi): remove npm/oxc-*/ npm packages (#9631)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-09 22:43:06 +08:00
Boshen 0b8098a442 feat(napi): isolated-declaration (#3718) 2024-06-17 13:06:00 +00:00
Boshen c202bc9dcb feat: Release resolver with NAPI (#1212) 2023-11-10 15:25:17 +00:00
Boshen 90ff0ddbe0 refactor: change @oxidation-compiler/napi to oxc-parser (#1209) 2023-11-10 06:17:05 +00:00