{"_id":"@brightalley/relay-compiler-language-typescript","_rev":"2-553aa5f13696c6aea875ce5d2a8bcfb3","name":"@brightalley/relay-compiler-language-typescript","dist-tags":{"latest":"15.0.2"},"versions":{"15.0.2":{"name":"@brightalley/relay-compiler-language-typescript","version":"15.0.2","keywords":["graphql","react","relay","typescript"],"license":"MIT","_id":"@brightalley/relay-compiler-language-typescript@15.0.2","maintainers":[{"name":"maartenstaa","email":"maarten@staa.dev"},{"name":"peterkeijsers","email":"p.j.keijsers@gmail.com"}],"contributors":[{"name":"Kaare Hoff Skovgaard","email":"kaare@kaareskovgaard.net"},{"name":"Eloy Durán","email":"eloy.de.enige@gmail.com"}],"homepage":"https://github.com/relay-tools/relay-compiler-language-typescript","bugs":{"url":"https://github.com/relay-tools/relay-compiler-language-typescript/issues"},"dist":{"shasum":"94696924c7966a4d89a2c28d542dbfbf61b77092","tarball":"https://registry.npmjs.org/@brightalley/relay-compiler-language-typescript/-/relay-compiler-language-typescript-15.0.2.tgz","fileCount":20,"integrity":"sha512-Q7/bX6PHyXrpmrVTQyBwJla+ycPMCbo2UD9nCyMZOi2nlQId4d5EuvZdOauXY1HDJhk05WQkRdarJZXAB19qBw==","signatures":[{"sig":"MEQCIDVVCcP/lxz552QmeI1nrZgYIt7yAMWf1vT0A18viPk8AiBIhiT9+vP7IWuz79Yd/6L8mqpsJHMrY9a426D4wXkCKw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":171778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiePkRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqkvA/9GgEgyomOCMZCTwoLRtGVjvVe43tcOFrhWIjTkxJrwAnDusFM\r\nQP0fIR3NQL6kIyM1RlZ285EKAfXdsovvyxKKkR8ehCfRsFWCDFD7xuPXzxN0\r\nFclwZ8TDumoRlpu++jPT/KY2yc1NaP0QOkNzeYImCkTBGnjDUhzoTbUCG4Qu\r\nk1BJ4REogbVdm7rbYCYT+cTIxbMiBtHm+Lm9QUzAjvWUCxGJhZvCBotHPRNw\r\n6pP7yPn6c6qT1Gu1h0oR73gV9YvR213HdttjeN0zE/Z8bs7Yhyxx0Lv/bzqF\r\nO7PqdF9wkhBibua0hdYiBPyYlGZSnoaBLnbx9wSXByJSCJuWQW8ZiE7oiQ2Y\r\nLEYFnR1vkIbaaUeM3kre6bSP02E2zFy1PKw18VeLe9udLjSXMTARkERd5NyG\r\noE1ydrkb/Q1n3Q3xOatw4nwdXB2Xi8xoBShqyVwi3rnG021S058tzvD5tgTk\r\nMTlzLCNsjq+620GmbjdEFVA6Ft+2DM/sueUsIHnNO2IPWRCtusv6rSn3ddR0\r\nANN0c7jNGja6HUHG2m47u2xPA17V2DC/aow1WmHDyr6vgXaBmb2I567Fom9D\r\nb+C5MuoEjHXL8I2Qku2vF5RHBymNqqCgjbPwAouVJsfj/Xiempyd2mKZ4b5w\r\nkcx8tbmvvENNvfDBNq7Z5vuSA1iM2UzdV/U=\r\n=3Z3h\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"testRegex":"test/.+?-test\\.tsx?$","transform":{"^.+\\.tsx?$":"ts-jest"},"moduleFileExtensions":["js","ts","tsx"]},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"tslint -c tslint.json --project tsconfig.json","test":"npm run type-check && jest","build":"rimraf lib && tsc --project tsconfig.build.json","relay":"node bin/relay-compiler.js --schema test/schema.graphql --src test/ --outputDir __generated__","watch":"concurrently 'tsc --watch --project tsconfig.build.json' 'chokidar \"lib/**/*.js\" -c \"yalc publish --force --push\"'","prepare":"husky install","release":"npx auto@v10.30.0 shipit -v","prettier":"prettier --write '{src,types,test}/**/*.ts'","prepublish":"npm run build","type-check":"tsc --noEmit --pretty","sync-fixtures":"ts-node ./syncFixtures.ts"},"_npmUser":{"name":"maartenstaa","email":"maarten@staa.dev"},"prettier":{},"repository":{"url":"https://github.com/relay-tools/relay-compiler-language-typescript.git","type":"git"},"description":"A language plugin for Relay that adds TypeScript support, including emitting type definitions.","directories":{},"licenseText":"Copyright 2018 Kaare Hoff Skovgaard <kaare@kaareskovgaard.net>, Eloy Durán <eloy.de.enige@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","lint-staged":{"**/*.json":["prettier --write","git add"],"{src,types}/**/*.ts":["tslint -c tslint.json --fix","prettier --write","git add"]},"dependencies":{"invariant":"^2.2.4"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^7.1.6","jest":"^27.2.2","husky":"^7.0.0","rimraf":"^3.0.2","tslint":"^6.1.3","graphql":"^15.6.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","jest-cli":"^27.2.2","prettier":"^2.2.1","typescript":"4.6.3","@types/jest":"^27.0.2","@types/node":"17.0.31","lint-staged":"^12.0.2","chokidar-cli":"^3.0.0","concurrently":"^7.0.0","relay-runtime":"^12.0.0","@babel/runtime":"7.17.9","relay-compiler":"^12.0.0","@types/invariant":"2.2.35","babel-plugin-relay":"^12.0.0","@types/relay-runtime":"^12.0.0","@types/relay-compiler":"^8.0.1","tslint-config-prettier":"^1.18.0","relay-test-utils-internal":"^12.0.0"},"peerDependencies":{"typescript":">=4.5.0","relay-runtime":">=12.0.0","relay-compiler":">=12.0.0","@types/react-relay":">=11.0.2","@types/relay-runtime":">=12.0.0"},"_npmOperationalInternal":{"tmp":"tmp/relay-compiler-language-typescript_15.0.2_1652095248890_0.9923658033449441","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-05-09T11:20:48.836Z","modified":"2026-03-26T12:01:03.468Z","15.0.2":"2022-05-09T11:20:49.063Z"},"bugs":{"url":"https://github.com/relay-tools/relay-compiler-language-typescript/issues"},"license":"MIT","homepage":"https://github.com/relay-tools/relay-compiler-language-typescript","keywords":["graphql","react","relay","typescript"],"repository":{"url":"https://github.com/relay-tools/relay-compiler-language-typescript.git","type":"git"},"description":"A language plugin for Relay that adds TypeScript support, including emitting type definitions.","contributors":[{"name":"Kaare Hoff Skovgaard","email":"kaare@kaareskovgaard.net"},{"name":"Eloy Durán","email":"eloy.de.enige@gmail.com"}],"maintainers":[{"email":"p.j.keijsers@gmail.com","name":"peterkeijsers"}],"readme":"# Obsolete\n\nThis repository is obsolete as [relay@13](https://github.com/facebook/relay/releases/tag/v13.0.0) now supports TypeScript directly.\n\n# relay-compiler-language-typescript\n\n[![Build Status](https://travis-ci.org/relay-tools/relay-compiler-language-typescript.svg?branch=master)](https://travis-ci.org/relay-tools/relay-compiler-language-typescript)\n\nA language plugin for [Relay](https://facebook.github.io/relay/) that adds\nTypeScript support, including emitting type definitions.\n\n## Installation\n\nAdd the package to your dev dependencies:\n\n```\nyarn add graphql relay-compiler --dev\nyarn add typescript relay-compiler-language-typescript --dev\n```\n\n**Note:** Starting with version 15.0.0 relay-compiler-language-typescript requires a minimum TypeScript version of 4.5.0 being installed in your project.\n\n## Configuration\n\n### relay-compiler\n\nThen configure your `relay-compiler` script to use it, like so:\n\n```json\n{\n  \"scripts\": {\n    \"relay\":\n      \"relay-compiler --src ./src --schema data/schema.graphql --language typescript --artifactDirectory ./src/__generated__\"\n  }\n}\n```\n\nThis is going to store all artifacts in a single directory, which you also need\nto instruct `babel-plugin-relay` to use in your `.babelrc`:\n\n```json\n{\n  \"plugins\": [[\"relay\", { \"artifactDirectory\": \"./src/__generated__\" }]]\n}\n```\n\n### TypeScript\n\nAlso be sure to configure the TypeScript compiler to transpile to `ES2015`\nmodules (or higher) and leave transpilation to `CommonJS` modules (if required)\nup to Babel with the following `tsconfig.json` settings:\n\n```json5\n{\n  \"compilerOptions\": {\n    \"module\": \"ES2015\", // ES2015 or higher\n    \"target\": \"ES2020\"  // best use the highest target setting compatible with your Babel setup\n  }\n}\n```\n\nThe reason for this is that `tsc` would otherwise generate code where the\nimported `graphql` function is being namespaced (`react_relay_1` in this\nexample):\n\n```js\nreact_relay_1.createFragmentContainer(\n  MyComponent,\n  react_relay_1.graphql`\n  ...\n`\n);\n```\n\n… which makes it impossible for `babel-plugin-relay` to find the locations\nwhere the `graphql` function is being used.\n\n*The generated code uses ES2015 module syntax if `module` is set to ES2015 or\nhigher in your `tsconfig.json`. Note that the `eagerESModules` option from\n`relay-compiler` has no effect on the generated code if `module` is ES2015 or\nhigher.*\n\n#### Custom Headers\n\nIf you need to add a custom header to generated files, perhaps for a custom linter\nor to get boilerplate license code in, that can be passed in also in compilerOptions\nas `banner`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"banner\": \"/* &copy; 2021 Example.org - @generated code */\"\n  }\n}\n```\n\n## Problems\n\n### React Hot Loader\n\nReact Hot Loader is known to not always work well with generated code such as\nour typing artifacts, which will lead to loading modules _with_ TypeScript types\ninto the browser and break. As a maintainer of RHL\n[pointed out](https://github.com/gaearon/react-hot-loader/issues/1032) in a\nsimilar issue:\n\n> The problem - hot reloading is not \"complete\"\n\nSo\n[until RHL will be made “complete”](https://github.com/gaearon/react-hot-loader/issues/1024)\nthis project can’t gurantee to always work well with it, nor is it our control\nto do anything about that.\n\n## Also see\n\n* You can find a copy of the Relay\n  [example TODO app](https://github.com/relay-tools/relay-compiler-language-typescript/tree/master/example)\n  inside this repository or you can take a look at the\n  [Artsy React Native app](https://github.com/artsy/eigen).\n* There are Relay tslint rules available\n  [here](https://github.com/relay-tools/tslint-plugin-relay).\n\n## License\n\nThis package is available under the MIT license. See the included LICENSE file\nfor details.\n","readmeFilename":"README.md"}