8000 oxc/crates/oxc_relay at main · colinhacks/oxc · GitHub
[go: up one dir, main page]

Skip to content
  • Latest commit

     

    History

    History
     
     

    oxc_relay

    Folders and files

    NameName
    Last commit message
    Last commit date

    parent directory

    ..
     
     
     
     
     
     
     
     
     
     

    README.md

    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.error on stale artifacts) — like swc_relay, the transform is production-shaped.
    • No jsModuleFormat: "haste" and no isDevVariableName.
    • The definition name is extracted textually (like swc_relay), not by parsing the GraphQL document, so documents are not validated.
    0