Commit Graph

34 Commits

Author SHA1 Message Date
Boshen 1c4f519e36 feat(napi): add Relay transform plugin (#25503)
## What

Ports the Relay `graphql` tagged template transform (babel-plugin-relay / swc_relay) as an individual napi transform, per #24914:

- **`crates/oxc_relay`** — the core transform as its own crate (modeled on `oxc_react_compiler`): replaces `graphql` tagged templates with references to relay-compiler artifacts. Definition names are extracted textually like `swc_relay` (equivalent to `\b(fragment|mutation|query|subscription)\s+(\w+)` with `#` comments stripped; hand-rolled scanner, no regex dependency).
- **`napi/transform-relay`** (`oxc-transform-relay`) — standalone napi package copied from the `napi/transform-react` template: parse → semantic → relay traverse → codegen. Only `graphql` tags are rewritten; TypeScript/JSX syntax is preserved untouched, so the output composes with any downstream toolchain.

## Options

| option | default | behavior |
|---|---|---|
| `artifactDirectory` | unset | when set, the import path is computed lexically relative to the transformed file (babel-plugin-relay `getRelativeImportPath` semantics — swc emits absolute paths instead); unset → `./__generated__/` next to the file |
| `language` | `javascript` | `typescript` imports `Name.graphql.ts`, otherwise `Name.graphql.js` |
| `eagerEsModules` | `true` | hoisted default imports (babel-plugin-relay ≥ v17 parity); `false` emits inline `require()` (`@swc/plugin-relay` / Next.js behavior) |

A `graphql` tag with no extractable definition name produces an error diagnostic (babel throws; swc silently skips).

Not supported, documented in both READMEs: dev-mode artifact hash validation, `jsModuleFormat: "haste"`, `isDevVariableName`, swc's Next.js-specific `projects`/`pagesDir`, and GraphQL document validation.

closes #24914

---

Implemented with Claude Code.
2026-08-13 13:56:01 +00:00
camc314 dd3e4160a2 feat(ci): add oxc-codegen npm package publishing (#25546) 2026-08-12 14:06:52 +00:00
Boshen 4a6542bfda chore(react_compiler): configure package publishing (#25389)
Prevents the internal `oxc_react_compiler` and
`oxc_transform_react_napi` Rust crates from being published while
including the `oxc-transform-react` npm package in workspace releases.

Validated with `taplo lint`, Cargo metadata, and `just ready`.

AI assistance was used for this change.
2026-08-08 08:05:28 +00:00
leaysgur 2357a10dfa feat(formatter_yaml): implement YAML formatter (#24534)
Add `oxc_formatter_yaml` crate using `oxc_yaml_parser`.
2026-07-23 05:02:59 +00:00
leaysgur dffa4b329f feat(formatter_css): implement oxc_formatter_css (#23320)
- Implement `oxc_formatter_css` crate
- Use `raffia` crate
  - https://github.com/g-plane/raffia
  - Supports CSS, LESS and SCSS
- Prettier uses `postcss` for parser
  - https://github.com/prettier/prettier/blob/1c6ba5539141552e0e8e22d401ea620d8fdff468/package.json#L100-L105

Since design of `postcss`, this parser is very lenient with syntax.
Because of this, the AST is also less detailed, so formatting processes often rely on text-based.

On the other hand, `raffia` is relatively strict, so it cannot parse some postcss plugin syntax.

While this part clearly creates a difference from Prettier, we have judged that it is not an issue since it still supports major plugins syntax and aligns with current trends.
2026-06-29 03:15:23 +00:00
leaysgur 4e66212c28 feat(formatter_graphql): implement oxc_formatter_graphql (#23317)
- Implement `oxc_formatter_graphql` crate
- Use `apollo-parser` crate from `apollo-rs`
  - https://github.com/apollographql/apollo-rs
  - Which follows Oct2021 spec
- Prettier uses `graphql-js` and implements more and more syntax
  - v16 for `latest = 3.8.4` and v17 for `main = 3.9.x`

NOTE: So at the point of this PR, diffs can be seen as skipped in prettier_conformance.
Will be addressed in later PR by forking `apollo-parser`.
2026-06-29 02:38:28 +00:00
leaysgur 49db054b6a feat(formatter_json): Implement oxc_formatter_json (json variant only) (#22641)
Part of #19704

In Prettier, there are 4 variants for JSON formatting.

- json 👈🏻 this
- jsonc
- json5
- json-stringify

Although Prettier calls "JSON", it doesn't strictly adhere to the JSON specification; in practice, it behaves more like JS...

To begin with, it uses `babel.parseExpression()`, which makes the input parsing very lenient. The output also doesn't necessarily conform to the specification—for instance, it allows comments and sometimes omits double quotes on keys.

Because of this, we are re-implementing it using `oxc_parser`. Since `parse_expression()` cannot capture comments, I've achieved this by wrapping the input in `()`.

Also considered adding JSON support to `oxc_formatter`, but I have decided NOT to for now. We may reconsider this once we have bothered on various edge cases.
2026-05-29 00:49:50 +00:00
leaysgur c323187f37 refactor(formatter): Split oxc_formatter and oxc_formatter_core (#22611)
Split `oxc_formatter` into:

- `oxc_formatter(_js)`: JS/TS specific formatter, comment handling, sortImports, jsdoc, etc
- `oxc_formatter_core`: Language agnostic IR, printer, etc

The naming convention is different from Biome or Ruff (they do not have `_core`, and `_formatter` is equivalent to the core), but this is because in Oxc, items without `_js` are the default.

As a basic task, I have added `Context` as a generic to all relevant parts to ensure support for multiple languages.

There might still be other components that could be refactored into the core, but I would like to finish them as I implement support for other languages.

Also moved some shared utilities to the core in advance.
2026-05-29 00:49:49 +00:00
overlookmotel fe3b32ee71 feat(linter/plugins): add oxlint-plugin-eslint package (#20009)
Closes #19746.

Add `oxlint-plugin-eslint` plugin which exports all ESLint's built-in rules as a JS plugin which can be used with Oxlint.

The code for rules is lazy-loaded on first use, so just using the plugin doesn't load the code for all the rules, only the ones which the user actually uses. However, the `meta` property of each rule is provided eagerly, so that `registerPlugin` in Oxlint can load the plugin without triggering the getters which lazy-load rule code.

All ESLint's rule code is bundled into this plugin package, so the package has no dependencies. This has a few advantages:

1. We control the version of ESLint which the rules are taken from.
2. Avoids "works on my machine" unreproducible bug reports due to differing ESLint versions.
3. Avoids relying on ESLint's `eslint/use-at-your-own-risk` export, which could change without warning.

At present, the plugin contains *all* ESLint's rules, including ones which are natively implemented in Oxlint.

We might choose to scale it back to include only the rules which Oxlint doesn't natively implement. But then we need to consider what happens when we implement more rules in future: Do they disappear from this package without warning? Would that be considered a breaking change? If it would, how long do we keep them in this package?

I propose that in the interests of getting this useful feature released without having to decide all these issues, we just go with it as is for now. JS plugins are not yet stable, so at present we can still make changes later on if we need to, without breaking any promises.
2026-03-09 17:22:40 +00:00
overlookmotel 60d242a9b2 build(oxlint): fix publish workflows to publish @oxlint/plugins package (#19234)
#18824 added a `@oxlint/plugins` NPM package, and #18903 altered the
release workflow. It seems neither worked correctly - the package hasn't
been getting published during the release process.

It's still on version 1.43.0 on NPM:
https://www.npmjs.com/package/@oxlint/plugins

This PR alters the pre-release and release workflows to (hopefully) bump
version of this package and release it alongside `oxlint` package.

There have been no changes to content of `@oxlint/plugins` package since
the last published version, and it has no dependencies, so it doesn't
really matter that we've skipped these releases. But this PR should get
it publishing correctly from next release onwards.
2026-02-11 21:10:13 +08:00
Boshen 4179e4f85a chore(editors): remove VS Code extension (moved to oxc-vscode repo) (#18982)
## Summary

- Removes `editors/vscode` directory - code has been moved to
https://github.com/nicholasrice/oxc-vscode
- Removes `tasks/vscode_docs` crate (no longer needed)
- Removes CI and release workflows for VS Code extension
- Updates `editors/README.md` to point to the new repository
- Cleans up references in `.gitignore`, `justfile`, `oxc_release.toml`,
`oxfmtrc.jsonc`, `oxlintrc.json`, and `pnpm-workspace.yaml`

closes #17484

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 21:14:03 +08:00
Alexander S. 86a58abad2 chore(ci): remove oxc_language_server/Cargo.toml from oxlint release workflow (#18265)
This crate is only consumed by the apps and does not need a version
dump.
2026-01-20 14:08:45 +08:00
Yuji Sugiura 1b61334b10 chore(ci): Add apps/oxfmt/package.json to versioned_files for oxc_release.toml (#15585) 2025-11-11 17:15:42 +08:00
Boshen 302c20c9af chore(oxc_release): add "root_crate" change for the latest update (#14839) 2025-10-21 03:38:24 +00:00
overlookmotel 807dbb3c74 fix(build): bump package version in apps/oxlint in pre-release workflow (#13895)
Package version is used by NAPI-RS in the bindings file it generates.

Adapt the pre-release workflow to run NAPI-RS build when creating a release PR, so that the version number in bindings files matches the new version number.

This change covers all NAPI packages in `crates` pre-release workflow, and also `oxlint` in its pre-release workflow.
2025-09-20 08:49:59 +00:00
Boshen 4b0be04f67 ci: bump npm/oxfmt/package.json on release 2025-09-12 23:29:58 +08:00
Boshen c1ccd96cc9 ci(release): setup release for oxfmt (#13653) 2025-09-10 18:36:40 +08:00
Boshen c8979d9bff chore(wasm/parser): remove parser wasm32-unknown-unknown build (#9865)
In favor of napi wasm32-wasip1-threads build
2025-03-18 10:33:50 +00:00
Boshen ceb6003afa fix(oxc_release): fix incorrect files 2025-03-11 11:53:45 +08: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
Rintaro Itokawa 20c347c9ff chore(oxc_release.toml): add crates/oxc_language_server/Cargo.toml (#8703)
close #8603 

Add `crates/oxc_language_server/Cargo.toml` to release LS with linter's
release
2025-02-18 17:09:12 +08:00
Boshen 951b2d53d3 feat(npm/runtime): add @oxc-project/runtime package (#8595)
closes #7422
2025-02-06 23:06:56 +08:00
Boshen 2f0314eec2 feat(npm/oxc-minify): npm package and publish script (#8579) 2025-01-18 12:12:42 +08:00
Boshen fcc6221aa9 chore(oxc_release.toml): add npm/oxc-types/package.json 2024-10-25 11:22:29 +08:00
Boshen 2bc36ccbb6 chore: add scopes_for_breaking_change to oxc_release.toml 2024-08-29 11:02:48 +08:00
Boshen 1852ea4fd2 chore: clean up unused deps 2024-06-30 19:04:44 +08:00
Boshen 5d6490e95d chore: add crate oxc_transform_napi to release 2024-06-30 18:53:17 +08:00
Boshen 9f2e09eade chore: make npm/oxc-transform part of the crates release 2024-06-26 23:13:23 +08:00
Boshen 49fab9d6be Release npm/oxc-transform v0.15.1 2024-06-20 23:41:31 +08:00
Boshen e592883bc1 chore: add oxc-transform to oxc_release.toml 2024-06-19 00:46:45 +08:00
Boshen 053f19dd19 chore: format toml files 2024-06-08 11:48:14 +08:00
Boshen 0674604d7a chore: regenerate changelog 2024-06-06 01:29:38 +08:00
Boshen 9a0d1ad165 chore: format top level toml files 2024-06-04 16:05:08 +08:00
Boshen ebd683bb4b chore: add oxc_release.toml 2024-06-04 16:05:08 +08:00