#swc-plugin #graphql #preset #codegen #dev #src #lib

yanked swc-plugin-graphql-codegen-client-preset-optimizer-test

SWC plugin for https://the-guild.dev/graphql/codegen/plugins/presets/preset-client

0.1.0 Dec 21, 2022

#16 in #preset

MIT license

16KB
264 lines

Links

Graphql-Codegen

https://the-guild.dev/graphql/codegen/plugins/presets/preset-client https://github.dev/dotansimha/graphql-code-generator

SWC

https://rustdoc.swc.rs/swc_core/ecma/ast/struct.CallExpr.html

https://swc.rs/docs/plugin/ecmascript/cheatsheet

https://github.dev/kwonoj/swc-plugin-react-native-reanimated/blob/415e364afae6b0ee420bc0b73f8767eb57ee377b/packages/swc-reanimated-worklets-visitor/src/visitors/reanimated_workles_visitor.rs#L587

Examples

https://github.com/Tinkoff/tramvai/blob/99c6a098c637c6e7367a4fb864291d0c546f00e6/packages/swc/plugins/create_token_pure/src/lib.rs https://github.com/swc-project/plugins

module.exports = { ..., "jsc": { "experimental": { "plugins": [ [ require.resolve("./path/to/your-modified-plugin.wasm"), { ..your options } ] ] } }, ... }

https://play.swc.rs/:

//@ts-ignore
import gql from 'gql-tag';

//@ts-ignore
const A = gql(/* GraphQL */ `
  query A {
    a
  }
`);

//@ts-ignore
const B = gql(/* GraphQL */ `
  query B {
    b
  }
`);

//@ts-ignore
const C = gql(/* GraphQL */ `
  fragment C on Query {
    c
  }
`);

Dependencies

~17–27MB
~429K SLoC