{"_id":"@benjibenji/graphql-codegen-client-preset-swc-plugin","name":"@benjibenji/graphql-codegen-client-preset-swc-plugin","dist-tags":{"latest":"0.4.0"},"versions":{"0.4.0":{"name":"@benjibenji/graphql-codegen-client-preset-swc-plugin","version":"0.4.0","description":"A SWC plugin for https://the-guild.dev/graphql/codegen/plugins/presets/preset-client. Forked to work with new Next.js versions and client components.","license":"MIT","bob":false,"keywords":["swc-plugin","graphql-codegen","preset-client"],"main":"swc_plugin.wasm","scripts":{"build-wasm":"cargo build --target wasm32-wasi --release && cp target/wasm32-wasi/release/swc_plugin.wasm ./","debug":"cargo build --target wasm32-wasi && cp target/wasm32-wasi/debug/swc_plugin.wasm ./"},"homepage":"https://the-guild.dev/graphql/codegen/plugins/presets/preset-client","repository":{"type":"git","url":"git+https://github.com/GRA0007/graphql-code-generator.git","directory":"packages/presets/client/swc-plugin"},"bugs":{"url":"https://github.com/dotansimha/graphql-code-generator/issues"},"gitHead":"cec996d1aa8a910d7c927e0b70486f1cec40d5d2","_id":"@benjibenji/graphql-codegen-client-preset-swc-plugin@0.4.0","_nodeVersion":"18.17.0","_npmVersion":"9.6.7","dist":{"integrity":"sha512-BXxRLBci3gcl4xcdCvg6Q2iQ7uJT5hwbEbCbR1/Prs4Lk0mQ4TVTIOT9k6+Vy20j+B6h8EuAJUDynA/YaC+Mgg==","shasum":"a6868c49b06552496e670fe2b3e89b202834b52d","tarball":"https://registry.npmjs.org/@benjibenji/graphql-codegen-client-preset-swc-plugin/-/graphql-codegen-client-preset-swc-plugin-0.4.0.tgz","fileCount":3,"unpackedSize":786733,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFJtDixFoYCWDHr40KSRLXmfl1QjeruQJVa26bUE2LSFAiEA89wscXYwZm3QnHM80XN7IDb0VrhI9ZjX4nzx9WwA/z4="}]},"_npmUser":{"name":"benjibenji","email":"benjamin.grantgra0007@gmail.com"},"directories":{},"maintainers":[{"name":"benjibenji","email":"benjamin.grantgra0007@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-codegen-client-preset-swc-plugin_0.4.0_1712890348261_0.3549678524963158"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-12T02:52:28.112Z","0.4.0":"2024-04-12T02:52:28.433Z","modified":"2024-04-12T02:52:28.740Z"},"maintainers":[{"name":"benjibenji","email":"benjamin.grantgra0007@gmail.com"}],"description":"A SWC plugin for https://the-guild.dev/graphql/codegen/plugins/presets/preset-client. Forked to work with new Next.js versions and client components.","homepage":"https://the-guild.dev/graphql/codegen/plugins/presets/preset-client","keywords":["swc-plugin","graphql-codegen","preset-client"],"repository":{"type":"git","url":"git+https://github.com/GRA0007/graphql-code-generator.git","directory":"packages/presets/client/swc-plugin"},"bugs":{"url":"https://github.com/dotansimha/graphql-code-generator/issues"},"license":"MIT","readme":"> This is an unsupported fork to make the plugin work with new versions of Next.js and \"use client\" directives. Use at your own peril.\n\n# `@benjibenji/graphql-codegen-client-preset-swc-plugin`\n\n> [!NOTE]\n> Updated to use SWC core 0.90.* to support Next.js 14.2.0\n\nWhen using the [`@graphql-codegen/client-preset`](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) on large scale projects might want to enable code splitting or tree shaking on the `client-preset` generated files. This is because instead of using the map which contains all GraphQL operations in the project, we can use the specific generated document types.\n\nThis plugin works for [SWC](https://swc.rs) only.\n\n### Installation\n\n```bash\nyarn add -D @benjibenji/graphql-codegen-client-preset-swc-plugin\n```\n\n### Usage\n\nYou will need to provide the `artifactDirectory` path that should be the same as the one configured in your `codegen.ts`\n\n#### Vite\n\n```ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react-swc'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    react({\n      plugins: [\n        ['@benjibenji/graphql-codegen-client-preset-swc-plugin', { artifactDirectory: './src/gql', gqlTagName: 'graphql' }]\n      ]\n    })\n  ]\n})\n```\n\n#### Next.js\n\n```ts\nconst nextConfig = {\n  // ...\n  experimental: {\n    swcPlugins: [\n      ['@benjibenji/graphql-codegen-client-preset-swc-plugin', { artifactDirectory: './src/gql', gqlTagName: 'graphql' }]\n    ]\n  }\n}\n```\n\n#### `.swcrc`\n\n```json5\n{\n  // ...\n  jsc: {\n    // ...\n    experimental: {\n      plugins: [\n        ['@benjibenji/graphql-codegen-client-preset-swc-plugin', { artifactDirectory: './src/gql', gqlTagName: 'graphql' }]\n      ]\n    }\n  }\n}\n```\n\n### Release\n\nTo publish a new version ensure you have done the following:\n\n- Update the version in `package.json`\n- Update the `CHANGELOG.md` with the new version and changes\n- Commit the changes\n- From GitHub Actions, run the `Rust plugin` workflow\n","readmeFilename":"README.md"}