Files
oxc-project__oxc/.github/labeler.yml
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

85 lines
2.2 KiB
YAML

A-allocator:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_allocator/**"]
A-ast:
- changed-files:
- any-glob-to-any-file:
["crates/oxc_ast/**", "crates/oxc_ast_macros/**", "crates/oxc_ast_visit/**"]
A-ast-tools:
- changed-files:
- any-glob-to-any-file: ["tasks/ast_tools/**"]
A-cfg:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_cfg/**"]
A-cli:
- changed-files:
- any-glob-to-any-file: ["apps/oxlint/**", "apps/oxfmt/**"]
A-editor:
- changed-files:
- any-glob-to-any-file:
["crates/oxc_language_server/**", "apps/oxlint/src/lsp/**", "apps/oxfmt/src/lsp/**"]
A-formatter:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_formatter*/**", "apps/oxfmt/**"]
A-transformer:
- changed-files:
- any-glob-to-any-file:
[
"crates/oxc_transformer*/**",
"crates/oxc_traverse/**",
"tasks/transform_conformance/**",
"napi/transform/**",
"napi/transform-react/**",
"napi/transform-relay/**",
]
A-linter:
- changed-files:
- any-glob-to-any-file:
[
"crates/oxc_linter/**",
"apps/oxlint/**",
"tasks/lint_rules/**",
"tasks/linter_codegen/**",
"tasks/rulegen/**",
"tasks/track_linter_timings/**",
]
A-linter-plugins:
- changed-files:
- all-globs-to-any-file:
["apps/oxlint/src-js/**", "!apps/oxlint/src-js/package/config.generated.ts"]
- any-glob-to-any-file: ["apps/oxlint/test/**", "apps/oxlint/conformance/**"]
A-minifier:
- changed-files:
- any-glob-to-any-file:
["crates/oxc_minifier/**", "crates/oxc_mangler/**", "tasks/minsize/**", "napi/minify/**"]
A-parser:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_parser/**", "napi/parser/**"]
A-codegen:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_codegen/**"]
A-semantic:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_semantic/**"]
A-regular-expression:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_regular_expression/**"]
A-isolated-declarations:
- changed-files:
- any-glob-to-any-file: ["crates/oxc_isolated_declarations/**"]