mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
oxc_relay
Rust port of the Relay graphql tagged template transform
(babel-plugin-relay /
swc_relay).
Replaces graphql tagged template expressions with references to the artifact
files generated by relay-compiler:
const data = graphql`
query FooQuery {
id
}
`;
becomes (with eager_es_modules: true, the default):
import _FooQuery from "./__generated__/FooQuery.graphql.js";
const data = _FooQuery;
or (with eager_es_modules: false):
const data = require("./__generated__/FooQuery.graphql.js");
This crate backs the oxc-transform-relay
Node.js package in napi/transform-relay.
Limitations
Compared to babel-plugin-relay:
- No development-mode artifact hash validation (
console.erroron stale artifacts) — likeswc_relay, the transform is production-shaped. - No
jsModuleFormat: "haste"and noisDevVariableName. - The definition name is extracted textually (like
swc_relay), not by parsing the GraphQL document, so documents are not validated.