[
  {
    "path": ".eslintignore",
    "content": "node_modules/\n__fixtures__/\n__fixtures_build__/\ncoverage/\nexamples/\nsvgr.now.sh/\n/website/\ndist/"
  },
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"root\": true,\n  \"env\": {\n    \"node\": true\n  },\n  \"parser\": \"@typescript-eslint/parser\",\n  \"plugins\": [\"@typescript-eslint\"],\n  \"extends\": [\n    \"eslint:recommended\",\n    \"plugin:@typescript-eslint/recommended\",\n    \"plugin:react-hooks/recommended\",\n    \"plugin:react/recommended\"\n  ],\n  \"rules\": {\n    \"@typescript-eslint/ban-ts-comment\": \"off\",\n    \"@typescript-eslint/no-explicit-any\": \"off\",\n    \"@typescript-eslint/no-empty-function\": \"warn\",\n    \"@typescript-eslint/ban-types\": \"warn\",\n    \"react/prop-types\": \"off\"\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"detect\"\n    }\n  }\n}\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: gregberge\nopen_collective: svgr\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.md",
    "content": "---\nname: 🐛 Bug report\nabout: Create a report to help us improve\n---\n\n<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->\n\n## 🐛 Bug Report\n\nA clear and concise description of what the bug is.\n\n## To Reproduce\n\nSteps to reproduce the behavior:\n\n## Expected behavior\n\nA clear and concise description of what you expected to happen.\n\n## Link to repl or repo (highly encouraged)\n\nPlease provide a minimal repository on GitHub.\n\nIssues without a reproduction link are likely to stall.\n\n## Run `npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard`\n\nPaste the results here:\n\n```bash\n\n```\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature.md",
    "content": "---\nname: 🚀 Feature Proposal\nabout: Submit a proposal for a new feature\n---\n\n<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->\n\n## 🚀 Feature Proposal\n\nA clear and concise description of what the feature is.\n\n## Motivation\n\nPlease outline the motivation for the proposal.\n\n## Example\n\nPlease provide an example for how this feature would be used.\n\n## Pitch\n\nWhy does this feature belong in the SVGR ecosystem?\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/question.md",
    "content": "---\nname: 💬 Questions / Help\nabout: If you have questions, please read full readme first\n---\n\n<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->\n\n## 💬 Questions and Help\n\nSVGR project is young, but please before asking your question:\n\n- Read carefully the README of the project\n- Search if your answer has already been answered in old issues\n\nAfter you can submit your question and we will be happy to help you!\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/regression.md",
    "content": "---\nname: 💥 Regression Report\nabout: Report unexpected behavior that worked in previous versions\n---\n\n<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->\n\n## 💥 Regression Report\n\nA clear and concise description of what the regression is.\n\n## Last working version\n\nWorked up to version:\n\nStopped working in version:\n\n## To Reproduce\n\nSteps to reproduce the behavior:\n\n## Expected behavior\n\nA clear and concise description of what you expected to happen.\n\n## Link to repl or repo (highly encouraged)\n\nPlease provide a minimal repository on GitHub.\n\nIssues without a reproduction link are likely to stall.\n\n## Run `npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard`\n\nPaste the results here:\n\n```bash\n\n```\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "## 👉 [Please follow one of these issue templates](https://github.com/gregberge/svgr/issues/new/choose) 👈\n\n<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->\n\nNote: to keep the backlog clean and actionable, issues may be immediately closed if they do not follow one of the above issue templates.\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->\n\n## Summary\n\n<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->\n\n## Test plan\n\n<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->\n"
  },
  {
    "path": ".github/SUPPORT.md",
    "content": "Please read carefully the README before asking questions.\n\n<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->\n"
  },
  {
    "path": ".github/opencollective.yml",
    "content": "collective: svgr\ntiers:\n  - tiers: '*'\n    labels: ['backer']\n    message: |\n      Hey <author> :wave:,\n      Thank you so much for supporting us on [Open Collective](<link>) :heart:.\n      We'll give a special attention to this issue.\n      <link>\ninvitation: |\n  Hey <author> :wave:,\n  Thank you for opening an issue. We'll get back to you as soon as we can.\n  Please, consider supporting us on [Open Collective](<link>). We give a special attention to issues opened by backers.\n  If you use SVGR at work, you can also ask your company to sponsor us :heart:.\n  <link>\n"
  },
  {
    "path": ".github/stale.yml",
    "content": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 60\n# Number of days of inactivity before a stale issue is closed\ndaysUntilClose: 7\n# Label to use when marking an issue as stale\nstaleLabel: wontfix\n# Comment to post when marking an issue as stale. Set to `false` to disable\nmarkComment: >\n  This issue has been automatically marked as stale because it has not had\n  recent activity. It will be closed if no further activity occurs. Thank you\n  for your contributions.\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\npermissions:\n  contents: read #  to fetch code (actions/checkout)\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        node-version: [14.x, 16.x, 18.x, 19.x]\n        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/\n\n    steps:\n      - name: Check out repository code\n        uses: actions/checkout@v3\n\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v3\n\n      - name: Use latest pnpm\n        run: npm i -g pnpm@latest --registry=https://registry.npmjs.org\n\n      - name: Install dependencies\n        run: pnpm install\n\n      - name: Build\n        run: pnpm run build\n\n      - name: Lint\n        run: pnpm run lint\n\n      - name: Test\n        run: pnpm run test --ci --coverage\n\n      - name: Codecov\n        run: npx codecov\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules/\nlib/\ndist/\n!svgr.now.sh/lib/\n__fixtures_build__/\nsrc/__fixtures__/dist/\ncoverage/\n"
  },
  {
    "path": ".nvmrc",
    "content": "18"
  },
  {
    "path": ".prettierignore",
    "content": "__fixtures_build__/\n__fixtures__/\nCHANGELOG.md\npackage.json\nlerna.json\ndist/\n.next/\n/website/.cache/\n/website/public/\npnpm-workspace.yaml\npnpm-lock.yaml"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"singleQuote\": true,\n  \"trailingComma\": \"all\",\n  \"semi\": false\n}\n"
  },
  {
    "path": "BACKERS.md",
    "content": "# Sponsors & Backers\n\n<p class=\"description\">Support SVGR’s development through donations.</p>\n\nSVGR is an MIT-licensed open source project. Even if it has been created at Smooth Code, SVGR is an independent project with ongoing development made possible thanks to the support of these awesome backers. If you'd like to join them, please consider:\n\n- [Become a backer or sponsor on OpenCollective](https://opencollective.com/svgr).\n\n## Gold Sponsors\n\nGold Sponsors are those who have pledged \\$100/month and more to SVGR.\n\n[![gold-sponsors](https://opencollective.com/svgr/tiers/gold-sponsors.svg?avatarHeight=120&width=600)](https://opencollective.com/svgr/order/6010)\n\n## Silver Sponsors\n\nSilver Sponsors are those who have pledged $50/month to$100/month to SVGR.\n\n[![silver-sponsors](https://opencollective.com/svgr/tiers/silver-sponsors.svg?avatarHeight=120&width=600)](https://opencollective.com/svgr/order/6008)\n\n## Bronze Sponsors\n\nBronze Sponsors are those who have pledged $50/month to$100/month to SVGR.\n\n[![bronze-sponsors](https://opencollective.com/svgr/tiers/bronze-sponsors.svg?avatarHeight=80&width=600)](https://opencollective.com/svgr/order/6009)\n\n## Backers\n\n[![backers](https://opencollective.com/svgr/tiers/backer.svg?avatarHeight=50&width=600)](https://opencollective.com/svgr/order/6007)\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n\n### Bug Fixes\n\n* **cli:** fix default dimensions, prettier & svgo ([571d5c8](https://github.com/gregberge/svgr/commit/571d5c8bd18bc13c12eeb27a9052fa065aeb012e))\n* **config:** prefer cli config over rc config ([#845](https://github.com/gregberge/svgr/issues/845)) ([8b97248](https://github.com/gregberge/svgr/commit/8b972484266c45c7f8e4acce4fe2930a024fb4bc))\n* **react-native:** fix duplicate import ([#894](https://github.com/gregberge/svgr/issues/894)) ([e612b6a](https://github.com/gregberge/svgr/commit/e612b6a1a4e822178f1e15b82bd2991bf1e84cec))\n\n\n### Features\n\n* **esm:** add support for svgo.config.cjs ([#879](https://github.com/gregberge/svgr/issues/879)) ([ae91e2e](https://github.com/gregberge/svgr/commit/ae91e2eacbe1156480c96219b993000eb1e7b9bf))\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n\n### Bug Fixes\n\n* fix peer dependencies ([2e05255](https://github.com/gregberge/svgr/commit/2e0525546eb21aa4bb790aa4284f4fe34f96d6b9))\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n\n### Bug Fixes\n\n* parseObject error causes website broken ([05f2946](https://github.com/gregberge/svgr/commit/05f2946d90b194eac17d51ca0562d13e9ed0c995))\n\n\n### Features\n\n* add snake_case filename option ([#857](https://github.com/gregberge/svgr/issues/857)) ([428b0c7](https://github.com/gregberge/svgr/commit/428b0c7f4c5205bb67ae3e9e7c7e819ec3fc03ba))\n* make index template more flexible ([#861](https://github.com/gregberge/svgr/issues/861)) ([003009c](https://github.com/gregberge/svgr/commit/003009c7b234cfe66686b629d3251edb8d46c759))\n* **types:** change `SVGProps` from import to import type ([#853](https://github.com/gregberge/svgr/issues/853)) ([095f021](https://github.com/gregberge/svgr/commit/095f0216288ccb5b96a75f154fe3aead074bfa99))\n\n\n### BREAKING CHANGES\n\n* index template now receives an array of objects containing both the created\ncomponent path (`path`) and the original SVG path (`originalPath`)\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* allow specifying `jsxRuntimeImport` in config ([86bb86f](https://github.com/gregberge/svgr/commit/86bb86f47748618f729742e56199355d9c0bc518)), closes [#801](https://github.com/gregberge/svgr/issues/801) [#801](https://github.com/gregberge/svgr/issues/801)\n* remove @svgr/plugin-jsx from core ([a0f078d](https://github.com/gregberge/svgr/commit/a0f078db13936800a32c14ade08b670a14b5a886))\n* upgrade to svgo v3 ([#798](https://github.com/gregberge/svgr/issues/798)) ([21b6209](https://github.com/gregberge/svgr/commit/21b6209ef34c51cc0313901f31061afe587ab29b))\n\n\n### BREAKING CHANGES\n\n* plugin-jsx is no longer included by default in core\n* svgr now requires Node.js v14+\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n### Bug Fixes\n\n- fix Yarn peer dependency warning from @babel/core ([#786](https://github.com/gregberge/svgr/issues/786)) ([db35837](https://github.com/gregberge/svgr/commit/db3583751474997dd72a0209ca61daddbac16c46)), closes [#785](https://github.com/gregberge/svgr/issues/785)\n\n### Features\n\n- **babel-preset:** fix 'role' attribute on svg element for react native ([#787](https://github.com/gregberge/svgr/issues/787)) ([35d85e0](https://github.com/gregberge/svgr/commit/35d85e069ebfef1b26ba181f443d9377a7bc003e))\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Bug Fixes\n\n- **deps:** add babel-preset to core dependencies ([#782](https://github.com/gregberge/svgr/issues/782)) ([464ec5f](https://github.com/gregberge/svgr/commit/464ec5fe81c6ba98be5a26923f3ad19fc2ef7fc6))\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n- support spaces in file names ([#779](https://github.com/gregberge/svgr/issues/779)) ([6ee639a](https://github.com/gregberge/svgr/commit/6ee639a039a0001d3b97fef024f2bd0c3e107182))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix duplicate plugin/preset detected error ([#747](https://github.com/gregberge/svgr/issues/747)) ([3c6a54c](https://github.com/gregberge/svgr/commit/3c6a54c494bb8ff15f332ff2d44e9f6465a6c19a)), closes [#746](https://github.com/gregberge/svgr/issues/746)\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **core:** types field in package.json ([#693](https://github.com/gregberge/svgr/issues/693)) ([a491ace](https://github.com/gregberge/svgr/commit/a491acee1b3fbe1cae304dbc399193cdb2148e1d))\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n- **cli:** output file name when error happen to handling a file ([#702](https://github.com/gregberge/svgr/issues/702)) ([0ec1fbd](https://github.com/gregberge/svgr/commit/0ec1fbd0bf1e020ecd8f53fba38d7e53d2462b27))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n### Bug Fixes\n\n- do not transform mask-type ([#673](https://github.com/gregberge/svgr/issues/673)) ([6e58f2c](https://github.com/gregberge/svgr/commit/6e58f2cb456bf5fbfa011ab8f8154333c0724e34)), closes [#643](https://github.com/gregberge/svgr/issues/643)\n- use .ts extension for generated index ([#670](https://github.com/gregberge/svgr/issues/670)) ([d19abe2](https://github.com/gregberge/svgr/commit/d19abe207013f4e880a78f236e9f75b0151258da)), closes [#462](https://github.com/gregberge/svgr/issues/462)\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n### Bug Fixes\n\n- **cli:** pass in parser to prettier format to avoid deprecation warning ([#662](https://github.com/gregberge/svgr/issues/662)) ([74fa3ae](https://github.com/gregberge/svgr/commit/74fa3aed2944b63797a6e0e786acd1b51f86550a))\n- **plugin-svgo:** handle potential errors from optimize ([#663](https://github.com/gregberge/svgr/issues/663)) ([7582d31](https://github.com/gregberge/svgr/commit/7582d3130e5b6eb0f962e283f956a84552f839a6))\n\n### Features\n\n- support comments in templates ([#661](https://github.com/gregberge/svgr/issues/661)) ([9afb590](https://github.com/gregberge/svgr/commit/9afb590d1094793fca797449fb7017da9fa06b4e))\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n### Bug Fixes\n\n- **rollup:** missing dep & missing map return ([#652](https://github.com/gregberge/svgr/issues/652)) ([12627fc](https://github.com/gregberge/svgr/commit/12627fcd91a425361e1fbe825a6668ce9a8b4f3b))\n- specify valid peer deps ([45a76ed](https://github.com/gregberge/svgr/commit/45a76ed5f7d433e549c8513c0fdab08eb6c7bc2c))\n\n## [6.1.1](https://github.com/gregberge/svgr/compare/v6.1.0...v6.1.1) (2021-12-04)\n\n### Bug Fixes\n\n- **webpack:** fix double export ([#648](https://github.com/gregberge/svgr/issues/648)) ([7595d37](https://github.com/gregberge/svgr/commit/7595d378b73d4826a4cead165b3f32386b07315b)), closes [#645](https://github.com/gregberge/svgr/issues/645)\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n### BREAKING CHANGES\n\n- svgr v6 is now only compatible with **Webpack v5** and up. See the [migration guide](https://react-svgr.com/docs/migrate/#webpack)\n\n### Bug Fixes\n\n- fix previous export system ([1872829](https://github.com/gregberge/svgr/commit/187282977af841cd5a2243a23abba72b20eec2fa)), closes [#635](https://github.com/gregberge/svgr/issues/635)\n\n### Features\n\n- **native:** automatically convert inline style in native ([138c493](https://github.com/gregberge/svgr/commit/138c493b2ae0c5c1cef488cf9ff7f94827dc2aa5)), closes [#588](https://github.com/gregberge/svgr/issues/588)\n\n### Performance Improvements\n\n- remove useless loader-utils package ([387bc72](https://github.com/gregberge/svgr/commit/387bc727a4e07c2668544e3f5afbefe29a3de909)), closes [#631](https://github.com/gregberge/svgr/issues/631)\n\n# [5.5.0](https://github.com/gregberge/svgr/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- **typescript:** fix react-native support [#465](https://github.com/gregberge/svgr/issues/465) ([#488](https://github.com/gregberge/svgr/issues/488)) ([d61e0cf](https://github.com/gregberge/svgr/commit/d61e0cface065afc1478fdb44d87ca8177041eab))\n- ensure a valid name for exports ([#489](https://github.com/gregberge/svgr/issues/489)) ([0eb8085](https://github.com/gregberge/svgr/commit/0eb80853e53a55226881f6ae3b50c1afe89f1cfc))\n- fix playground ([c7ad69f](https://github.com/gregberge/svgr/commit/c7ad69fff347afdca3410e4fb1da235be01b1ac8))\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n### Features\n\n- allow custom name for named export ([#493](https://github.com/gregberge/svgr/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/commit/16a58d6e817c065f72a68be91600a1a360205f44))\n- **svgo:** add .svgorc.js config file support ([#451](https://github.com/gregberge/svgr/issues/451)) ([8049b1a](https://github.com/gregberge/svgr/commit/8049b1a63603672096892b6ab3d303580c2f303f)), closes [#412](https://github.com/gregberge/svgr/issues/412)\n\n### Performance Improvements\n\n- **cli:** use fs.promises ([#459](https://github.com/gregberge/svgr/issues/459)) ([af294ac](https://github.com/gregberge/svgr/commit/af294ac3b86e7c39e78fc8b348110baf8c690949))\n- replace merge-deep with smaller deepmerge ([#463](https://github.com/gregberge/svgr/issues/463)) ([1f015eb](https://github.com/gregberge/svgr/commit/1f015eb16fca093a08b012236dc83623f7bcce55))\n\n# [5.4.0](https://github.com/gregberge/svgr/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n### Bug Fixes\n\n- wrap svg component directly with memo/forwardRef ([#440](https://github.com/gregberge/svgr/issues/440)) ([#441](https://github.com/gregberge/svgr/issues/441)) ([a6de2da](https://github.com/gregberge/svgr/commit/a6de2dacb63e36572a2167b928418bdc39f3a9c2))\n- **cli:** fix index generation ([#443](https://github.com/gregberge/svgr/issues/443)) ([7c46ad7](https://github.com/gregberge/svgr/commit/7c46ad73695c42e6153761c931377d65b71835ea)), closes [#433](https://github.com/gregberge/svgr/issues/433)\n\n### Features\n\n- add `ForeignObject` support for react native ([#430](https://github.com/gregberge/svgr/issues/430)) ([1b56b85](https://github.com/gregberge/svgr/commit/1b56b851478803d40105ce63c70e457bd3183da6))\n- **cli:** make all CLI options available in config ([a23a186](https://github.com/gregberge/svgr/commit/a23a18675c0dd4a461d2fcbdc72a305cabd32a13)), closes [#431](https://github.com/gregberge/svgr/issues/431) [#437](https://github.com/gregberge/svgr/issues/437)\n\n## [5.3.1](https://github.com/gregberge/svgr/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n### Bug Fixes\n\n- fix typescript types (ref, title) ([#419](https://github.com/gregberge/svgr/issues/419)) ([6e7e6b2](https://github.com/gregberge/svgr/commit/6e7e6b2e73d26d30f64604e0fc627f9ff94079c2))\n\n# [5.3.0](https://github.com/gregberge/svgr/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n### Bug Fixes\n\n- **cli:** remove confusion between {keep,ignore}-existing ([#413](https://github.com/gregberge/svgr/issues/413)) ([c5430f9](https://github.com/gregberge/svgr/commit/c5430f97b053a7d2d85c85c56b87dfc8c9c1f09a)), closes [#390](https://github.com/gregberge/svgr/issues/390)\n- **parcel-plugin:** support \"parcel\" and \"parcel-bundler\" ([853db4e](https://github.com/gregberge/svgr/commit/853db4ef0e9da4952e8189e3f86fb62e6c506693)), closes [#410](https://github.com/gregberge/svgr/issues/410)\n- **svgo:** support any SVGO config format ([#412](https://github.com/gregberge/svgr/issues/412)) ([f2b2367](https://github.com/gregberge/svgr/commit/f2b2367389fda20baba6e0a5e884e7f7fe29a3ed)), closes [#400](https://github.com/gregberge/svgr/issues/400)\n\n### Features\n\n- add typescript option ([4596d7b](https://github.com/gregberge/svgr/commit/4596d7bb470babb5ec4b87f5281174fb182bd9c7)), closes [#373](https://github.com/gregberge/svgr/issues/373)\n\n# [5.2.0](https://github.com/smooth-code/svgr/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n### Bug Fixes\n\n- verify that `svgoConfig.plugins` is an array ([#397](https://github.com/smooth-code/svgr/issues/397)) ([88110b6](https://github.com/smooth-code/svgr/commit/88110b6eb4d93ded68ca2de05cc82654dfac977d))\n\n### Features\n\n- **parcel-plugin:** replace `parcel-bundler` with `parcel` ([#387](https://github.com/smooth-code/svgr/issues/387)) ([d09bcd5](https://github.com/smooth-code/svgr/commit/d09bcd5d7ba21c8845c6042928bbdf14165e787b))\n\n# [5.1.0](https://github.com/smooth-code/svgr/compare/v5.0.1...v5.1.0) (2020-01-20)\n\n### Bug Fixes\n\n- fix merging svgo plugins in config ([#384](https://github.com/smooth-code/svgr/issues/384)) ([c9d2dfc](https://github.com/smooth-code/svgr/commit/c9d2dfcb8d4da55eb21a13507c87d9e549a86e7e))\n\n### Features\n\n- add Svg prefix to exports that starts with a number ([#383](https://github.com/smooth-code/svgr/issues/383)) ([fd120d1](https://github.com/smooth-code/svgr/commit/fd120d11c81395353f300da487295b769f6b9501)), closes [#379](https://github.com/smooth-code/svgr/issues/379)\n- allow to provide custom index.js template ([#378](https://github.com/smooth-code/svgr/issues/378)) ([f734dda](https://github.com/smooth-code/svgr/commit/f734ddac8e639ad213a3ce09689e46226fd5c1e0))\n\n## [5.0.1](https://github.com/smooth-code/svgr/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/smooth-code/svgr/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n### Bug Fixes\n\n- **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/issues/333)\n- invalid characters in component name ([#332](https://github.com/gregberge/svgr/issues/332)) ([4b4bd2c](https://github.com/gregberge/svgr/commit/4b4bd2c)), closes [#331](https://github.com/gregberge/svgr/issues/331)\n\n## [4.3.2](https://github.com/gregberge/svgr/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n### Performance Improvements\n\n- replace rehype with svg-parser ([#321](https://github.com/gregberge/svgr/issues/321)) ([7eb5ef6](https://github.com/gregberge/svgr/commit/7eb5ef6))\n\n## [4.3.1](https://github.com/gregberge/svgr/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n### Bug Fixes\n\n- **titleProp:** handle the existing title case by using element instead of value (children) ([#315](https://github.com/gregberge/svgr/issues/315)) ([065e7a9](https://github.com/gregberge/svgr/commit/065e7a9))\n\n# [4.3.0](https://github.com/gregberge/svgr/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n### Features\n\n- **cli:** output relative destination paths ([#312](https://github.com/gregberge/svgr/issues/312)) ([b78e471](https://github.com/gregberge/svgr/commit/b78e471))\n- titleProps fallbacks to svg's title ([#311](https://github.com/gregberge/svgr/issues/311)) ([8f92366](https://github.com/gregberge/svgr/commit/8f92366))\n\n# [4.2.0](https://github.com/gregberge/svgr/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- keep viewBox when dimensions are removed ([#281](https://github.com/gregberge/svgr/issues/281)) ([f476c8e](https://github.com/gregberge/svgr/commit/f476c8e))\n- **babel-preset:** expandProps + icon option ([ddfae22](https://github.com/gregberge/svgr/commit/ddfae22)), closes [#277](https://github.com/gregberge/svgr/issues/277)\n- **cli:** fix kebab case transformation with \"\\_\" ([39c24c5](https://github.com/gregberge/svgr/commit/39c24c5)), closes [#280](https://github.com/gregberge/svgr/issues/280)\n- **hast-util-to-babel-ast:** correctly handle aria attributes ([23d12aa](https://github.com/gregberge/svgr/commit/23d12aa)), closes [#279](https://github.com/gregberge/svgr/issues/279)\n- **plugin-prettier:** fix prettier warning ([d01d33f](https://github.com/gregberge/svgr/commit/d01d33f))\n\n### Features\n\n- add expo option ([#289](https://github.com/gregberge/svgr/issues/289)) ([978db3e](https://github.com/gregberge/svgr/commit/978db3e))\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n### Features\n\n- add parcel plugin ([#235](https://github.com/gregberge/svgr/issues/235)) ([144dbe3](https://github.com/gregberge/svgr/commit/144dbe3)), closes [#215](https://github.com/gregberge/svgr/issues/215)\n\n## [4.0.4](https://github.com/gregberge/svgr/compare/v4.0.3...v4.0.4) (2018-11-24)\n\n### Bug Fixes\n\n- **webpack:** use static babel config ([#240](https://github.com/gregberge/svgr/issues/240)) ([d67af31](https://github.com/gregberge/svgr/commit/d67af31)), closes [#232](https://github.com/gregberge/svgr/issues/232)\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- **babel-plugin:** fix usage of spread attribute([#231](https://github.com/gregberge/svgr/issues/231)) ([4186953](https://github.com/gregberge/svgr/commit/4186953))\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n### Bug Fixes\n\n- **hast-util-to-babel-ast:** replace tabs by spaces in attributes ([b0f3d19](https://github.com/gregberge/svgr/commit/b0f3d19)), closes [#219](https://github.com/gregberge/svgr/issues/219)\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n### Bug Fixes\n\n- **babel-plugin-transform-svg:** support template that only return a single node ([80ac40f](https://github.com/gregberge/svgr/commit/80ac40f)), closes [#223](https://github.com/gregberge/svgr/issues/223)\n- **babel-plugin-transform-svg-component:** parsing error of JSX template exports defs ([#225](https://github.com/gregberge/svgr/issues/225)) ([1e56309](https://github.com/gregberge/svgr/commit/1e56309)), closes [/github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js#L61](https://github.com//github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js/issues/L61)\n- **hast-util-to-babel-ast:** correctly transforms data & aria attributes ([99711c4](https://github.com/gregberge/svgr/commit/99711c4)), closes [#221](https://github.com/gregberge/svgr/issues/221)\n- **hast-util-to-babel-ast:** replace line-breaks in attributes ([00a2625](https://github.com/gregberge/svgr/commit/00a2625)), closes [#219](https://github.com/gregberge/svgr/issues/219)\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Bug Fixes\n\n- prevent babel read babel.config.js ([#206](https://github.com/gregberge/svgr/issues/206)) ([514d43d](https://github.com/gregberge/svgr/commit/514d43d))\n- **cli:** fix --out-dir usage with absolute path ([#208](https://github.com/gregberge/svgr/issues/208)) ([c922e2e](https://github.com/gregberge/svgr/commit/c922e2e))\n\n### Features\n\n- **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n- allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n\n# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)\n\n### Bug Fixes\n\n- style & custom SVG properties ([#203](https://github.com/gregberge/svgr/issues/203)) ([f8b2212](https://github.com/gregberge/svgr/commit/f8b2212)), closes [#199](https://github.com/gregberge/svgr/issues/199) [#201](https://github.com/gregberge/svgr/issues/201)\n\n### Features\n\n- allow Mask & Image on React Native ([#202](https://github.com/gregberge/svgr/issues/202)) ([0256bc0](https://github.com/gregberge/svgr/commit/0256bc0))\n\n<a name=\"3.0.0\"></a>\n\n# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)\n\n### Bug Fixes\n\n- **rollup:** forward filePath in rollup plugin ([461492b](https://github.com/gregberge/svgr/commit/461492b)), closes [#177](https://github.com/gregberge/svgr/issues/177) [#188](https://github.com/gregberge/svgr/issues/188)\n- **webpack:** forward filePath in webpack loader ([b7a108e](https://github.com/gregberge/svgr/commit/b7a108e)), closes [#177](https://github.com/gregberge/svgr/issues/177) [#188](https://github.com/gregberge/svgr/issues/188)\n- fix --icon + --no-dimensions ([7535693](https://github.com/gregberge/svgr/commit/7535693)), closes [#141](https://github.com/gregberge/svgr/issues/141)\n- fix expandProps when position is not allowed ([45522fc](https://github.com/gregberge/svgr/commit/45522fc))\n\n### Features\n\n- **config:** improve runtime config ([e52cdce](https://github.com/gregberge/svgr/commit/e52cdce)), closes [#192](https://github.com/gregberge/svgr/issues/192)\n- **template:** expose `getProps` util for template ([5cb238e](https://github.com/gregberge/svgr/commit/5cb238e)), closes [#187](https://github.com/gregberge/svgr/issues/187)\n- add synchronous API ([169eb2f](https://github.com/gregberge/svgr/commit/169eb2f)), closes [#185](https://github.com/gregberge/svgr/issues/185)\n- always prefix component name with \"Svg\" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)\n- do not remove style tag ([a4ce09a](https://github.com/gregberge/svgr/commit/a4ce09a)), closes [#191](https://github.com/gregberge/svgr/issues/191)\n- new \"expandProps\" option ([bb95828](https://github.com/gregberge/svgr/commit/bb95828)), closes [#170](https://github.com/gregberge/svgr/issues/170)\n- remove \"svgAttributes\" option ([4e46a5d](https://github.com/gregberge/svgr/commit/4e46a5d)), closes [#173](https://github.com/gregberge/svgr/issues/173)\n- use forwardRef on React Native ([4bdd989](https://github.com/gregberge/svgr/commit/4bdd989)), closes [#184](https://github.com/gregberge/svgr/issues/184)\n- use React.forwardRef ([cbee51c](https://github.com/gregberge/svgr/commit/cbee51c)), closes [#184](https://github.com/gregberge/svgr/issues/184)\n\n### BREAKING CHANGES\n\n- \"--no-expand-props\" is now replaced by \"--expand-props none\". You can now specify a position \"start\" or \"end\" for \"expandProps\"\n  property.\n- `svgAttributes` has been removed, please use `svgProps` instead.\n- \"ref\" option now uses `React.forwardRef`. You don't have to use \"svgRef\"\n  prop, just use \"ref\" and it will work. `React.forwardRef` requires React\n  > 16.3.\n- Style tag will no longer be automatically removed. SVGO should handle it\n  correctly using \"inlineStyles\" plugin. If you want to remove them,\n  enable \"removeStyleElement\" plugin in your SVGO config.\n- **rollup:** runtime configuration is now loaded using rollup plugin.\n- **webpack:** runtime configuration is now loaded using webpack\n  loader.\n- **config:** - Runtime configuration is always loaded (even with Node API `convert`)\n\n* In CLI, \"--config\" is now \"--config-file\"; this new option can be used\n  everywhere\n\n<a name=\"2.4.1\"></a>\n\n## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)\n\n### Bug Fixes\n\n- **config:** fix custom config & default options ([#176](https://github.com/gregberge/svgr/issues/176)) ([9a6c40b](https://github.com/gregberge/svgr/commit/9a6c40b))\n\n<a name=\"2.4.0\"></a>\n\n# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)\n\n### Bug Fixes\n\n- use literal instead of litteral ([7849fd4](https://github.com/gregberge/svgr/commit/7849fd4))\n\n### Features\n\n- allow to spread props at the start ([#166](https://github.com/gregberge/svgr/issues/166)) ([cd659dc](https://github.com/gregberge/svgr/commit/cd659dc))\n- **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))\n- new option \"svgProps\" ([#172](https://github.com/gregberge/svgr/issues/172)) ([9657110](https://github.com/gregberge/svgr/commit/9657110))\n\n<a name=\"2.3.0\"></a>\n\n# [2.3.0](https://github.com/gregberge/svgr/compare/v2.2.1...v2.3.0) (2018-09-03)\n\n### Features\n\n- upgrade to Babel v7 ([7bc908d](https://github.com/gregberge/svgr/commit/7bc908d))\n\n<a name=\"2.2.1\"></a>\n\n## [2.2.1](https://github.com/gregberge/svgr/compare/v2.2.0...v2.2.1) (2018-08-16)\n\n### Bug Fixes\n\n- **rollup:** fix to work with rollup-plugin-typescript2 ([#147](https://github.com/gregberge/svgr/issues/147)) ([4b3737e](https://github.com/gregberge/svgr/commit/4b3737e))\n\n<a name=\"2.2.0\"></a>\n\n# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)\n\n### Bug Fixes\n\n- remove null-byte characters ([#154](https://github.com/gregberge/svgr/issues/154)) ([de7f8a7](https://github.com/gregberge/svgr/commit/de7f8a7)), closes [#153](https://github.com/gregberge/svgr/issues/153)\n- **webpack:** use source when possible ([#139](https://github.com/gregberge/svgr/issues/139)) ([ae9965d](https://github.com/gregberge/svgr/commit/ae9965d))\n\n### Features\n\n- **core:** pass info to SVGO ([2b2353b](https://github.com/gregberge/svgr/commit/2b2353b)), closes [#152](https://github.com/gregberge/svgr/issues/152)\n\n<a name=\"2.1.1\"></a>\n\n## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)\n\n### Bug Fixes\n\n- **core:** config conflict with icon option ([#137](https://github.com/gregberge/svgr/issues/137)) ([e13a99a](https://github.com/gregberge/svgr/commit/e13a99a))\n\n<a name=\"2.1.0\"></a>\n\n# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)\n\n### Features\n\n- add .editorconfig support ([#129](https://github.com/gregberge/svgr/issues/129)) ([968fd82](https://github.com/gregberge/svgr/commit/968fd82))\n- **cli:** support custom filename cases ([#136](https://github.com/gregberge/svgr/issues/136)) ([4922f7a](https://github.com/gregberge/svgr/commit/4922f7a)), closes [#118](https://github.com/gregberge/svgr/issues/118)\n\n<a name=\"2.0.0\"></a>\n\n# [2.0.0](https://github.com/gregberge/svgr/compare/v1.10.0...v2.0.0) (2018-06-12)\n\n### Features\n\n#### Project configurations\n\nSVGR now supports Prettier (`.prettierc`) and SVGO (`.svgo.yml`) configurations. It also supports a new `.svgrrc` configuration. See the readme for more detail.\n\n#### Rollup plugin\n\nRollup has now an official SVGR plugin available under `@svgr/rollup`.\n\n#### Split into several modules\n\nSVGR is now an ecosystem of four modules:\n\n- `@svgr/core`: Core of SVGR, it exposes the Node API\n- `@svgr/cli`: Command Line Interface\n- `@svgr/webpack`: webpack loader\n- `@svgr/rollup`: a fresh new Rollup plugin\n\n#### `svgAttributes` and `titleProp` options\n\nTwo new options appears, the first one `svgAttributes` gives you the opportunity to add attribute on the root `svg` tag without creating a custom template:\n\nCommand:\n\n```\nsvgr --svg-attributes focusable=true foo.svg\n```\n\nOutput:\n\n```js\n;(props) => <svg focusable=\"false\" />\n```\n\nThe second one, `titleProp`, adds a custom property `title` to specify the title of the SVG.\n\nCommand:\n\n```\nsvgr --title-prop foo.svg\n```\n\nOutput:\n\n```js\n;({ title }) => (\n  <svg>\n    <title>{title}</title>\n  </svg>\n)\n```\n\n### Breaking changes\n\n#### Node version\n\nNode v6 support has been dropped, you need Node >= 8 to run SVGR.\n\n#### Prettier options\n\nAll Prettier options have been removed:\n\n- `jsx-bracket-same-line`\n- `no-bracket-spacing`\n- `no-semi`\n- `single-quote`\n- `tab-width`\n- `trailing-comma`\n- `use-tabs`\n\nIf you used it, use a `.prettierrc` instead of use the new option `--prettier-config`:\n\nv1.x:\n\n```\nsvgr --no-semi file.svg\n```\n\nv2.x:\n\n```\nsvgr --prettier-config '{\"semi\": true}' file.svg\n```\n\n#### SVGO options\n\nAll SVGO options have been removed:\n\n- `ids`\n- `keep-useless-defs`\n- `no-title`\n- `no-view-box`\n- `precision`\n\nIf you used it, use a `.svgo.yml` instead of use the new option `--svgo-config`:\n\nv1.x:\n\n```\nsvgr --ids file.svg\n```\n\nv2.x:\n\n```\nsvgr --svgo-config '{\"plugins\": [{\"cleanupIDs\": {\"remove\": false, \"minify\": false}}]}' file.svg\n```\n\n#### Other options\n\n- `replace-attr-value` has been renamed into `replace-attr-values`\n\nIn API, `replaceAttrValues` is now an object instead of an array.\n\n#### Node API changes\n\n- `rawConvert` method has been dropped\n- Templates now receive three arguments: `code`, `config` and `state`\n- `componentName` must now be passed in state\n\n### Thanks\n\nThanks to [@MarquesDev](https://github.com/MarquesDev) and [@lifeiscontent](https://github.com/lifeiscontent).\n\n<a name=\"1.10.0\"></a>\n\n# [1.10.0](https://github.com/gregberge/svgr/compare/v1.9.2...v1.10.0) (2018-05-28)\n\n### Features\n\n- upgrade Prettier (v1.13) ([2f50403](https://github.com/gregberge/svgr/commit/2f50403)), closes [#108](https://github.com/gregberge/svgr/issues/108)\n\n<a name=\"1.9.2\"></a>\n\n## [1.9.2](https://github.com/gregberge/svgr/compare/v1.9.1...v1.9.2) (2018-05-14)\n\n### Bug Fixes\n\n- **ids:** do not minify them ([538b73f](https://github.com/gregberge/svgr/commit/538b73f))\n\n<a name=\"1.9.1\"></a>\n\n## [1.9.1](https://github.com/gregberge/svgr/compare/v1.9.0...v1.9.1) (2018-03-25)\n\n### Bug Fixes\n\n- fix width / height override ([1f91705](https://github.com/gregberge/svgr/commit/1f91705)), closes [#issuecomment-375467614](https://github.com/gregberge/svgr/issues/issuecomment-375467614)\n- handle filename with numbers ([a2387ea](https://github.com/gregberge/svgr/commit/a2387ea)), closes [#62](https://github.com/gregberge/svgr/issues/62) [#64](https://github.com/gregberge/svgr/issues/64)\n\n<a name=\"1.9.0\"></a>\n\n# [1.9.0](https://github.com/gregberge/svgr/compare/v1.8.1...v1.9.0) (2018-03-08)\n\n### Features\n\n- add option to removeDimensions ([#58](https://github.com/gregberge/svgr/issues/58)) ([7357e7c](https://github.com/gregberge/svgr/commit/7357e7c))\n\n<a name=\"1.8.1\"></a>\n\n## [1.8.1](https://github.com/gregberge/svgr/compare/v1.8.0...v1.8.1) (2018-01-31)\n\n### Bug Fixes\n\n- **loader:** add missing babel-plugin ([#50](https://github.com/gregberge/svgr/issues/50)) ([c49b627](https://github.com/gregberge/svgr/commit/c49b627))\n\n<a name=\"1.8.0\"></a>\n\n# [1.8.0](https://github.com/gregberge/svgr/compare/v1.7.0...v1.8.0) (2018-01-31)\n\n### Bug Fixes\n\n- fix tabWidth option ([#49](https://github.com/gregberge/svgr/issues/49)) ([a863280](https://github.com/gregberge/svgr/commit/a863280)), closes [#33](https://github.com/gregberge/svgr/issues/33)\n\n### Features\n\n- support custom file extension ([#47](https://github.com/gregberge/svgr/issues/47)) ([56a111f](https://github.com/gregberge/svgr/commit/56a111f)), closes [#31](https://github.com/gregberge/svgr/issues/31)\n- **webpack:** include Babel transformation ([#48](https://github.com/gregberge/svgr/issues/48)) ([dfecd39](https://github.com/gregberge/svgr/commit/dfecd39)), closes [#45](https://github.com/gregberge/svgr/issues/45)\n\n<a name=\"1.7.0\"></a>\n\n# [1.7.0](https://github.com/gregberge/svgr/compare/v1.6.0...v1.7.0) (2018-01-23)\n\n### Features\n\n- **emSize:** add support for missing width/height ([2eacfd8](https://github.com/gregberge/svgr/commit/2eacfd8))\n- add option keepUselessDefs ([3d03510](https://github.com/gregberge/svgr/commit/3d03510)), closes [#36](https://github.com/gregberge/svgr/issues/36)\n\n### Performance Improvements\n\n- refactor emSize to reduce iterations ([3c9d8b4](https://github.com/gregberge/svgr/commit/3c9d8b4))\n\n<a name=\"1.6.0\"></a>\n\n# [1.6.0](https://github.com/gregberge/svgr/compare/v1.5.0...v1.6.0) (2018-01-08)\n\n### Features\n\n- support url-loader & file-loader ([b95ed07](https://github.com/gregberge/svgr/commit/b95ed07))\n\n<a name=\"1.5.0\"></a>\n\n# [1.5.0](https://github.com/gregberge/svgr/compare/v1.4.0...v1.5.0) (2017-12-12)\n\n### Features\n\n- add ref option ([#29](https://github.com/gregberge/svgr/issues/29)) ([86e0bda](https://github.com/gregberge/svgr/commit/86e0bda))\n\n<a name=\"1.4.0\"></a>\n\n# [1.4.0](https://github.com/gregberge/svgr/compare/v1.3.0...v1.4.0) (2017-12-07)\n\n### Features\n\n- add \"-native\" option to target React Native ([76fd6f5](https://github.com/gregberge/svgr/commit/76fd6f5))\n- **native:** import only relevant components ([fcd4229](https://github.com/gregberge/svgr/commit/fcd4229))\n- **native:** log unsupported components ([888d968](https://github.com/gregberge/svgr/commit/888d968))\n\n<a name=\"1.3.0\"></a>\n\n# [1.3.0](https://github.com/gregberge/svgr/compare/v1.1.0...v1.3.0) (2017-12-05)\n\n### Features\n\n- add option to keeps IDs from SVG ([bfd4066](https://github.com/gregberge/svgr/commit/bfd4066))\n\n<a name=\"1.2.0\"></a>\n\n# [1.2.0](https://github.com/gregberge/svgr/compare/v1.1.0...v1.2.0) (2017-12-04)\n\n### Features\n\n- simplify webpack usage ([7ac643e](https://github.com/gregberge/svgr/commit/7ac643e))\n\n<a name=\"1.1.0\"></a>\n\n# [1.1.0](https://github.com/gregberge/svgr/compare/v1.0.0...v1.1.0) (2017-11-24)\n\n### Features\n\n- add viewBox option that default to true ([ba2be3a](https://github.com/gregberge/svgr/commit/ba2be3a))\n\n<a name=\"1.0.0\"></a>\n\n# [1.0.0](https://github.com/gregberge/svgr/compare/v0.5.0...v1.0.0) (2017-11-07)\n\n### Features\n\n- upgrade svgo & prettier ([fd66885](https://github.com/gregberge/svgr/commit/fd66885))\n\n### BREAKING CHANGES\n\n- SVGO now removes viewBox automatically.\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment include:\n\n- Using welcoming and inclusive language\n- Being respectful of differing viewpoints and experiences\n- Gracefully accepting constructive criticism\n- Focusing on what is best for the community\n- Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n- The use of sexualized language or imagery and unwelcome sexual attention or advances\n- Trolling, insulting/derogatory comments, and personal or political attacks\n- Public or private harassment\n- Publishing others' private information, such as a physical or electronic address, without explicit permission\n- Other conduct which could reasonably be considered inappropriate in a professional setting\n\n## Our Responsibilities\n\nProject maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.\n\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.\n\n## Scope\n\nThis Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hey@gregberge.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.\n\nProject maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# How to Contribute\n\nSVGR is a small project, it is widely used but has not a lot of contributors. We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and answers some questions that you may have.\n\n## [Code of Conduct](https://github.com/gregberge/svgr/blob/master/CODE_OF_CONDUCT.md)\n\nWe expect project participants to adhere to our Code of Conduct. Please read [the full text](https://github.com/gregberge/svgr/blob/master/CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated.\n\n## Open Development\n\nAll work on SVGR happens directly on [GitHub](/). Both core team members and external contributors send pull requests which go through the same review process.\n\nThe SVGR repo is a monorepo using pnpm workspaces and [Lerna](https://lerna.js.org/docs/recipes/using-pnpm-with-lerna). The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/). Note that website still uses npm, as there are some errors reported when using pnpm in gatsby.\n\n### Online one click Setup\n\nYou can use Gitpod(An Online Open Source VS Code like IDE which is free for Open Source) for contributing online. With a single click it will start a workspace and automatically:\n\n- clone the `svgr` repo.\n- install dependencies in '/': `pnpm install`\n- install dependencies in '/website': `npm install`\n- run `pnpm run dev` in `/`.\n- run `npm run dev` in `/website` to start the dev server.\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)\n\n### Workflow and Pull Requests\n\n_Before_ submitting a pull request, please make sure the following is done…\n\n1.  Fork the repo and create your branch from `main`. A guide on how to fork a repository: https://help.github.com/articles/fork-a-repo/\n\n    Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type:\n\n    ```sh-session\n    $ git clone https://github.com/<your_username>/svgr\n    $ cd svgr\n    $ git checkout -b my_branch\n    ```\n\n    Note: Replace `<your_username>` with your GitHub username\n\n2.  Run `pnpm install` and `pnpm run build`.\n\n3.  If you've added code that should be tested, add tests. You can use watch mode that continuously transforms changed files to make your life easier.\n\n    ```sh\n    # in the background\n    pnpm run dev\n    ```\n\n4.  If you've changed APIs, update the documentation.\n\n5.  Ensure the linting is good via `npm run lint`.\n\n    ```sh-session\n    $ pnpm run lint\n    ```\n\n6.  Ensure the test suite passes via `npm run test`.\n\n    ```sh-session\n    $ pnpm run test\n    ```\n\n## Bugs\n\n### Where to Find Known Issues\n\nWe will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist.\n\n### Reporting New Issues\n\nThe best way to get your bug fixed is to provide a reduced test case. Please provide a public repository with a runnable example.\n\n## Code Conventions\n\nPlease follow the `.prettierrc` in the project.\n\n## Credits\n\nThis project exists thanks to all the people who [contribute](CONTRIBUTING.md). <a href=\"https://github.com/gregberge/svgr/graphs/contributors\"><img src=\"https://opencollective.com/svgr/contributors.svg?width=890&button=false\" /></a>\n\n### [Backers](https://opencollective.com/svgr#backer)\n\nThank you to all our backers! 🙏\n\n<a href=\"https://opencollective.com/svgr#backers\" target=\"_blank\"><img src=\"https://opencollective.com/svgr/backers.svg?width=890\"></a>\n\n### [Sponsors](https://opencollective.com/svgr#sponsor)\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website.\n\n## License\n\nBy contributing to SVGR, you agree that your contributions will be licensed under its MIT license.\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright 2017 Smooth Code\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"
  },
  {
    "path": "README.md",
    "content": "<h1 align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/gregberge/svgr/master/resources/svgr-logo.png\" alt=\"svgr\" title=\"svgr\" width=\"300\">\n</h1>\n<p align=\"center\" style=\"font-size: 1.2rem;\">Transform SVGs into React components 🦁</p>\n\n[![License](https://img.shields.io/npm/l/@svgr/core.svg)](https://github.com/gregberge/svgr/blob/master/LICENSE)\n[![Donate](https://opencollective.com/svgr/backers/badge.svg)](https://opencollective.com/svgr/donate)\n[![npm package](https://img.shields.io/npm/v/@svgr/core/latest.svg)](https://www.npmjs.com/package/@svgr/core)\n[![npm downloads](https://img.shields.io/npm/dm/@svgr/core.svg)](https://www.npmjs.com/package/@svgr/core)\n[![CI](https://github.com/gregberge/svgr/actions/workflows/ci.yml/badge.svg)](https://github.com/gregberge/svgr/actions/workflows/ci.yml)\n[![Code Coverage](https://img.shields.io/codecov/c/github/gregberge/svgr.svg)](https://codecov.io/github/gregberge/svgr)\n\n[**Try it out online!**](https://react-svgr.com/playground)\n\n[**Watch the talk at React Europe**](https://www.youtube.com/watch?v=geKCzi7ZPkA)\n\nSVGR is an universal tool to transform SVG into React components.\n\nSVGR takes a raw SVG and transforms it into a ready-to-use React component.\n\n## [Docs](https://react-svgr.com)\n\n**See the documentation at [react-svgr.com](https://react-svgr.com)** for more information about using `svgr`!\n\nQuicklinks to some of the most-visited pages:\n\n- [**Playground**](https://react-svgr.com/playground/)\n- [**Getting started**](https://react-svgr.com/docs/getting-started/)\n- [CLI usage](https://react-svgr.com/docs/cli/)\n- [Webpack usage](https://react-svgr.com/docs/webpack/)\n- [Node.js usage](https://react-svgr.com/docs/node-api/)\n\n## Example\n\n**Take a SVG**:\n\n```html\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg\n  width=\"48px\"\n  height=\"1px\"\n  viewBox=\"0 0 48 1\"\n  version=\"1.1\"\n  xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n  <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n  <title>Rectangle 5</title>\n  <desc>Created with Sketch.</desc>\n  <defs></defs>\n  <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n    <g\n      id=\"19-Separator\"\n      transform=\"translate(-129.000000, -156.000000)\"\n      fill=\"#063855\"\n    >\n      <g id=\"Controls/Settings\" transform=\"translate(80.000000, 0.000000)\">\n        <g id=\"Content\" transform=\"translate(0.000000, 64.000000)\">\n          <g id=\"Group\" transform=\"translate(24.000000, 56.000000)\">\n            <g id=\"Group-2\">\n              <rect id=\"Rectangle-5\" x=\"25\" y=\"36\" width=\"48\" height=\"1\"></rect>\n            </g>\n          </g>\n        </g>\n      </g>\n    </g>\n  </g>\n</svg>\n```\n\n**Run SVGR**\n\n```sh\nnpx @svgr/cli --icon --replace-attr-values \"#063855=currentColor\" -- icon.svg\n```\n\n**Get an optimized React component**\n\n```js\nimport * as React from 'react'\n\nconst SvgComponent = (props) => (\n  <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 48 1\" {...props}>\n    <path d=\"M0 0h48v1H0z\" fill=\"currentColor\" fillRule=\"evenodd\" />\n  </svg>\n)\n\nexport default SvgComponent\n```\n\n## Supporting SVGR\n\nSVGR is a MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to the support of these awesome [backers](/BACKERS.md). If you'd like to join them, please consider:\n\n- [Sponsor me on GitHub](https://github.com/sponsors/gregberge)\n- [Become a backer or sponsor on OpenCollective](https://opencollective.com/svgr)\n\nLearn more about [supporting SVGR](https://react-svgr.com/docs/supporting-svgr/).\n\n## Contributing\n\nCheck out the [contributing guidelines](CONTRIBUTING.md)\n\n# License\n\nLicensed under the MIT License, Copyright © 2017-present Greg Bergé.\n\nSee [LICENSE](./LICENSE) for more information.\n\n## Acknowledgements\n\nThis project has been popularized by [Christopher Chedeau](https://twitter.com/vjeux) and it has been included in [create-react-app](https://github.com/facebook/create-react-app) thanks to [Dan Abramov](https://twitter.com/dan_abramov). We would like to thanks [Sven Sauleau](https://twitter.com/svensauleau) for his help and its intuition.\n"
  },
  {
    "path": "__fixtures__/custom-index-template.js",
    "content": "const path = require('path')\n\nfunction indexTemplate(files) {\n  const exportEntries = files.map(({path: file}) => {\n    const basename = path.basename(file, path.extname(file))\n    return `export { ${basename} } from './${basename}';`\n  })\n  return exportEntries.join('\\n')\n}\n\nmodule.exports = indexTemplate\n"
  },
  {
    "path": "__fixtures__/custom-index.config.js",
    "content": "const indexTemplate = require('./custom-index-template.js')\n\nfunction template(\n  { imports, componentName, props, jsx, exports },\n  { tpl }\n) {\n  return tpl`${imports}\nexport function ${componentName}(${props}) {\n  return ${jsx};\n}\n`\n}\n\nmodule.exports = {\n  template,\n  indexTemplate,\n}\n"
  },
  {
    "path": "__fixtures__/overrides.config.js",
    "content": "module.exports = {\n  expandProps: false,\n  dimensions: false,\n  svgo: false,\n  prettier: false,\n}\n"
  },
  {
    "path": "__fixtures__/simple-existing/File..js",
    "content": "import * as React from 'react'\n\nfunction SvgFile(props) {\n  return (\n    <svg width={48} height={1} {...props}>\n      <path d=\"M0 0h48v1H0z\" fill=\"#063855\" fillRule=\"evenodd\" />\n    </svg>\n  )\n}\n\nexport default SvgFile\n"
  },
  {
    "path": "__fixtures__/simple-existing/File.js",
    "content": "// nothing"
  },
  {
    "path": "__fixtures__/simple-existing/index..js",
    "content": "export { default as File } from './File'"
  },
  {
    "path": "__fixtures__/template.js",
    "content": "module.exports = () => (code, state) => `\nimport * as React from 'react'\n\nexport default function ${state.componentName}() {\n  return ${code}\n}\n`\n"
  },
  {
    "path": "__fixtures__/withPrettierRc/.prettierrc",
    "content": "{\n  \"tabWidth\": 5\n}\n"
  },
  {
    "path": "__fixtures__/withSvgoConfig/svgo.config.cjs",
    "content": "module.exports = {\n  plugins: [\n    {\n      name: 'preset-default',\n      params: {\n        overrides: {\n          removeTitle: false,\n        },\n      },\n    },\n  ]\n}"
  },
  {
    "path": "__fixtures__/withSvgoConfig/svgo.config.js",
    "content": "module.exports = {\n  plugins: [\n    {\n      name: 'preset-default',\n      params: {\n        overrides: {\n          removeTitle: false,\n        },\n      },\n    },\n  ]\n}"
  },
  {
    "path": "__fixtures__/withSvgrRc/.svgrrc",
    "content": "{\n  \"icon\": true\n}\n"
  },
  {
    "path": "api/api/svgr.js",
    "content": "/* eslint-disable @typescript-eslint/no-var-requires */\nconst { transform } = require('@svgr/core')\nconst jsx = require('@svgr/plugin-jsx')\nconst svgo = require('@svgr/plugin-svgo')\nconst prettier = require('@svgr/plugin-prettier')\n\nmodule.exports = (req, res) => {\n  if (!req.body) {\n    res.status(204).send('')\n    return\n  }\n  transform(req.body.code, {\n    ...req.body.options,\n    plugins: [svgo, jsx, prettier],\n  })\n    .then((output) => {\n      res.status(200).json({ output })\n    })\n    .catch((error) => {\n      res.status(400).json({ error: error.message })\n    })\n}\n"
  },
  {
    "path": "api/package.json",
    "content": "{\n  \"private\": true,\n  \"packageManager\": \"pnpm@8.1.1\",\n  \"dependencies\": {\n    \"@svgr/core\": \"latest\",\n    \"@svgr/plugin-jsx\": \"latest\",\n    \"@svgr/plugin-prettier\": \"latest\",\n    \"@svgr/plugin-svgo\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "api/pnpm-workspace.yaml",
    "content": "# https://github.com/pnpm/pnpm/issues/2412\n# This is only created so that api package doesn't try to use the virtual store from the repo's root\n"
  },
  {
    "path": "api/vercel.json",
    "content": "{\n  \"public\": true,\n  \"redirects\": [\n    {\n      \"source\": \"/\",\n      \"destination\": \"https://react-svgr.com/playground\"\n    }\n  ],\n  \"headers\": [\n    {\n      \"source\": \"/api/(.*)\",\n      \"headers\": [\n        { \"key\": \"Access-Control-Allow-Credentials\", \"value\": \"true\" },\n        { \"key\": \"Access-Control-Allow-Origin\", \"value\": \"*\" },\n        {\n          \"key\": \"Access-Control-Allow-Methods\",\n          \"value\": \"GET,OPTIONS,PATCH,DELETE,POST,PUT\"\n        },\n        {\n          \"key\": \"Access-Control-Allow-Headers\",\n          \"value\": \"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version\"\n        }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "babel.config.js",
    "content": "module.exports = {\n  presets: [\n    ['@babel/preset-env', { targets: { node: '12' }, loose: true }],\n    '@babel/preset-typescript',\n  ],\n}\n"
  },
  {
    "path": "build/rollup.config.mjs",
    "content": "import { resolve } from 'node:path'\nimport { readFileSync } from 'node:fs'\nimport json from '@rollup/plugin-json'\nimport dts from 'rollup-plugin-dts'\nimport esbuild from 'rollup-plugin-esbuild'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst pkg = JSON.parse(\n  readFileSync(resolve(process.cwd(), './package.json'), 'utf-8'),\n)\nconst name = pkg.main ? pkg.main.replace(/\\.js$/, '') : './dist/index'\n\nconst bundle = (config) => ({\n  ...config,\n  input: 'src/index.ts',\n  external: (id) => !/^[./]/.test(id),\n})\n\nexport default [\n  bundle({\n    plugins: [json(), esbuild()],\n    output: [\n      {\n        file: `${name}.js`,\n        format: 'cjs',\n        sourcemap: Boolean(pkg.main),\n        exports: 'auto',\n      },\n    ],\n  }),\n  ...(pkg.main\n    ? [\n        bundle({\n          plugins: [\n            dts({\n              compilerOptions: {\n                // https://github.com/Swatinem/rollup-plugin-dts/issues/143\n                preserveSymlinks: false,\n              },\n            }),\n          ],\n          output: {\n            file: `${name}.d.ts`,\n            format: 'es',\n          },\n        }),\n      ]\n    : []),\n]\n"
  },
  {
    "path": "deprecated-packages/svgr/message.js",
    "content": "/* eslint-disable @typescript-eslint/no-var-requires */\nconst githubCurrentUser = require('github-current-user')\n\ngithubCurrentUser.verify((err, verified, username) => {\n  console.log(`Hello ${username || ''}!`)\n  console.log(`SVGR 🦁 v2.0.0 is released 🎉`)\n  console.log(\n    `It is now splitted into several packages, what are you looking for?\\n`,\n  )\n  console.log(`Command line    👉   @svgr/cli`)\n  console.log(`Node API        👉   @svgr/core`)\n  console.log(`Webpack         👉   @svgr/webpack`)\n  console.log(`Rollup          👉   @svgr/rollup`)\n  console.log(`Pick the one you need!`)\n})\n"
  },
  {
    "path": "deprecated-packages/svgr/package.json",
    "content": "{\n  \"name\": \"svgr\",\n  \"description\": \"Convert raw SVG into React components.\",\n  \"version\": \"2.0.0\",\n  \"repository\": \"git@github.com:gregberge/svgr.git\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"keywords\": [\n    \"svg\",\n    \"h2x\",\n    \"react\",\n    \"component\",\n    \"svg2react\",\n    \"svg-to-react\"\n  ],\n  \"engines\": {\n    \"node\": \">=8\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"github-current-user\": \"^2.5.0\"\n  },\n  \"scripts\": {\n    \"postinstall\": \"node message.js; sleep 10; exit 1;\"\n  }\n}\n"
  },
  {
    "path": "examples/mocha-esm/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/mocha-esm-example\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/mocha-esm-example\n"
  },
  {
    "path": "examples/mocha-esm/__mocks__/svg.js",
    "content": "export default 'Icon'\n"
  },
  {
    "path": "examples/mocha-esm/example.js",
    "content": "import Icon from './icon.svg'\n\nexport { Icon }\n"
  },
  {
    "path": "examples/mocha-esm/example.test.js",
    "content": "import { Icon } from './example.js'\n\nit('works', () => {\n  if (Icon !== 'Icon') {\n    throw new Error('Invalid')\n  }\n})\n"
  },
  {
    "path": "examples/mocha-esm/mock-loader.js",
    "content": "import { cwd } from 'node:process'\nimport { pathToFileURL } from 'node:url'\n\nconst baseURL = pathToFileURL(`${cwd()}/`).href\nconst SVG_REGEX = /^[./a-zA-Z0-9$_-]+\\.svg$/\n\nexport async function resolve(specifier, context, defaultResolve) {\n  if (SVG_REGEX.test(specifier)) {\n    return { url: new URL('./__mocks__/svg.js', baseURL).href }\n  }\n  return defaultResolve(specifier, context, defaultResolve)\n}\n"
  },
  {
    "path": "examples/mocha-esm/package.json",
    "content": "{\n  \"name\": \"@svgr/mocha-esm-example\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"test\": \"mocha --loader=./mock-loader.js example.test.js\"\n  },\n  \"devDependencies\": {\n    \"mocha\": \"^10.2.0\"\n  },\n  \"version\": \"8.0.0\"\n}\n"
  },
  {
    "path": "examples/webpack/.gitignore",
    "content": "dist/\n"
  },
  {
    "path": "examples/webpack/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n**Note:** Version bump only for package @svgr/webpack-example\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/webpack-example\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/webpack-example\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/webpack-example\n"
  },
  {
    "path": "examples/webpack/package.json",
    "content": "{\n  \"name\": \"@svgr/webpack-example\",\n  \"private\": true,\n  \"scripts\": {\n    \"start\": \"webpack serve\"\n  },\n  \"devDependencies\": {\n    \"@svgr/webpack\": \"^8.1.0\",\n    \"html-webpack-plugin\": \"^5.5.0\",\n    \"url-loader\": \"^4.1.1\",\n    \"webpack\": \"^5.76.3\",\n    \"webpack-cli\": \"^5.0.1\",\n    \"webpack-dev-server\": \"^4.13.1\"\n  },\n  \"version\": \"8.1.0\"\n}\n"
  },
  {
    "path": "examples/webpack/src/index.js",
    "content": "import star, { ReactComponent } from './star.url.svg'\nimport Star from './star.simple.svg'\n\nconsole.log('url', typeof star, typeof ReactComponent)\nconsole.log('simple', typeof Star)\n"
  },
  {
    "path": "examples/webpack/webpack.config.js",
    "content": "const HtmlWebpackPlugin = require('html-webpack-plugin')\n\nmodule.exports = {\n  mode: 'development',\n  module: {\n    rules: [\n      {\n        test: /url\\.svg$/,\n        use: ['@svgr/webpack', 'url-loader'],\n      },\n      {\n        test: /simple\\.svg$/,\n        use: '@svgr/webpack',\n      },\n    ],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      title: 'Development',\n    }),\n  ],\n}\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n  watchPathIgnorePatterns: ['__fixtures__', '__fixtures__build__'],\n  rootDir: 'packages',\n  transform: {\n    '^.+\\\\.(j|t)sx?$': ['babel-jest', { root: __dirname }],\n  },\n}\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n  \"lerna\": \"2.9.0\",\n  \"version\": \"8.1.0\",\n  \"npmClient\": \"pnpm\",\n  \"useWorkspaces\": true\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"pnpm -r run build\",\n    \"dev\": \"pnpm -r --parallel run build --watch\",\n    \"format\": \"prettier --write .\",\n    \"lint\": \"eslint . && prettier --check .\",\n    \"release\": \"lerna publish --conventional-commits && conventional-github-releaser --preset angular\",\n    \"test\": \"jest --runInBand\"\n  },\n  \"packageManager\": \"pnpm@8.1.1\",\n  \"devDependencies\": {\n    \"@types/babel__core\": \"^7.20.0\",\n    \"@types/node\": \"^18.15.11\",\n    \"@babel/core\": \"^7.21.3\",\n    \"@babel/preset-env\": \"^7.20.2\",\n    \"@babel/preset-typescript\": \"^7.21.0\",\n    \"@rollup/plugin-json\": \"^6.0.0\",\n    \"@types/jest\": \"^29.5.0\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.56.0\",\n    \"@typescript-eslint/parser\": \"^5.56.0\",\n    \"@svgr/plugin-jsx\": \"workspace:*\",\n    \"@svgr/plugin-svgo\": \"workspace:*\",\n    \"@svgr/plugin-prettier\": \"workspace:*\",\n    \"babel-jest\": \"^29.5.0\",\n    \"codecov\": \"^3.8.3\",\n    \"conventional-github-releaser\": \"^3.1.5\",\n    \"esbuild\": \"^0.17.12\",\n    \"eslint\": \"^8.36.0\",\n    \"eslint-plugin-react\": \"^7.32.2\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"jest\": \"^29.5.0\",\n    \"lerna\": \"^6.6.0\",\n    \"react\": \"^18.2.0\",\n    \"rollup\": \"^3.20.2\",\n    \"rollup-plugin-dts\": \"^5.3.0\",\n    \"rollup-plugin-esbuild\": \"^5.0.0\",\n    \"typescript\": \"^5.0.2\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/.npmignore",
    "content": "src/\n.*\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/README.md",
    "content": "# @svgr/babel-plugin-add-jsx-attribute\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-add-jsx-attribute\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@svgr/babel-plugin-add-jsx-attribute\",\n      {\n        \"elements\": [\"svg\"],\n        \"attributes\": [\n          {\n            \"name\": \"width\",\n            \"value\": \"200\",\n            \"spread\": false,\n            \"literal\": false,\n            \"position\": \"end\"\n          }\n        ]\n      }\n    ]\n  ]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-add-jsx-attribute\",\n  \"description\": \"Add JSX attribute\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-add-jsx-attribute\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin, { Options } from '.'\n\nconst testPlugin = (code: string, options: Options) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', [plugin, options]],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('plugin', () => {\n  it('should add simple attribute', () => {\n    expect(\n      testPlugin('<div />', {\n        elements: ['div'],\n        attributes: [{ name: 'disabled' }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div disabled />;\"`)\n  })\n\n  it('should add attribute with value', () => {\n    expect(\n      testPlugin('<div />', {\n        elements: ['div'],\n        attributes: [{ name: 'disabled', value: true }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div disabled={true} />;\"`)\n    expect(\n      testPlugin('<div />', {\n        elements: ['div'],\n        attributes: [{ name: 'disabled', value: 'true' }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div disabled=\"true\" />;\"`)\n\n    expect(\n      testPlugin('<div />', {\n        elements: ['div'],\n        attributes: [{ name: 'disabled', value: 200 }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div disabled={200} />;\"`)\n  })\n\n  it('should add literal attribute', () => {\n    expect(\n      testPlugin('<div />', {\n        elements: ['div'],\n        attributes: [{ name: 'ref', value: 'ref', literal: true }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div ref={ref} />;\"`)\n\n    expect(\n      testPlugin('<div />', {\n        elements: ['div'],\n        attributes: [{ name: 'ref', value: 'ref ? ref : null', literal: true }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div ref={ref ? ref : null} />;\"`)\n  })\n\n  it('should add spread attribute', () => {\n    expect(\n      testPlugin('<div foo><span /></div>', {\n        elements: ['div'],\n        attributes: [\n          {\n            spread: true,\n            name: 'props',\n            position: 'start',\n          },\n        ],\n      }),\n    ).toMatchInlineSnapshot(`\"<div {...props} foo><span /></div>;\"`)\n\n    expect(\n      testPlugin('<div><span foo=\"bar\" /></div>', {\n        elements: ['span'],\n        attributes: [\n          {\n            spread: true,\n            name: 'props',\n            position: 'end',\n          },\n        ],\n      }),\n    ).toMatchInlineSnapshot(`\"<div><span foo=\"bar\" {...props} /></div>;\"`)\n  })\n\n  it('should replace attribute', () => {\n    expect(\n      testPlugin('<div disabled />', {\n        elements: ['div'],\n        attributes: [{ name: 'disabled', value: false }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div disabled={false} />;\"`)\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { ConfigAPI, types as t, NodePath, template } from '@babel/core'\n\nexport interface Attribute {\n  name: string\n  value?: boolean | number | string | null\n  spread?: boolean\n  literal?: boolean\n  position?: 'start' | 'end'\n}\n\nexport interface Options {\n  elements: string[]\n  attributes: Attribute[]\n}\n\nconst positionMethod = {\n  start: 'unshiftContainer',\n  end: 'pushContainer',\n} as const\n\nconst addJSXAttribute = (_: ConfigAPI, opts: Options) => {\n  function getAttributeValue({\n    literal,\n    value,\n  }: {\n    literal?: Attribute['literal']\n    value: Attribute['value']\n  }) {\n    if (typeof value === 'boolean') {\n      return t.jsxExpressionContainer(t.booleanLiteral(value))\n    }\n\n    if (typeof value === 'number') {\n      return t.jsxExpressionContainer(t.numericLiteral(value))\n    }\n\n    if (typeof value === 'string' && literal) {\n      return t.jsxExpressionContainer(\n        (template.ast(value) as t.ExpressionStatement).expression,\n      )\n    }\n\n    if (typeof value === 'string') {\n      return t.stringLiteral(value)\n    }\n\n    return null\n  }\n\n  function getAttribute({ spread, name, value, literal }: Attribute) {\n    if (spread) {\n      return t.jsxSpreadAttribute(t.identifier(name))\n    }\n\n    return t.jsxAttribute(\n      t.jsxIdentifier(name),\n      getAttributeValue({ value, literal }),\n    )\n  }\n\n  return {\n    visitor: {\n      JSXOpeningElement(path: NodePath<t.JSXOpeningElement>) {\n        if (!t.isJSXIdentifier(path.node.name)) return\n        if (!opts.elements.includes(path.node.name.name)) return\n\n        opts.attributes.forEach(\n          ({\n            name,\n            value = null,\n            spread = false,\n            literal = false,\n            position = 'end',\n          }) => {\n            const method = positionMethod[position]\n            const newAttribute = getAttribute({ spread, name, value, literal })\n            const attributes = path.get('attributes')\n\n            const isEqualAttribute = (\n              attribute: NodePath<t.JSXSpreadAttribute | t.JSXAttribute>,\n            ) => {\n              if (spread)\n                return (\n                  attribute.isJSXSpreadAttribute() &&\n                  attribute.get('argument').isIdentifier({ name })\n                )\n              return (\n                attribute.isJSXAttribute() &&\n                attribute.get('name').isJSXIdentifier({ name })\n              )\n            }\n\n            const replaced = attributes.some((attribute) => {\n              if (!isEqualAttribute(attribute)) return false\n              attribute.replaceWith(newAttribute)\n              return true\n            })\n\n            if (!replaced) {\n              path[method]('attributes', newAttribute)\n            }\n          },\n        )\n      },\n    },\n  }\n}\n\nexport default addJSXAttribute\n"
  },
  {
    "path": "packages/babel-plugin-add-jsx-attribute/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute\n\n\n\n\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute\n\n\n\n\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n\n### Bug Fixes\n\n* fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n\n\n\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n\n### Bug Fixes\n\n* **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n\n\n\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute\n\n\n\n\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n\n### Bug Fixes\n\n* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n\n\n\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute\n\n\n\n\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n\n### Bug Fixes\n\n* **babel-plugin:** fix usage of spread attribute([#231](https://github.com/gregberge/svgr/issues/231)) ([4186953](https://github.com/gregberge/svgr/commit/4186953))\n\n\n\n\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n\n### Features\n\n* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n\n### BREAKING CHANGES\n\n* **v4:** - `template` option must now returns a Babel AST\n- `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/README.md",
    "content": "# @svgr/babel-plugin-remove-jsx-attribute\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-remove-jsx-attribute\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@svgr/babel-plugin-remove-jsx-attribute\",\n      {\n        \"elements\": [\"svg\"],\n        \"attributes\": [\"width\", \"height\"]\n      }\n    ]\n  ]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-remove-jsx-attribute\",\n  \"description\": \"Remove JSX attribute\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-remove-jsx-attribute\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin, { Options } from '.'\n\nconst testPlugin = (code: string, options: Options) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', [plugin, options]],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('plugin', () => {\n  it('should remove attributes from an element', () => {\n    expect(\n      testPlugin('<div foo><span foo /></div>', {\n        elements: ['span'],\n        attributes: ['foo'],\n      }),\n    ).toMatchInlineSnapshot(`\"<div foo><span /></div>;\"`)\n  })\n\n  it('should not throw error when spread operator is used', () => {\n    expect(\n      testPlugin('<div foo><span foo {...props} /></div>', {\n        elements: ['span'],\n        attributes: ['foo'],\n      }),\n    ).toMatchInlineSnapshot(`\"<div foo><span {...props} /></div>;\"`)\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { ConfigAPI, types as t, NodePath } from '@babel/core'\n\nexport interface Options {\n  elements: string[]\n  attributes: string[]\n}\n\nconst removeJSXAttribute = (_: ConfigAPI, opts: Options) => ({\n  visitor: {\n    JSXOpeningElement(path: NodePath<t.JSXOpeningElement>) {\n      if (!t.isJSXIdentifier(path.node.name)) return\n      if (!opts.elements.includes(path.node.name.name)) return\n\n      // @ts-ignore\n      path.get('attributes').forEach((attribute) => {\n        if (\n          t.isJSXAttribute(attribute.node) &&\n          t.isJSXIdentifier(attribute.node.name) &&\n          opts.attributes.includes(attribute.node.name.name)\n        ) {\n          attribute.remove()\n        }\n      })\n    },\n  },\n})\n\nexport default removeJSXAttribute\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-attribute/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-empty-expression\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-empty-expression\n\n\n\n\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-empty-expression\n\n\n\n\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n\n### Bug Fixes\n\n* fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n\n\n\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n\n### Bug Fixes\n\n* **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n\n\n\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n\n### Bug Fixes\n\n* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n\n\n\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-empty-expression\n\n\n\n\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n\n### Features\n\n* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n\n### BREAKING CHANGES\n\n* **v4:** - `template` option must now returns a Babel AST\n- `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/README.md",
    "content": "# @svgr/babel-plugin-remove-jsx-empty-expression\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-remove-jsx-empty-expression\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/babel-plugin-remove-jsx-empty-expression\"]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-remove-jsx-empty-expression\",\n  \"description\": \"Remove JSX empty expression\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-remove-jsx-empty-expression\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin from '.'\n\nconst testPlugin = (code: string) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', plugin],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('plugin', () => {\n  it('should remove empty expression', () => {\n    expect(testPlugin('<div>{/* Hello */}<a /></div>')).toMatchInlineSnapshot(\n      `\"<div><a /></div>;\"`,\n    )\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { types as t, NodePath } from '@babel/core'\n\nconst removeJSXEmptyExpression = () => ({\n  visitor: {\n    JSXExpressionContainer(path: NodePath<t.JSXExpressionContainer>) {\n      if (t.isJSXEmptyExpression(path.get('expression'))) {\n        path.remove()\n      }\n    },\n  },\n})\n\nexport default removeJSXEmptyExpression\n"
  },
  {
    "path": "packages/babel-plugin-remove-jsx-empty-expression/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/.npmignore",
    "content": "src/\n.*\n/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-replace-jsx-attribute-value\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-replace-jsx-attribute-value\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-replace-jsx-attribute-value\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-replace-jsx-attribute-value\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/babel-plugin-replace-jsx-attribute-value\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n- allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/README.md",
    "content": "# @svgr/babel-plugin-replace-jsx-attribute-value\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-replace-jsx-attribute-value\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@svgr/babel-plugin-replace-jsx-attribute-value\",\n      {\n        \"values\": [\n          { \"value\": \"#000\", \"newValue\": \"#fff\" },\n          { \"value\": \"blue\", \"newValue\": \"props.color\", \"literal\": true }\n        ]\n      }\n    ]\n  ]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-replace-jsx-attribute-value\",\n  \"description\": \"Replace JSX attribute value\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-replace-jsx-attribute-value\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin, { Options } from '.'\n\nconst testPlugin = (code: string, options: Options) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', [plugin, options]],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('plugin', () => {\n  it('should replace attribute values', () => {\n    expect(\n      testPlugin('<div something=\"cool\" />', {\n        values: [{ value: 'cool', newValue: 'not cool' }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div something=\"not cool\" />;\"`)\n\n    expect(\n      testPlugin('<div something=\"cool\" />', {\n        values: [{ value: 'cool', newValue: 'props.color', literal: true }],\n      }),\n    ).toMatchInlineSnapshot(`\"<div something={props.color} />;\"`)\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { ConfigAPI, types as t, NodePath, template } from '@babel/core'\n\nexport interface Value {\n  value: string\n  newValue: string | boolean | number\n  literal?: boolean\n}\n\nexport interface Options {\n  values: Value[]\n}\n\nconst addJSXAttribute = (api: ConfigAPI, opts: Options) => {\n  const getAttributeValue = (\n    value: string | boolean | number,\n    literal?: boolean,\n  ) => {\n    if (typeof value === 'string' && literal) {\n      return t.jsxExpressionContainer(\n        (template.ast(value) as t.ExpressionStatement).expression,\n      )\n    }\n\n    if (typeof value === 'string') {\n      return t.stringLiteral(value)\n    }\n\n    if (typeof value === 'boolean') {\n      return t.jsxExpressionContainer(t.booleanLiteral(value))\n    }\n\n    if (typeof value === 'number') {\n      return t.jsxExpressionContainer(t.numericLiteral(value))\n    }\n\n    return null\n  }\n\n  return {\n    visitor: {\n      JSXAttribute(path: NodePath<t.JSXAttribute>) {\n        const valuePath = path.get('value')\n        if (!valuePath.isStringLiteral()) return\n\n        opts.values.forEach(({ value, newValue, literal }) => {\n          if (!valuePath.isStringLiteral({ value })) return\n          const attributeValue = getAttributeValue(newValue, literal)\n          if (attributeValue) {\n            valuePath.replaceWith(attributeValue)\n          }\n        })\n      },\n    },\n  }\n}\n\nexport default addJSXAttribute\n"
  },
  {
    "path": "packages/babel-plugin-replace-jsx-attribute-value/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n### Bug Fixes\n\n- **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/333)\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n### Bug Fixes\n\n- **titleProp:** handle the existing title case by using element instead of value (children) ([#315](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/315)) ([065e7a9](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/065e7a9))\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n### Features\n\n- titleProps fallbacks to svg's title ([#311](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/311)) ([8f92366](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/8f92366))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/README.md",
    "content": "# @svgr/babel-plugin-svg-dynamic-title\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-svg-dynamic-title\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/babel-plugin-svg-dynamic-title\"]\n}\n```\n\n## Note\n\nThis plugin handles both the titleProp and descProp options. By default, it will handle titleProp only.\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-svg-dynamic-title\",\n  \"description\": \"Transform SVG by adding a dynamic title element\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-svg-dynamic-title\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin, { Options } from '.'\n\nconst testPlugin = (code: string, options: Options = { tag: 'title' }) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', [plugin, options]],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('title plugin', () => {\n  it('should add title attribute if not present', () => {\n    expect(testPlugin('<svg></svg>')).toMatchInlineSnapshot(\n      `\"<svg>{title ? <title id={titleId}>{title}</title> : null}</svg>;\"`,\n    )\n  })\n\n  it('should add title element and fallback to existing title', () => {\n    // testing when the existing title contains a simple string\n    expect(testPlugin(`<svg><title>Hello</title></svg>`)).toMatchInlineSnapshot(\n      `\"<svg>{title === undefined ? <title id={titleId}>Hello</title> : title ? <title id={titleId}>{title}</title> : null}</svg>;\"`,\n    )\n    // testing when the existing title contains an JSXExpression\n    expect(\n      testPlugin(`<svg><title>{\"Hello\"}</title></svg>`),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{title === undefined ? <title id={titleId}>{\"Hello\"}</title> : title ? <title id={titleId}>{title}</title> : null}</svg>;\"`,\n    )\n  })\n  it('should preserve any existing title attributes', () => {\n    // testing when the existing title contains a simple string\n    expect(\n      testPlugin(`<svg><title id='a'>Hello</title></svg>`),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{title === undefined ? <title id={titleId || 'a'}>Hello</title> : title ? <title id={titleId || 'a'}>{title}</title> : null}</svg>;\"`,\n    )\n  })\n  it('should support empty title', () => {\n    expect(testPlugin('<svg><title></title></svg>')).toMatchInlineSnapshot(\n      `\"<svg>{title ? <title id={titleId}>{title}</title> : null}</svg>;\"`,\n    )\n  })\n  it('should support self closing title', () => {\n    expect(testPlugin('<svg><title /></svg>')).toMatchInlineSnapshot(\n      `\"<svg>{title ? <title id={titleId}>{title}</title> : null}</svg>;\"`,\n    )\n  })\n\n  it('should work if an attribute is already present', () => {\n    expect(testPlugin('<svg><foo /></svg>')).toMatchInlineSnapshot(\n      `\"<svg>{title ? <title id={titleId}>{title}</title> : null}<foo /></svg>;\"`,\n    )\n  })\n})\n\ndescribe('desc plugin', () => {\n  it('should add desc attribute if not present', () => {\n    expect(testPlugin('<svg></svg>', { tag: 'desc' })).toMatchInlineSnapshot(\n      `\"<svg>{desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\"`,\n    )\n  })\n\n  it('should add desc element and fallback to existing desc', () => {\n    // testing when the existing desc contains a simple string\n    expect(\n      testPlugin(`<svg><desc>Hello</desc></svg>`, { tag: 'desc' }),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{desc === undefined ? <desc id={descId}>Hello</desc> : desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\"`,\n    )\n    // testing when the existing desc contains an JSXExpression\n    expect(\n      testPlugin(`<svg><desc>{\"Hello\"}</desc></svg>`, { tag: 'desc' }),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{desc === undefined ? <desc id={descId}>{\"Hello\"}</desc> : desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\"`,\n    )\n  })\n  it('should preserve any existing desc attributes', () => {\n    // testing when the existing desc contains a simple string\n    expect(\n      testPlugin(`<svg><desc id='a'>Hello</desc></svg>`, { tag: 'desc' }),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{desc === undefined ? <desc id={descId || 'a'}>Hello</desc> : desc ? <desc id={descId || 'a'}>{desc}</desc> : null}</svg>;\"`,\n    )\n  })\n  it('should support empty desc', () => {\n    expect(\n      testPlugin('<svg><desc></desc></svg>', { tag: 'desc' }),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\"`,\n    )\n  })\n  it('should support self closing desc', () => {\n    expect(\n      testPlugin('<svg><desc /></svg>', { tag: 'desc' }),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\"`,\n    )\n  })\n\n  it('should work if an attribute is already present', () => {\n    expect(\n      testPlugin('<svg><foo /></svg>', { tag: 'desc' }),\n    ).toMatchInlineSnapshot(\n      `\"<svg>{desc ? <desc id={descId}>{desc}</desc> : null}<foo /></svg>;\"`,\n    )\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { NodePath, types as t } from '@babel/core'\n\nconst elements = ['svg', 'Svg']\n\ntype tag = 'title' | 'desc'\n\nexport interface Options {\n  tag: tag | null\n}\n\ninterface State {\n  opts: Options\n}\n\nconst createTagElement = (\n  tag: tag,\n  children: t.JSXExpressionContainer[] = [],\n  attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[] = [],\n) => {\n  const eleName = t.jsxIdentifier(tag)\n  return t.jsxElement(\n    t.jsxOpeningElement(eleName, attributes),\n    t.jsxClosingElement(eleName),\n    children,\n  )\n}\n\nconst createTagIdAttribute = (tag: tag) =>\n  t.jsxAttribute(\n    t.jsxIdentifier('id'),\n    t.jsxExpressionContainer(t.identifier(`${tag}Id`)),\n  )\n\nconst addTagIdAttribute = (\n  tag: tag,\n  attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[],\n) => {\n  const existingId = attributes.find(\n    (attribute) => t.isJSXAttribute(attribute) && attribute.name.name === 'id',\n  ) as t.JSXAttribute | undefined\n\n  if (!existingId) {\n    return [...attributes, createTagIdAttribute(tag)]\n  }\n  existingId.value = t.jsxExpressionContainer(\n    t.isStringLiteral(existingId.value)\n      ? t.logicalExpression('||', t.identifier(`${tag}Id`), existingId.value)\n      : t.identifier(`${tag}Id`),\n  )\n  return attributes\n}\n\nconst plugin = () => ({\n  visitor: {\n    JSXElement(path: NodePath<t.JSXElement>, state: State) {\n      const tag = state.opts.tag || 'title'\n      if (!elements.length) return\n\n      const openingElement = path.get('openingElement')\n      const openingElementName = openingElement.get('name')\n      if (\n        !elements.some((element) =>\n          openingElementName.isJSXIdentifier({ name: element }),\n        )\n      ) {\n        return\n      }\n\n      const getTagElement = (\n        existingTitle?: t.JSXElement,\n      ): t.JSXExpressionContainer => {\n        const tagExpression = t.identifier(tag)\n        if (existingTitle) {\n          existingTitle.openingElement.attributes = addTagIdAttribute(\n            tag,\n            existingTitle.openingElement.attributes,\n          )\n        }\n        const conditionalTitle = t.conditionalExpression(\n          tagExpression,\n          createTagElement(\n            tag,\n            [t.jsxExpressionContainer(tagExpression)],\n            existingTitle\n              ? existingTitle.openingElement.attributes\n              : [createTagIdAttribute(tag)],\n          ),\n          t.nullLiteral(),\n        )\n        if (existingTitle?.children?.length) {\n          // If title already exists render as follows\n          // `{title === undefined ? fallbackTitleElement : titleElement}`\n          return t.jsxExpressionContainer(\n            t.conditionalExpression(\n              t.binaryExpression(\n                '===',\n                tagExpression,\n                t.identifier('undefined'),\n              ),\n              existingTitle,\n              conditionalTitle,\n            ),\n          )\n        }\n        return t.jsxExpressionContainer(conditionalTitle)\n      }\n\n      // store the title element\n      let tagElement: t.JSXExpressionContainer | null = null\n\n      const hasTitle = path.get('children').some((childPath) => {\n        if (childPath.node === tagElement) return false\n        if (!childPath.isJSXElement()) return false\n        const name = childPath.get('openingElement').get('name')\n        if (!name.isJSXIdentifier()) return false\n        if (name.node.name !== tag) return false\n        tagElement = getTagElement(childPath.node)\n        childPath.replaceWith(tagElement)\n        return true\n      })\n\n      // create a title element if not already create\n      tagElement = tagElement || getTagElement()\n      if (!hasTitle) {\n        // path.unshiftContainer is not working well :(\n        // path.unshiftContainer('children', titleElement)\n        path.node.children.unshift(tagElement)\n        path.replaceWith(path.node)\n      }\n    },\n  },\n})\n\nexport default plugin\n"
  },
  {
    "path": "packages/babel-plugin-svg-dynamic-title/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/.npmignore",
    "content": "src/\n.*\n/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/README.md",
    "content": "# @svgr/babel-plugin-svg-em-dimensions\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-svg-em-dimensions\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\n    [\"@svgr/babel-plugin-svg-em-dimensions\", { \"width\": 24, \"height\": 24 }]\n  ]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-svg-em-dimensions\",\n  \"description\": \"Transform SVG to use em-based dimensions\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-svg-em-dimensions\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin, { Options } from '.'\n\nconst testPlugin = (code: string, options?: Options) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', [plugin, options]],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('plugin', () => {\n  it('replaces width / height attributes', () => {\n    expect(\n      testPlugin('<svg foo=\"bar\" width=\"100\" height=\"200\" />'),\n    ).toMatchInlineSnapshot(`\"<svg foo=\"bar\" width=\"1em\" height=\"1em\" />;\"`)\n  })\n\n  it('adds theme if they are not present', () => {\n    expect(testPlugin('<svg foo=\"bar\" />')).toMatchInlineSnapshot(\n      `\"<svg foo=\"bar\" width=\"1em\" height=\"1em\" />;\"`,\n    )\n  })\n\n  it('accepts numeric values', () => {\n    expect(\n      testPlugin('<svg foo=\"bar\" />', { width: 24, height: 24 }),\n    ).toMatchInlineSnapshot(`\"<svg foo=\"bar\" width={24} height={24} />;\"`)\n  })\n\n  it('accepts string values', () => {\n    expect(\n      testPlugin('<svg foo=\"bar\" />', { width: '2em', height: '2em' }),\n    ).toMatchInlineSnapshot(`\"<svg foo=\"bar\" width=\"2em\" height=\"2em\" />;\"`)\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { types as t, NodePath, ConfigAPI } from '@babel/core'\n\nconst elements = ['svg', 'Svg']\n\nexport interface Options {\n  width: number | string\n  height: number | string\n}\n\nconst getValue = (raw: undefined | number | string) => {\n  if (raw === undefined) return t.stringLiteral('1em')\n  switch (typeof raw) {\n    case 'number':\n      return t.jsxExpressionContainer(t.numericLiteral(raw))\n    case 'string':\n      return t.stringLiteral(raw)\n    default:\n      return t.stringLiteral('1em')\n  }\n}\n\nconst plugin = (_: ConfigAPI, opts: Options) => ({\n  visitor: {\n    JSXOpeningElement(path: NodePath<t.JSXOpeningElement>) {\n      if (\n        !elements.some((element) =>\n          path.get('name').isJSXIdentifier({ name: element }),\n        )\n      )\n        return\n\n      const values = {\n        width: getValue(opts.width),\n        height: getValue(opts.height),\n      }\n      const requiredAttributes = Object.keys(values)\n\n      path.get('attributes').forEach((attributePath) => {\n        if (!attributePath.isJSXAttribute()) return\n        const namePath = attributePath.get('name')\n        if (!namePath.isJSXIdentifier()) return\n        const index = requiredAttributes.indexOf(namePath.node.name)\n\n        if (index === -1) return\n\n        const valuePath = attributePath.get('value')\n        valuePath.replaceWith(values[namePath.node.name as 'width' | 'height'])\n        requiredAttributes.splice(index, 1)\n      })\n\n      path.pushContainer(\n        'attributes',\n        requiredAttributes.map((attr) =>\n          t.jsxAttribute(\n            t.jsxIdentifier(attr),\n            values[attr as 'width' | 'height'],\n          ),\n        ),\n      )\n    },\n  },\n})\n\nexport default plugin\n"
  },
  {
    "path": "packages/babel-plugin-svg-em-dimensions/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/.npmignore",
    "content": "src/\n.*\n/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n\n### Bug Fixes\n\n* **react-native:** fix duplicate import ([#894](https://github.com/gregberge/svgr/issues/894)) ([e612b6a](https://github.com/gregberge/svgr/commit/e612b6a1a4e822178f1e15b82bd2991bf1e84cec))\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-react-native-svg\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-react-native-svg\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-react-native-svg\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-react-native-svg\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n### Features\n\n- add `ForeignObject` support for react native ([#430](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/issues/430)) ([1b56b85](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/commit/1b56b851478803d40105ce63c70e457bd3183da6))\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Features\n\n- add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/commit/978db3e))\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/README.md",
    "content": "# @svgr/babel-plugin-transform-react-native-svg\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-transform-react-native-svg\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/babel-plugin-transform-react-native-svg\"]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-transform-react-native-svg\",\n  \"description\": \"Transform DOM elements into react-native-svg components\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-transform-react-native-svg\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin from '.'\n\nconst testPlugin = (code: string) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx', plugin],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('plugin', () => {\n  it('should transform elements', () => {\n    const code = testPlugin('<svg><div /></svg>')\n    expect(code).toMatchInlineSnapshot(`\"<Svg></Svg>;\"`)\n  })\n\n  it('should add import', () => {\n    const code = testPlugin(\n      `import Svg from 'react-native-svg'; <svg><g /><div /></svg>;`,\n    )\n    expect(code).toMatchInlineSnapshot(`\n      \"import Svg, { G } from 'react-native-svg';\n      /* SVGR has dropped some elements not supported by react-native-svg: div */\n      <Svg><G /></Svg>;\"\n    `)\n  })\n\n  it('should add deal with type imports properly', () => {\n    const code = transform(\n      `\n      import Svg from 'react-native-svg';\n      import type { SvgProps } from \"react-native-svg\";\n\n      const ComponentSvg = () => <svg><g /></svg>;\n    `,\n      {\n        plugins: [\n          '@babel/plugin-syntax-jsx',\n          ['@babel/plugin-syntax-typescript', { isTSX: true }],\n          plugin,\n        ],\n        configFile: false,\n      },\n    )?.code\n\n    expect(code).toMatchInlineSnapshot(`\n      \"import Svg, { G } from 'react-native-svg';\n      import type { SvgProps } from \"react-native-svg\";\n      const ComponentSvg = () => <Svg><G /></Svg>;\"\n    `)\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { NodePath, types as t } from '@babel/core'\n\ninterface State {\n  replacedComponents: Set<string>\n  unsupportedComponents: Set<string>\n}\n\nconst elementToComponent: { [key: string]: string } = {\n  svg: 'Svg',\n  circle: 'Circle',\n  clipPath: 'ClipPath',\n  ellipse: 'Ellipse',\n  g: 'G',\n  linearGradient: 'LinearGradient',\n  radialGradient: 'RadialGradient',\n  line: 'Line',\n  path: 'Path',\n  pattern: 'Pattern',\n  polygon: 'Polygon',\n  polyline: 'Polyline',\n  rect: 'Rect',\n  symbol: 'Symbol',\n  text: 'Text',\n  textPath: 'TextPath',\n  tspan: 'TSpan',\n  use: 'Use',\n  defs: 'Defs',\n  stop: 'Stop',\n  mask: 'Mask',\n  image: 'Image',\n  foreignObject: 'ForeignObject',\n}\n\nconst plugin = () => {\n  function replaceElement(path: NodePath<t.JSXElement>, state: State) {\n    const namePath = path.get('openingElement').get('name')\n    if (!namePath.isJSXIdentifier()) return\n    const { name } = namePath.node\n\n    // Replace element by react-native-svg components\n    const component = elementToComponent[name]\n\n    if (component) {\n      namePath.replaceWith(t.jsxIdentifier(component))\n      if (path.has('closingElement')) {\n        const closingNamePath = path\n          .get('closingElement')\n          .get('name') as NodePath<t.JSXIdentifier>\n        closingNamePath.replaceWith(t.jsxIdentifier(component))\n      }\n      state.replacedComponents.add(component)\n      return\n    }\n\n    // Remove element if not supported\n    state.unsupportedComponents.add(name)\n    path.remove()\n  }\n\n  const svgElementVisitor = {\n    JSXElement(path: NodePath<t.JSXElement>, state: State) {\n      if (\n        !path.get('openingElement').get('name').isJSXIdentifier({ name: 'svg' })\n      ) {\n        return\n      }\n\n      replaceElement(path, state)\n      path.traverse(jsxElementVisitor, state)\n    },\n  }\n\n  const jsxElementVisitor = {\n    JSXElement(path: NodePath<t.JSXElement>, state: State) {\n      replaceElement(path, state)\n    },\n  }\n\n  const importDeclarationVisitor = {\n    ImportDeclaration(path: NodePath<t.ImportDeclaration>, state: State) {\n      const isNotTypeImport =\n        !path.get('importKind').hasNode() ||\n        path.node.importKind == null ||\n        path.node.importKind === 'value'\n      if (\n        path.get('source').isStringLiteral({ value: 'react-native-svg' }) &&\n        isNotTypeImport\n      ) {\n        state.replacedComponents.forEach((component) => {\n          if (\n            path\n              .get('specifiers')\n              .some((specifier) =>\n                specifier.get('local').isIdentifier({ name: component }),\n              )\n          ) {\n            return\n          }\n\n          path.pushContainer(\n            'specifiers',\n            t.importSpecifier(t.identifier(component), t.identifier(component)),\n          )\n        })\n      } else if (path.get('source').isStringLiteral({ value: 'expo' })) {\n        path.pushContainer(\n          'specifiers',\n          t.importSpecifier(t.identifier('Svg'), t.identifier('Svg')),\n        )\n      } else {\n        return\n      }\n\n      if (state.unsupportedComponents.size && !path.has('trailingComments')) {\n        const componentList = [...state.unsupportedComponents].join(', ')\n        path.addComment(\n          'trailing',\n          ` SVGR has dropped some elements not supported by react-native-svg: ${componentList} `,\n        )\n      }\n    },\n  }\n\n  return {\n    visitor: {\n      Program(path: NodePath<t.Program>, state: Partial<State>) {\n        state.replacedComponents = new Set()\n        state.unsupportedComponents = new Set()\n\n        path.traverse(svgElementVisitor, state as State)\n        path.traverse(importDeclarationVisitor, state as State)\n      },\n    },\n  }\n}\n\nexport default plugin\n"
  },
  {
    "path": "packages/babel-plugin-transform-react-native-svg/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n\n### Features\n\n* **types:** change `SVGProps` from import to import type ([#853](https://github.com/gregberge/svgr/issues/853)) ([095f021](https://github.com/gregberge/svgr/commit/095f0216288ccb5b96a75f154fe3aead074bfa99))\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* allow specifying `jsxRuntimeImport` in config ([86bb86f](https://github.com/gregberge/svgr/commit/86bb86f47748618f729742e56199355d9c0bc518)), closes [#801](https://github.com/gregberge/svgr/issues/801) [#801](https://github.com/gregberge/svgr/issues/801)\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-svg-component\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-svg-component\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n### Features\n\n- support comments in templates ([#661](https://github.com/gregberge/svgr/issues/661)) ([9afb590](https://github.com/gregberge/svgr/commit/9afb590d1094793fca797449fb7017da9fa06b4e))\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n### Bug Fixes\n\n- fix previous export system ([1872829](https://github.com/gregberge/svgr/commit/187282977af841cd5a2243a23abba72b20eec2fa)), closes [#635](https://github.com/gregberge/svgr/issues/635)\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- **typescript:** fix react-native support [#465](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/465) ([#488](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/488)) ([d61e0cf](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/d61e0cface065afc1478fdb44d87ca8177041eab))\n\n### Features\n\n- allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/16a58d6e817c065f72a68be91600a1a360205f44))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n### Bug Fixes\n\n- wrap svg component directly with memo/forwardRef ([#440](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/440)) ([#441](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/441)) ([a6de2da](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/a6de2dacb63e36572a2167b928418bdc39f3a9c2))\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n### Bug Fixes\n\n- fix typescript types (ref, title) ([#419](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/419)) ([6e7e6b2](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/6e7e6b2e73d26d30f64604e0fc627f9ff94079c2))\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n### Features\n\n- add typescript option ([4596d7b](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/4596d7bb470babb5ec4b87f5281174fb182bd9c7)), closes [#373](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/373)\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-svg-component\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Features\n\n- add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/978db3e))\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n**Note:** Version bump only for package @svgr/babel-plugin-transform-svg-component\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n### Bug Fixes\n\n- **babel-plugin-transform-svg:** support template that only return a single node ([80ac40f](https://github.com/gregberge/svgr/commit/80ac40f)), closes [#223](https://github.com/gregberge/svgr/issues/223)\n- **babel-plugin-transform-svg-component:** parsing error of JSX template exports defs ([#225](https://github.com/gregberge/svgr/issues/225)) ([1e56309](https://github.com/gregberge/svgr/commit/1e56309)), closes [/github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js#L61](https://github.com//github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js/issues/L61)\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/README.md",
    "content": "# @svgr/babel-plugin-transform-svg-component\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-plugin-transform-svg-component\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\n    [\"@svgr/babel-plugin-transform-svg-component\", { \"titleProp\": true }]\n  ]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-plugin-transform-svg-component\",\n  \"description\": \"Transform SVG into component\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-plugin-transform-svg-component\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=12\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"devDependencies\": {\n    \"@types/babel__template\": \"^7.4.1\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/src/__snapshots__/index.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`plugin javascript #jsxRuntime allows to specify a custom \"classic\" jsxRuntime using \"defaultSpecifier\" 1`] = `\n\"import h from \"hyperapp-jsx-pragma\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript #jsxRuntime allows to specify a custom \"classic\" jsxRuntime using \"namespace\" 1`] = `\n\"import * as Preact from \"preact\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript #jsxRuntime allows to specify a custom \"classic\" jsxRuntime using \"specifiers\" 1`] = `\n\"import { h } from \"preact\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript #jsxRuntime supports \"automatic\" jsxRuntime 1`] = `\n\"const SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript #jsxRuntime supports \"classic\" jsxRuntime 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript allows to specify a different import source 1`] = `\n\"import { h } from \"preact\";\nimport { forwardRef, memo } from \"preact/compat\";\nconst SvgComponent = (_, ref) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nconst Memo = memo(ForwardRef);\nexport default Memo;\"\n`;\n\nexports[`plugin javascript custom templates support basic template 1`] = `\n\"import * as React from 'react';\nconst MyComponent = () => <svg><g /></svg>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin javascript custom templates supports JSX template 1`] = `\n\"import * as React from 'react';\nconst MyComponent = () => <main>{<svg><g /></svg>}</main>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin javascript custom templates supports TypeScript template 1`] = `\n\"import * as React from 'react';\nconst MyComponent = (props: React.SVGProps<SVGSVGElement>) => <svg><g /></svg>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin javascript custom templates supports comments in templates 1`] = `\n\"/**\n * Comment\n */\nconst MyComponent = () => <svg><g /></svg>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin javascript custom templates supports template that does not return an array 1`] = `\"<svg><g /></svg>;\"`;\n\nexports[`plugin javascript custom templates supports type annotation on component 1`] = `\n\"import * as React from \"react\";\ninterface Props {\n  x?: string;\n}\nexport const SvgComponent:React.FC<Props> = ({\n  x\n}) => {\n  return <svg><g /></svg>;\n};\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript transforms whole program 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"descProp\" adds \"desc\" and \"descId\" prop 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = ({\n  desc,\n  descId\n}) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"descProp\" and \"expandProps\" adds \"desc\", \"descId\" props and expands props 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = ({\n  desc,\n  descId,\n  ...props\n}) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"expandProps\" add props 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = props => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"memo\" option wrap component in \"React.memo\" 1`] = `\n\"import * as React from \"react\";\nimport { memo } from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nconst Memo = memo(SvgComponent);\nexport default Memo;\"\n`;\n\nexports[`plugin javascript with \"namedExport\" and \"exportType\" option and without \"previousExport\" state exports via named export 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport { SvgComponent as ReactComponent };\"\n`;\n\nexports[`plugin javascript with \"namedExport\" option and \"previousExport\" state has custom named export 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport { SvgComponent as Component };\nvar img = new Image();\nimg.src = '...';\nexport default img;\"\n`;\n\nexports[`plugin javascript with \"native\" and \"expandProps\" option adds import from \"react-native-svg\" and adds props 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nconst SvgComponent = props => <Svg><g /></Svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"native\" option adds import from \"react-native-svg\" 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nconst SvgComponent = () => <Svg><g /></Svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"native\", \"ref\" and \"expandProps\" option adds import from \"react-native-svg\" and adds props and adds ForwardRef component 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nimport { forwardRef } from \"react\";\nconst SvgComponent = (props, ref) => <Svg><g /></Svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin javascript with \"native\", \"ref\" option adds import from \"react-native-svg\" and adds ForwardRef component 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nimport { forwardRef } from \"react\";\nconst SvgComponent = (_, ref) => <Svg><g /></Svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin javascript with \"ref\" and \"expandProps\" option expands props 1`] = `\n\"import * as React from \"react\";\nimport { forwardRef } from \"react\";\nconst SvgComponent = (props, ref) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin javascript with \"ref\" option adds ForwardRef component 1`] = `\n\"import * as React from \"react\";\nimport { forwardRef } from \"react\";\nconst SvgComponent = (_, ref) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin javascript with \"titleProp\" \"descProp\" and \"expandProps\" adds \"title\", \"titleId\", \"desc\", \"descId\" props and expands props 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = ({\n  title,\n  titleId,\n  desc,\n  descId,\n  ...props\n}) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"titleProp\" adds \"title\" and \"titleId\" prop 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = ({\n  title,\n  titleId\n}) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"titleProp\" and \"descProp\" adds \"title\", \"titleId\", \"desc\", and \"descId prop 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = ({\n  title,\n  titleId,\n  desc,\n  descId\n}) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with \"titleProp\" and \"expandProps\" adds \"title\", \"titleId\" props and expands props 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = ({\n  title,\n  titleId,\n  ...props\n}) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin javascript with both \"memo\" and \"ref\" option wrap component in \"React.memo\" and \"React.forwardRef\" 1`] = `\n\"import * as React from \"react\";\nimport { forwardRef, memo } from \"react\";\nconst SvgComponent = (_, ref) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nconst Memo = memo(ForwardRef);\nexport default Memo;\"\n`;\n\nexports[`plugin typescript #jsxRuntime allows to specify a custom \"classic\" jsxRuntime using \"defaultSpecifier\" 1`] = `\n\"import h from \"hyperapp-jsx-pragma\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript #jsxRuntime allows to specify a custom \"classic\" jsxRuntime using \"namespace\" 1`] = `\n\"import * as Preact from \"preact\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript #jsxRuntime allows to specify a custom \"classic\" jsxRuntime using \"specifiers\" 1`] = `\n\"import { h } from \"preact\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript #jsxRuntime supports \"automatic\" jsxRuntime 1`] = `\n\"const SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript #jsxRuntime supports \"classic\" jsxRuntime 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript allows to specify a different import source 1`] = `\n\"import { h } from \"preact\";\nimport { Ref, forwardRef, memo } from \"preact/compat\";\nconst SvgComponent = (_, ref: Ref<SVGSVGElement>) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nconst Memo = memo(ForwardRef);\nexport default Memo;\"\n`;\n\nexports[`plugin typescript custom templates support basic template 1`] = `\n\"import * as React from 'react';\nconst MyComponent = () => <svg><g /></svg>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin typescript custom templates supports JSX template 1`] = `\n\"import * as React from 'react';\nconst MyComponent = () => <main>{<svg><g /></svg>}</main>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin typescript custom templates supports TypeScript template 1`] = `\n\"import * as React from 'react';\nconst MyComponent = (props: React.SVGProps<SVGSVGElement>) => <svg><g /></svg>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin typescript custom templates supports comments in templates 1`] = `\n\"/**\n * Comment\n */\nconst MyComponent = () => <svg><g /></svg>;\nexport default MyComponent;\"\n`;\n\nexports[`plugin typescript custom templates supports template that does not return an array 1`] = `\"<svg><g /></svg>;\"`;\n\nexports[`plugin typescript custom templates supports type annotation on component 1`] = `\n\"import * as React from \"react\";\ninterface Props {\n  x?: string;\n}\nexport const SvgComponent:React.FC<Props> = ({\n  x\n}) => {\n  return <svg><g /></svg>;\n};\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript transforms whole program 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"descProp\" adds \"desc\" and \"descId\" prop 1`] = `\n\"import * as React from \"react\";\ninterface SVGRProps {\n  desc?: string;\n  descId?: string;\n}\nconst SvgComponent = ({\n  desc,\n  descId\n}: SVGRProps) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"descProp\" and \"expandProps\" adds \"desc\", \"descId\" props and expands props 1`] = `\n\"import * as React from \"react\";\nimport type { SVGProps } from \"react\";\ninterface SVGRProps {\n  desc?: string;\n  descId?: string;\n}\nconst SvgComponent = ({\n  desc,\n  descId,\n  ...props\n}: SVGProps<SVGSVGElement> & SVGRProps) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"expandProps\" add props 1`] = `\n\"import * as React from \"react\";\nimport type { SVGProps } from \"react\";\nconst SvgComponent = (props: SVGProps<SVGSVGElement>) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"memo\" option wrap component in \"React.memo\" 1`] = `\n\"import * as React from \"react\";\nimport { memo } from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nconst Memo = memo(SvgComponent);\nexport default Memo;\"\n`;\n\nexports[`plugin typescript with \"namedExport\" and \"exportType\" option and without \"previousExport\" state exports via named export 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport { SvgComponent as ReactComponent };\"\n`;\n\nexports[`plugin typescript with \"namedExport\" option and \"previousExport\" state has custom named export 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = () => <svg><g /></svg>;\nexport { SvgComponent as Component };\nvar img = new Image();\nimg.src = '...';\nexport default img;\"\n`;\n\nexports[`plugin typescript with \"native\" and \"expandProps\" option adds import from \"react-native-svg\" and adds props 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nimport type { SvgProps } from \"react-native-svg\";\nconst SvgComponent = (props: SvgProps) => <Svg><g /></Svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"native\" option adds import from \"react-native-svg\" 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nconst SvgComponent = () => <Svg><g /></Svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"native\", \"ref\" and \"expandProps\" option adds import from \"react-native-svg\" and adds props and adds ForwardRef component 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nimport type { SvgProps } from \"react-native-svg\";\nimport { Ref, forwardRef } from \"react\";\nconst SvgComponent = (props: SvgProps, ref: Ref<SVGSVGElement>) => <Svg><g /></Svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin typescript with \"native\", \"ref\" option adds import from \"react-native-svg\" and adds ForwardRef component 1`] = `\n\"import * as React from \"react\";\nimport Svg from \"react-native-svg\";\nimport { Ref, forwardRef } from \"react\";\nconst SvgComponent = (_, ref: Ref<SVGSVGElement>) => <Svg><g /></Svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin typescript with \"ref\" and \"expandProps\" option expands props 1`] = `\n\"import * as React from \"react\";\nimport type { SVGProps } from \"react\";\nimport { Ref, forwardRef } from \"react\";\nconst SvgComponent = (props: SVGProps<SVGSVGElement>, ref: Ref<SVGSVGElement>) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin typescript with \"ref\" option adds ForwardRef component 1`] = `\n\"import * as React from \"react\";\nimport { Ref, forwardRef } from \"react\";\nconst SvgComponent = (_, ref: Ref<SVGSVGElement>) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nexport default ForwardRef;\"\n`;\n\nexports[`plugin typescript with \"titleProp\" \"descProp\" and \"expandProps\" adds \"title\", \"titleId\", \"desc\", \"descId\" props and expands props 1`] = `\n\"import * as React from \"react\";\nimport type { SVGProps } from \"react\";\ninterface SVGRProps {\n  title?: string;\n  titleId?: string;\n  desc?: string;\n  descId?: string;\n}\nconst SvgComponent = ({\n  title,\n  titleId,\n  desc,\n  descId,\n  ...props\n}: SVGProps<SVGSVGElement> & SVGRProps) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"titleProp\" adds \"title\" and \"titleId\" prop 1`] = `\n\"import * as React from \"react\";\ninterface SVGRProps {\n  title?: string;\n  titleId?: string;\n}\nconst SvgComponent = ({\n  title,\n  titleId\n}: SVGRProps) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"titleProp\" and \"descProp\" adds \"title\", \"titleId\", \"desc\", and \"descId prop 1`] = `\n\"import * as React from \"react\";\ninterface SVGRProps {\n  title?: string;\n  titleId?: string;\n  desc?: string;\n  descId?: string;\n}\nconst SvgComponent = ({\n  title,\n  titleId,\n  desc,\n  descId\n}: SVGRProps) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with \"titleProp\" and \"expandProps\" adds \"title\", \"titleId\" props and expands props 1`] = `\n\"import * as React from \"react\";\nimport type { SVGProps } from \"react\";\ninterface SVGRProps {\n  title?: string;\n  titleId?: string;\n}\nconst SvgComponent = ({\n  title,\n  titleId,\n  ...props\n}: SVGProps<SVGSVGElement> & SVGRProps) => <svg><g /></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`plugin typescript with both \"memo\" and \"ref\" option wrap component in \"React.memo\" and \"React.forwardRef\" 1`] = `\n\"import * as React from \"react\";\nimport { Ref, forwardRef, memo } from \"react\";\nconst SvgComponent = (_, ref: Ref<SVGSVGElement>) => <svg><g /></svg>;\nconst ForwardRef = forwardRef(SvgComponent);\nconst Memo = memo(ForwardRef);\nexport default Memo;\"\n`;\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/src/defaultTemplate.ts",
    "content": "import type { Template } from './types'\n\nexport const defaultTemplate: Template = (variables, { tpl }) => {\n  return tpl`\n${variables.imports};\n\n${variables.interfaces};\n\nconst ${variables.componentName} = (${variables.props}) => (\n  ${variables.jsx}\n);\n \n${variables.exports};\n`\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport plugin, { Options } from '.'\n\nconst defaultOptions = {\n  namedExport: 'ReactComponent',\n  state: { componentName: 'SvgComponent' },\n}\n\nconst testPlugin =\n  (language: string) =>\n  (code: string, options: Partial<Options> = {}) => {\n    const result = transform(code, {\n      plugins: [\n        '@babel/plugin-syntax-jsx',\n        [\n          plugin,\n          {\n            typescript: language === 'typescript',\n            ...defaultOptions,\n            ...options,\n          },\n        ],\n      ],\n      configFile: false,\n    })\n\n    if (!result) {\n      throw new Error(`No result`)\n    }\n\n    return result\n  }\n\ndescribe('plugin', () => {\n  describe.each(['javascript', 'typescript'])('%s', (language) => {\n    it('transforms whole program', () => {\n      const { code } = testPlugin(language)('<svg><g /></svg>')\n      expect(code).toMatchSnapshot()\n    })\n\n    describe('with \"native\" option', () => {\n      it('adds import from \"react-native-svg\"', () => {\n        const { code } = testPlugin(language)('<Svg><g /></Svg>', {\n          native: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"ref\" option', () => {\n      it('adds ForwardRef component', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          ref: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"titleProp\"', () => {\n      it('adds \"title\" and \"titleId\" prop', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          titleProp: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"titleProp\" and \"expandProps\"', () => {\n      it('adds \"title\", \"titleId\" props and expands props', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          ...defaultOptions,\n          expandProps: true,\n          titleProp: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"descProp\"', () => {\n      it('adds \"desc\" and \"descId\" prop', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          descProp: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"descProp\" and \"expandProps\"', () => {\n      it('adds \"desc\", \"descId\" props and expands props', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          ...defaultOptions,\n          expandProps: true,\n          descProp: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"titleProp\" and \"descProp\"', () => {\n      it('adds \"title\", \"titleId\", \"desc\", and \"descId prop', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          titleProp: true,\n          descProp: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"titleProp\" \"descProp\" and \"expandProps\"', () => {\n      it('adds \"title\", \"titleId\", \"desc\", \"descId\" props and expands props', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          ...defaultOptions,\n          expandProps: true,\n          titleProp: true,\n          descProp: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"expandProps\"', () => {\n      it('add props', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          ...defaultOptions,\n          state: { componentName: 'SvgComponent' },\n          expandProps: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"ref\" and \"expandProps\" option', () => {\n      it('expands props', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          state: { componentName: 'SvgComponent' },\n          expandProps: true,\n          ref: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"native\", \"ref\" option', () => {\n      it('adds import from \"react-native-svg\" and adds ForwardRef component', () => {\n        const { code } = testPlugin(language)('<Svg><g /></Svg>', {\n          state: { componentName: 'SvgComponent' },\n          native: true,\n          ref: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"native\" and \"expandProps\" option', () => {\n      it('adds import from \"react-native-svg\" and adds props', () => {\n        const { code } = testPlugin(language)('<Svg><g /></Svg>', {\n          state: { componentName: 'SvgComponent' },\n          native: true,\n          expandProps: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"native\", \"ref\" and \"expandProps\" option', () => {\n      it('adds import from \"react-native-svg\" and adds props and adds ForwardRef component', () => {\n        const { code } = testPlugin(language)('<Svg><g /></Svg>', {\n          state: { componentName: 'SvgComponent' },\n          native: true,\n          expandProps: true,\n          ref: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"memo\" option', () => {\n      it('wrap component in \"React.memo\"', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          state: { componentName: 'SvgComponent' },\n          memo: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with both \"memo\" and \"ref\" option', () => {\n      it('wrap component in \"React.memo\" and \"React.forwardRef\"', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          state: { componentName: 'SvgComponent' },\n          memo: true,\n          ref: true,\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"namedExport\" option and \"previousExport\" state', () => {\n      it('has custom named export', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          state: {\n            componentName: 'SvgComponent',\n            caller: {\n              previousExport: `var img = new Image(); img.src = '...'; export default img;`,\n            },\n          },\n          namedExport: 'Component',\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('with \"namedExport\" and \"exportType\" option and without \"previousExport\" state', () => {\n      it('exports via named export', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          state: {\n            componentName: 'SvgComponent',\n            caller: { previousExport: null },\n          },\n          namedExport: 'ReactComponent',\n          exportType: 'named',\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('custom templates', () => {\n      it('support basic template', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          template: ({ jsx }, { tpl }) => tpl`import * as React from 'react';\n          const MyComponent = () => ${jsx}\n          export default MyComponent\n        `,\n          state: { componentName: 'SvgComponent' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('supports JSX template', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          template: ({ jsx }, { tpl }) => {\n            return tpl`import * as React from 'react';\n            const MyComponent = () => <main>{${jsx}}</main>\n            export default MyComponent\n          `\n          },\n          state: { componentName: 'SvgComponent' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('supports TypeScript template', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          template: ({ jsx }, { tpl }) => {\n            return tpl`\n              import * as React from 'react';\n              const MyComponent = (props: React.SVGProps<SVGSVGElement>) => ${jsx};\n              export default MyComponent;\n            `\n          },\n          typescript: true,\n          state: { componentName: 'SvgComponent' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('supports template that does not return an array', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          template: ({ jsx }, { tpl }) => tpl`${jsx}`,\n          state: { componentName: 'SvgComponent' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('supports type annotation on component', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          typescript: true,\n          template: (\n            { jsx, imports, interfaces, componentName, exports },\n            { tpl },\n          ) => tpl`\n          ${imports}\n          ${interfaces}\n          interface Props { x?: string }\n          export const ${`${componentName}:React.FC<Props>`} = ({ x }) => {\n            return (${jsx});\n          }\n          ${exports}`,\n          state: { componentName: 'SvgComponent' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('supports comments in templates', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          template: ({ jsx }, { tpl }) => tpl`\n          /**\n           * Comment\n           */\n          const MyComponent = () => ${jsx}\n\n          export default MyComponent;\n          `,\n          state: { componentName: 'SvgComponent' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n    })\n\n    describe('#jsxRuntime', () => {\n      it('supports \"automatic\" jsxRuntime', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          jsxRuntime: 'automatic',\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('supports \"classic\" jsxRuntime', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          jsxRuntime: 'classic',\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('allows to specify a custom \"classic\" jsxRuntime using \"specifiers\"', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          jsxRuntime: 'classic',\n          jsxRuntimeImport: { specifiers: ['h'], source: 'preact' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('allows to specify a custom \"classic\" jsxRuntime using \"namespace\"', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          jsxRuntime: 'classic',\n          jsxRuntimeImport: { namespace: 'Preact', source: 'preact' },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('allows to specify a custom \"classic\" jsxRuntime using \"defaultSpecifier\"', () => {\n        const { code } = testPlugin(language)('<svg><g /></svg>', {\n          jsxRuntime: 'classic',\n          jsxRuntimeImport: {\n            defaultSpecifier: 'h',\n            source: 'hyperapp-jsx-pragma',\n          },\n        })\n        expect(code).toMatchSnapshot()\n      })\n\n      it('throws with invalid configuration', () => {\n        expect(() => {\n          testPlugin(language)('<svg><g /></svg>', {\n            jsxRuntime: 'classic',\n            jsxRuntimeImport: { source: 'preact' },\n          })\n        }).toThrow(\n          'Specify \"namespace\", \"defaultSpecifier\", or \"specifiers\" in \"jsxRuntimeImport\" option',\n        )\n      })\n    })\n\n    it('allows to specify a different import source', () => {\n      const { code } = testPlugin(language)('<svg><g /></svg>', {\n        memo: true,\n        ref: true,\n        importSource: 'preact/compat',\n        jsxRuntimeImport: { specifiers: ['h'], source: 'preact' },\n      })\n      expect(code).toMatchSnapshot()\n    })\n  })\n})\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport {\n  ConfigAPI,\n  NodePath,\n  types as t,\n  template as babelTemplate,\n  ParserOptions,\n} from '@babel/core'\nimport type { Options } from './types'\nimport { defaultTemplate } from './defaultTemplate'\nimport { getVariables } from './variables'\n\nexport type { Options, Template } from './types'\n\nconst plugin = (_: ConfigAPI, opts: Options) => {\n  const template = opts.template || defaultTemplate\n  const plugins: ParserOptions['plugins'] = opts.typescript\n    ? ['jsx', 'typescript']\n    : ['jsx']\n  const tpl = babelTemplate.smart({ plugins, preserveComments: true }).ast\n  return {\n    visitor: {\n      Program(path: NodePath<t.Program>) {\n        const jsx = (path.node.body[0] as t.ExpressionStatement)\n          .expression as t.JSXElement\n        const variables = getVariables({\n          opts,\n          jsx,\n        })\n        const body = template(variables, { options: opts, tpl })\n        path.node.body = Array.isArray(body) ? body : [body]\n        path.replaceWith(path.node)\n      },\n    },\n  }\n}\n\nexport default plugin\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/src/types.ts",
    "content": "import type { types as t } from '@babel/core'\nimport type { TemplateBuilder } from '@babel/template'\n\nexport interface TemplateVariables {\n  componentName: string\n  interfaces: t.TSInterfaceDeclaration[]\n  props: (t.ObjectPattern | t.Identifier)[]\n  imports: t.ImportDeclaration[]\n  exports: (t.VariableDeclaration | t.ExportDeclaration | t.Statement)[]\n  jsx: t.JSXElement\n}\n\ninterface TemplateContext {\n  options: Options\n  tpl: TemplateBuilder<t.Statement | t.Statement[]>['ast']\n}\n\nexport interface Template {\n  (variables: TemplateVariables, context: TemplateContext):\n    | t.Statement\n    | t.Statement[]\n}\n\ninterface State {\n  componentName: string\n  caller?: { previousExport?: string | null }\n}\n\nexport interface JSXRuntimeImport {\n  source: string\n  namespace?: string\n  defaultSpecifier?: string\n  specifiers?: string[]\n}\n\nexport interface Options {\n  typescript?: boolean\n  titleProp?: boolean\n  descProp?: boolean\n  expandProps?: boolean | 'start' | 'end'\n  ref?: boolean\n  template?: Template\n  state: State\n  native?: boolean\n  memo?: boolean\n  exportType?: 'named' | 'default'\n  namedExport?: string\n  jsxRuntime?: 'automatic' | 'classic'\n  jsxRuntimeImport?: JSXRuntimeImport\n  importSource?: string\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/src/variables.ts",
    "content": "import { types as t, template } from '@babel/core'\nimport type { Options, TemplateVariables, JSXRuntimeImport } from './types'\nimport type { ImportDeclaration } from '@babel/types'\n\nconst tsOptionalPropertySignature = (\n  ...args: Parameters<typeof t.tsPropertySignature>\n) => {\n  return {\n    ...t.tsPropertySignature(...args),\n    optional: true,\n  } as t.TSPropertySignature\n}\n\ninterface Context {\n  opts: Options\n  interfaces: t.TSInterfaceDeclaration[]\n  props: (t.Identifier | t.ObjectPattern)[]\n  imports: t.ImportDeclaration[]\n  importSource: string\n}\n\nconst getOrCreateImport = (\n  { imports }: Context,\n  sourceValue: string,\n  importKind: ImportDeclaration['importKind'] = undefined,\n) => {\n  const existing = imports.find(\n    (imp) =>\n      imp.source.value === sourceValue &&\n      imp.importKind === importKind &&\n      !imp.specifiers.some(\n        (specifier) => specifier.type === 'ImportNamespaceSpecifier',\n      ),\n  )\n  if (existing) return existing\n  const imp = t.importDeclaration([], t.stringLiteral(sourceValue))\n  if (importKind !== undefined) {\n    imp.importKind = importKind\n  }\n  imports.push(imp)\n  return imp\n}\n\nconst tsTypeReferenceSVGProps = (ctx: Context) => {\n  if (ctx.opts.native) {\n    const identifier = t.identifier('SvgProps')\n    getOrCreateImport(ctx, 'react-native-svg', 'type').specifiers.push(\n      t.importSpecifier(identifier, identifier),\n    )\n    return t.tsTypeReference(identifier)\n  }\n  const identifier = t.identifier('SVGProps')\n  getOrCreateImport(ctx, ctx.importSource, 'type').specifiers.push(\n    t.importSpecifier(identifier, identifier),\n  )\n  return t.tsTypeReference(\n    identifier,\n    t.tsTypeParameterInstantiation([\n      t.tsTypeReference(t.identifier('SVGSVGElement')),\n    ]),\n  )\n}\n\nconst tsTypeReferenceSVGRef = (ctx: Context) => {\n  const identifier = t.identifier('Ref')\n  getOrCreateImport(ctx, ctx.importSource).specifiers.push(\n    t.importSpecifier(identifier, identifier),\n  )\n  return t.tsTypeReference(\n    identifier,\n    t.tsTypeParameterInstantiation([\n      t.tsTypeReference(t.identifier('SVGSVGElement')),\n    ]),\n  )\n}\n\nconst getJsxRuntimeImport = (cfg: JSXRuntimeImport) => {\n  const specifiers = (() => {\n    if (cfg.namespace)\n      return [t.importNamespaceSpecifier(t.identifier(cfg.namespace))]\n    if (cfg.defaultSpecifier) {\n      const identifier = t.identifier(cfg.defaultSpecifier)\n      return [t.importDefaultSpecifier(identifier)]\n    }\n    if (cfg.specifiers)\n      return cfg.specifiers.map((specifier) => {\n        const identifier = t.identifier(specifier)\n        return t.importSpecifier(identifier, identifier)\n      })\n    throw new Error(\n      `Specify \"namespace\", \"defaultSpecifier\", or \"specifiers\" in \"jsxRuntimeImport\" option`,\n    )\n  })()\n  return t.importDeclaration(specifiers, t.stringLiteral(cfg.source))\n}\n\nconst defaultJsxRuntimeImport: JSXRuntimeImport = {\n  source: 'react',\n  namespace: 'React',\n}\n\nconst defaultImportSource = 'react'\n\nexport const getVariables = ({\n  opts,\n  jsx,\n}: {\n  opts: Options\n  jsx: t.JSXElement\n}): TemplateVariables => {\n  const interfaces: t.TSInterfaceDeclaration[] = []\n  const props: (t.Identifier | t.ObjectPattern)[] = []\n  const imports: t.ImportDeclaration[] = []\n  const exports: (t.VariableDeclaration | t.ExportDeclaration | t.Statement)[] =\n    []\n  const ctx = {\n    importSource: opts.importSource ?? defaultImportSource,\n    exportIdentifier: t.identifier(opts.state.componentName),\n    opts,\n    interfaces,\n    props,\n    imports,\n    exports,\n  }\n\n  if (opts.jsxRuntime !== 'automatic') {\n    imports.push(\n      getJsxRuntimeImport(opts.jsxRuntimeImport ?? defaultJsxRuntimeImport),\n    )\n  }\n\n  if (opts.native) {\n    getOrCreateImport(ctx, 'react-native-svg').specifiers.push(\n      t.importDefaultSpecifier(t.identifier('Svg')),\n    )\n  }\n\n  if (opts.titleProp || opts.descProp) {\n    const properties = []\n    const propertySignatures = []\n    const createProperty = (attr: string) => {\n      return t.objectProperty(\n        t.identifier(attr),\n        t.identifier(attr),\n        false,\n        true,\n      )\n    }\n    const createSignature = (attr: string) => {\n      return tsOptionalPropertySignature(\n        t.identifier(attr),\n        t.tsTypeAnnotation(t.tsStringKeyword()),\n      )\n    }\n\n    if (opts.titleProp) {\n      properties.push(createProperty('title'), createProperty('titleId'))\n\n      if (opts.typescript) {\n        propertySignatures.push(\n          createSignature('title'),\n          createSignature('titleId'),\n        )\n      }\n    }\n\n    if (opts.descProp) {\n      properties.push(createProperty('desc'), createProperty('descId'))\n\n      if (opts.typescript) {\n        propertySignatures.push(\n          createSignature('desc'),\n          createSignature('descId'),\n        )\n      }\n    }\n\n    const prop = t.objectPattern(properties)\n    props.push(prop)\n    if (opts.typescript) {\n      interfaces.push(\n        t.tsInterfaceDeclaration(\n          t.identifier('SVGRProps'),\n          null,\n          null,\n          t.tSInterfaceBody(propertySignatures),\n        ),\n      )\n      prop.typeAnnotation = t.tsTypeAnnotation(\n        t.tsTypeReference(t.identifier('SVGRProps')),\n      )\n    }\n  }\n\n  if (opts.expandProps) {\n    const identifier = t.identifier('props')\n    if (t.isObjectPattern(props[0])) {\n      props[0].properties.push(t.restElement(identifier))\n      if (opts.typescript) {\n        props[0].typeAnnotation = t.tsTypeAnnotation(\n          t.tsIntersectionType([\n            tsTypeReferenceSVGProps(ctx),\n            (props[0].typeAnnotation as t.TSTypeAnnotation).typeAnnotation,\n          ]),\n        )\n      }\n    } else {\n      props.push(identifier)\n      if (opts.typescript) {\n        identifier.typeAnnotation = t.tsTypeAnnotation(\n          tsTypeReferenceSVGProps(ctx),\n        )\n      }\n    }\n  }\n\n  if (opts.ref) {\n    if (props.length === 0) {\n      props.push(t.identifier('_'))\n    }\n    const prop = t.identifier('ref')\n    props.push(prop)\n    if (opts.typescript) {\n      prop.typeAnnotation = t.tsTypeAnnotation(tsTypeReferenceSVGRef(ctx))\n    }\n    const forwardRef = t.identifier('forwardRef')\n    const ForwardRef = t.identifier('ForwardRef')\n    getOrCreateImport(ctx, ctx.importSource).specifiers.push(\n      t.importSpecifier(forwardRef, forwardRef),\n    )\n    exports.push(\n      t.variableDeclaration('const', [\n        t.variableDeclarator(\n          ForwardRef,\n          t.callExpression(forwardRef, [ctx.exportIdentifier]),\n        ),\n      ]),\n    )\n    ctx.exportIdentifier = ForwardRef\n  }\n\n  if (opts.memo) {\n    const memo = t.identifier('memo')\n    const Memo = t.identifier('Memo')\n    getOrCreateImport(ctx, ctx.importSource).specifiers.push(\n      t.importSpecifier(memo, memo),\n    )\n    exports.push(\n      t.variableDeclaration('const', [\n        t.variableDeclarator(\n          Memo,\n          t.callExpression(memo, [ctx.exportIdentifier]),\n        ),\n      ]),\n    )\n    ctx.exportIdentifier = Memo\n  }\n\n  if (opts.state.caller?.previousExport || opts.exportType === 'named') {\n    if (!opts.namedExport) {\n      throw new Error(`\"namedExport\" not specified`)\n    }\n    exports.push(\n      t.exportNamedDeclaration(null, [\n        t.exportSpecifier(ctx.exportIdentifier, t.identifier(opts.namedExport)),\n      ]),\n    )\n    if (opts.state.caller?.previousExport) {\n      const previousExportAst = template.ast(opts.state.caller.previousExport)\n      exports.push(\n        ...(Array.isArray(previousExportAst)\n          ? previousExportAst\n          : [previousExportAst]),\n      )\n    }\n  } else {\n    exports.push(t.exportDefaultDeclaration(ctx.exportIdentifier))\n  }\n  return {\n    componentName: opts.state.componentName,\n    props,\n    interfaces,\n    imports,\n    exports,\n    jsx,\n  }\n}\n"
  },
  {
    "path": "packages/babel-plugin-transform-svg-component/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/babel-preset/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/babel-preset/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n### Features\n\n- **babel-preset:** fix 'role' attribute on svg element for react native ([#787](https://github.com/gregberge/svgr/issues/787)) ([35d85e0](https://github.com/gregberge/svgr/commit/35d85e069ebfef1b26ba181f443d9377a7bc003e))\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix duplicate plugin/preset detected error ([#747](https://github.com/gregberge/svgr/issues/747)) ([3c6a54c](https://github.com/gregberge/svgr/commit/3c6a54c494bb8ff15f332ff2d44e9f6465a6c19a)), closes [#746](https://github.com/gregberge/svgr/issues/746)\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n### Bug Fixes\n\n- **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/333)\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n### Bug Fixes\n\n- **titleProp:** handle the existing title case by using element instead of value (children) ([#315](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/315)) ([065e7a9](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/065e7a9))\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n### Features\n\n- titleProps fallbacks to svg's title ([#311](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/311)) ([8f92366](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/8f92366))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- **babel-preset:** expandProps + icon option ([ddfae22](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/ddfae22)), closes [#277](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/277)\n\n### Features\n\n- add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/978db3e))\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/babel-preset\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n- allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/babel-preset/README.md",
    "content": "# @svgr/babel-preset\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/babel-preset\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"presets\": [[\"@svgr/babel-preset\", { \"svgProps\": { \"width\": 200 } }]]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/babel-preset/package.json",
    "content": "{\n  \"name\": \"@svgr/babel-preset\",\n  \"description\": \"SVGR preset that apply transformations from config\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/babel-preset\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"babel-plugin\",\n    \"babel-preset\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"@svgr/babel-plugin-add-jsx-attribute\": \"workspace:*\",\n    \"@svgr/babel-plugin-remove-jsx-attribute\": \"workspace:*\",\n    \"@svgr/babel-plugin-remove-jsx-empty-expression\": \"workspace:*\",\n    \"@svgr/babel-plugin-replace-jsx-attribute-value\": \"workspace:*\",\n    \"@svgr/babel-plugin-svg-dynamic-title\": \"workspace:*\",\n    \"@svgr/babel-plugin-svg-em-dimensions\": \"workspace:*\",\n    \"@svgr/babel-plugin-transform-react-native-svg\": \"workspace:*\",\n    \"@svgr/babel-plugin-transform-svg-component\": \"workspace:*\"\n  },\n  \"peerDependencies\": {\n    \"@babel/core\": \"^7.0.0-0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  }\n}\n"
  },
  {
    "path": "packages/babel-preset/src/index.test.ts",
    "content": "import { transform } from '@babel/core'\nimport preset, { Options } from '.'\n\nconst defaultOptions = {\n  namedExport: 'ReactComponent',\n  state: { componentName: 'SvgComponent' },\n}\n\nconst testPreset = (code: string, options: Partial<Options>) => {\n  const result = transform(code, {\n    plugins: ['@babel/plugin-syntax-jsx'],\n    presets: [[preset, { ...defaultOptions, ...options }]],\n    configFile: false,\n  })\n\n  return result?.code\n}\n\ndescribe('preset', () => {\n  it('handles svgProps', () => {\n    expect(\n      testPreset('<svg />', {\n        svgProps: {\n          foo: 'bar',\n          x: '{y}',\n        },\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = () => <svg foo=\"bar\" x={y} />;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('handles titleProp', () => {\n    expect(\n      testPreset('<svg></svg>', {\n        titleProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        title,\n        titleId\n      }) => <svg aria-labelledby={titleId}>{title ? <title id={titleId}>{title}</title> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n  })\n  it('handles titleProp and fallback on existing title', () => {\n    // testing when existing title has string as chilren\n    expect(\n      testPreset(`<svg><title>Hello</title></svg>`, {\n        titleProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        title,\n        titleId\n      }) => <svg aria-labelledby={titleId}>{title === undefined ? <title id={titleId}>Hello</title> : title ? <title id={titleId}>{title}</title> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n    // testing when existing title has JSXExpression as children\n    expect(\n      testPreset(`<svg><title>{\"Hello\"}</title></svg>`, {\n        titleProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        title,\n        titleId\n      }) => <svg aria-labelledby={titleId}>{title === undefined ? <title id={titleId}>{\"Hello\"}</title> : title ? <title id={titleId}>{title}</title> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('handles descProp', () => {\n    expect(\n      testPreset('<svg></svg>', {\n        descProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        desc,\n        descId\n      }) => <svg aria-describedby={descId}>{desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n  })\n  it('handles descProp and fallback on existing desc', () => {\n    // testing when existing desc has string as chilren\n    expect(\n      testPreset(`<svg><desc>Hello</desc></svg>`, {\n        descProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        desc,\n        descId\n      }) => <svg aria-describedby={descId}>{desc === undefined ? <desc id={descId}>Hello</desc> : desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n    // testing when existing desc has JSXExpression as children\n    expect(\n      testPreset(`<svg><desc>{\"Hello\"}</desc></svg>`, {\n        descProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        desc,\n        descId\n      }) => <svg aria-describedby={descId}>{desc === undefined ? <desc id={descId}>{\"Hello\"}</desc> : desc ? <desc id={descId}>{desc}</desc> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('handles descProp and titleProp', () => {\n    expect(\n      testPreset('<svg></svg>', {\n        titleProp: true,\n        descProp: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = ({\n        title,\n        titleId,\n        desc,\n        descId\n      }) => <svg aria-labelledby={titleId} aria-describedby={descId}>{desc ? <desc id={descId}>{desc}</desc> : null}{title ? <title id={titleId}>{title}</title> : null}</svg>;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('handles replaceAttrValues', () => {\n    expect(\n      testPreset('<svg a=\"#000\" b=\"#fff\" />', {\n        replaceAttrValues: {\n          '#000': 'black',\n          '#fff': '{props.white}',\n        },\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = () => <svg a=\"black\" b={props.white} />;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('handles expandProps & icon & dimensions', () => {\n    expect(\n      testPreset('<svg a=\"#000\" b=\"#fff\" />', {\n        expandProps: 'end',\n        icon: true,\n        dimensions: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = props => <svg a=\"#000\" b=\"#fff\" width=\"1em\" height=\"1em\" {...props} />;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('handles custom icon size', () => {\n    expect(\n      testPreset('<svg a=\"#000\" b=\"#fff\" />', {\n        expandProps: 'end',\n        icon: 24,\n        dimensions: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = props => <svg a=\"#000\" b=\"#fff\" width={24} height={24} {...props} />;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('defaults to 24 on native', () => {\n    expect(\n      testPreset('<svg a=\"#000\" b=\"#fff\" />', {\n        expandProps: 'end',\n        icon: true,\n        native: true,\n        dimensions: true,\n      }),\n    ).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      import Svg from \"react-native-svg\";\n      const SvgComponent = props => <Svg a=\"#000\" b=\"#fff\" width={24} height={24} {...props} />;\n      export default SvgComponent;\"\n    `)\n  })\n})\n"
  },
  {
    "path": "packages/babel-preset/src/index.ts",
    "content": "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { ConfigAPI } from '@babel/core'\nimport addJSXAttribute, {\n  Attribute,\n} from '@svgr/babel-plugin-add-jsx-attribute'\nimport removeJSXAttribute from '@svgr/babel-plugin-remove-jsx-attribute'\nimport removeJSXEmptyExpression from '@svgr/babel-plugin-remove-jsx-empty-expression'\nimport replaceJSXAttributeValue, {\n  Value,\n} from '@svgr/babel-plugin-replace-jsx-attribute-value'\nimport svgDynamicTitle from '@svgr/babel-plugin-svg-dynamic-title'\nimport svgEmDimensions from '@svgr/babel-plugin-svg-em-dimensions'\nimport transformReactNativeSVG from '@svgr/babel-plugin-transform-react-native-svg'\nimport transformSvgComponent, {\n  Options as TransformOptions,\n} from '@svgr/babel-plugin-transform-svg-component'\n\nexport interface Options extends TransformOptions {\n  ref?: boolean\n  titleProp?: boolean\n  descProp?: boolean\n  expandProps?: boolean | 'start' | 'end'\n  dimensions?: boolean\n  icon?: boolean | string | number\n  native?: boolean\n  svgProps?: { [key: string]: string }\n  replaceAttrValues?: { [key: string]: string }\n}\n\nconst getAttributeValue = (value: string) => {\n  const literal =\n    typeof value === 'string' && value.startsWith('{') && value.endsWith('}')\n  return { value: literal ? value.slice(1, -1) : value, literal }\n}\n\nconst propsToAttributes = (props: { [key: string]: string }): Attribute[] => {\n  return Object.keys(props).map((name) => {\n    const { literal, value } = getAttributeValue(props[name])\n    return { name, literal, value }\n  })\n}\n\nfunction replaceMapToValues(replaceMap: { [key: string]: string }): Value[] {\n  return Object.keys(replaceMap).map((value) => {\n    const { literal, value: newValue } = getAttributeValue(replaceMap[value])\n    return { value, newValue, literal }\n  })\n}\n\nconst plugin = (_: ConfigAPI, opts: Options) => {\n  let toRemoveAttributes = ['version']\n  let toAddAttributes: Attribute[] = []\n\n  if (opts.svgProps) {\n    toAddAttributes = [...toAddAttributes, ...propsToAttributes(opts.svgProps)]\n  }\n\n  if (opts.ref) {\n    toAddAttributes = [\n      ...toAddAttributes,\n      {\n        name: 'ref',\n        value: 'ref',\n        literal: true,\n      },\n    ]\n  }\n\n  if (opts.titleProp) {\n    toAddAttributes = [\n      ...toAddAttributes,\n      {\n        name: 'aria-labelledby',\n        value: 'titleId',\n        literal: true,\n      },\n    ]\n  }\n\n  if (opts.descProp) {\n    toAddAttributes = [\n      ...toAddAttributes,\n      {\n        name: 'aria-describedby',\n        value: 'descId',\n        literal: true,\n      },\n    ]\n  }\n\n  if (opts.expandProps) {\n    toAddAttributes = [\n      ...toAddAttributes,\n      {\n        name: 'props',\n        spread: true,\n        position:\n          opts.expandProps === 'start' || opts.expandProps === 'end'\n            ? opts.expandProps\n            : undefined,\n      },\n    ]\n  }\n\n  if (!opts.dimensions) {\n    toRemoveAttributes = [...toRemoveAttributes, 'width', 'height']\n  }\n\n  const plugins: any[] = [\n    [transformSvgComponent, opts],\n    ...(opts.icon !== false && opts.dimensions\n      ? [\n          [\n            svgEmDimensions,\n            opts.icon !== true\n              ? { width: opts.icon, height: opts.icon }\n              : opts.native\n              ? { width: 24, height: 24 }\n              : {},\n          ],\n        ]\n      : []),\n    [\n      removeJSXAttribute,\n      { elements: ['svg', 'Svg'], attributes: toRemoveAttributes },\n    ],\n    [\n      addJSXAttribute,\n      { elements: ['svg', 'Svg'], attributes: toAddAttributes },\n    ],\n    removeJSXEmptyExpression,\n  ]\n\n  if (opts.replaceAttrValues) {\n    plugins.push([\n      replaceJSXAttributeValue,\n      { values: replaceMapToValues(opts.replaceAttrValues) },\n    ])\n  }\n\n  if (opts.titleProp) {\n    plugins.push(svgDynamicTitle)\n  }\n\n  if (opts.descProp) {\n    plugins.push([svgDynamicTitle, { tag: 'desc' }, 'desc'])\n  }\n\n  if (opts.native) {\n    plugins.push(transformReactNativeSVG)\n  }\n\n  return { plugins }\n}\n\nexport default plugin\n"
  },
  {
    "path": "packages/babel-preset/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/cli/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map\n!/bin/svgr"
  },
  {
    "path": "packages/cli/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n\n### Bug Fixes\n\n* **cli:** fix default dimensions, prettier & svgo ([571d5c8](https://github.com/gregberge/svgr/commit/571d5c8bd18bc13c12eeb27a9052fa065aeb012e))\n\n\n### Features\n\n* **esm:** add support for svgo.config.cjs ([#879](https://github.com/gregberge/svgr/issues/879)) ([ae91e2e](https://github.com/gregberge/svgr/commit/ae91e2eacbe1156480c96219b993000eb1e7b9bf))\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/cli\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n\n### Features\n\n* add snake_case filename option ([#857](https://github.com/gregberge/svgr/issues/857)) ([428b0c7](https://github.com/gregberge/svgr/commit/428b0c7f4c5205bb67ae3e9e7c7e819ec3fc03ba))\n* make index template more flexible ([#861](https://github.com/gregberge/svgr/issues/861)) ([003009c](https://github.com/gregberge/svgr/commit/003009c7b234cfe66686b629d3251edb8d46c759))\n* **types:** change `SVGProps` from import to import type ([#853](https://github.com/gregberge/svgr/issues/853)) ([095f021](https://github.com/gregberge/svgr/commit/095f0216288ccb5b96a75f154fe3aead074bfa99))\n\n\n### BREAKING CHANGES\n\n* index template now receives an array of objects containing both the created\ncomponent path (`path`) and the original SVG path (`originalPath`)\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* upgrade to svgo v3 ([#798](https://github.com/gregberge/svgr/issues/798)) ([21b6209](https://github.com/gregberge/svgr/commit/21b6209ef34c51cc0313901f31061afe587ab29b))\n\n\n### BREAKING CHANGES\n\n* svgr now requires Node.js v14+\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n- **cli:** output file name when error happen to handling a file ([#702](https://github.com/gregberge/svgr/issues/702)) ([0ec1fbd](https://github.com/gregberge/svgr/commit/0ec1fbd0bf1e020ecd8f53fba38d7e53d2462b27))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n### Bug Fixes\n\n- use .ts extension for generated index ([#670](https://github.com/gregberge/svgr/issues/670)) ([d19abe2](https://github.com/gregberge/svgr/commit/d19abe207013f4e880a78f236e9f75b0151258da)), closes [#462](https://github.com/gregberge/svgr/issues/462)\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n### Bug Fixes\n\n- **cli:** pass in parser to prettier format to avoid deprecation warning ([#662](https://github.com/gregberge/svgr/issues/662)) ([74fa3ae](https://github.com/gregberge/svgr/commit/74fa3aed2944b63797a6e0e786acd1b51f86550a))\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n**Note:** Version bump only for package @svgr/cli\n\n## [6.1.1](https://github.com/gregberge/svgr/compare/v6.1.0...v6.1.1) (2021-12-04)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- ensure a valid name for exports ([#489](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/489)) ([0eb8085](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/0eb80853e53a55226881f6ae3b50c1afe89f1cfc))\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n### Performance Improvements\n\n- **cli:** use fs.promises ([#459](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/459)) ([af294ac](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/af294ac3b86e7c39e78fc8b348110baf8c690949))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n### Bug Fixes\n\n- wrap svg component directly with memo/forwardRef ([#440](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/440)) ([#441](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/441)) ([a6de2da](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/a6de2dacb63e36572a2167b928418bdc39f3a9c2))\n- **cli:** fix index generation ([#443](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/443)) ([7c46ad7](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/7c46ad73695c42e6153761c931377d65b71835ea)), closes [#433](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/433)\n\n### Features\n\n- **cli:** make all CLI options available in config ([a23a186](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/a23a18675c0dd4a461d2fcbdc72a305cabd32a13)), closes [#431](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/431) [#437](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/437)\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n### Bug Fixes\n\n- fix typescript types (ref, title) ([#419](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/419)) ([6e7e6b2](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/6e7e6b2e73d26d30f64604e0fc627f9ff94079c2))\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n### Bug Fixes\n\n- **cli:** remove confusion between {keep,ignore}-existing ([#413](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/413)) ([c5430f9](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/c5430f97b053a7d2d85c85c56b87dfc8c9c1f09a)), closes [#390](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/390)\n\n### Features\n\n- add typescript option ([4596d7b](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/4596d7bb470babb5ec4b87f5281174fb182bd9c7)), closes [#373](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/373)\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [5.1.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.0.1...v5.1.0) (2020-01-20)\n\n### Features\n\n- add Svg prefix to exports that starts with a number ([#383](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/383)) ([fd120d1](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/fd120d11c81395353f300da487295b769f6b9501)), closes [#379](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/379)\n- allow to provide custom index.js template ([#378](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/378)) ([f734dda](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/f734ddac8e639ad213a3ce09689e46226fd5c1e0))\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n### Bug Fixes\n\n- **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/333)\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n**Note:** Version bump only for package @svgr/cli\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n### Features\n\n- **cli:** output relative destination paths ([#312](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/312)) ([b78e471](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/b78e471))\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/cli/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- keep viewBox when dimensions are removed ([#281](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/281)) ([f476c8e](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/f476c8e))\n- **cli:** fix kebab case transformation with \"\\_\" ([39c24c5](https://github.com/gregberge/svgr/tree/master/packages/cli/commit/39c24c5)), closes [#280](https://github.com/gregberge/svgr/tree/master/packages/cli/issues/280)\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n**Note:** Version bump only for package @svgr/cli\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n**Note:** Version bump only for package @svgr/cli\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/cli\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/cli\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Bug Fixes\n\n- **cli:** fix --out-dir usage with absolute path ([#208](https://github.com/gregberge/svgr/issues/208)) ([c922e2e](https://github.com/gregberge/svgr/commit/c922e2e))\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n\n# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)\n\n### Bug Fixes\n\n- style & custom SVG properties ([#203](https://github.com/gregberge/svgr/issues/203)) ([f8b2212](https://github.com/gregberge/svgr/commit/f8b2212)), closes [#199](https://github.com/gregberge/svgr/issues/199) [#201](https://github.com/gregberge/svgr/issues/201)\n\n<a name=\"3.0.0\"></a>\n\n# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)\n\n### Features\n\n- **config:** improve runtime config ([e52cdce](https://github.com/gregberge/svgr/commit/e52cdce)), closes [#192](https://github.com/gregberge/svgr/issues/192)\n- always prefix component name with \"Svg\" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)\n- new \"expandProps\" option ([bb95828](https://github.com/gregberge/svgr/commit/bb95828)), closes [#170](https://github.com/gregberge/svgr/issues/170)\n- remove \"svgAttributes\" option ([4e46a5d](https://github.com/gregberge/svgr/commit/4e46a5d)), closes [#173](https://github.com/gregberge/svgr/issues/173)\n- use forwardRef on React Native ([4bdd989](https://github.com/gregberge/svgr/commit/4bdd989)), closes [#184](https://github.com/gregberge/svgr/issues/184)\n- use React.forwardRef ([cbee51c](https://github.com/gregberge/svgr/commit/cbee51c)), closes [#184](https://github.com/gregberge/svgr/issues/184)\n\n### BREAKING CHANGES\n\n- \"--no-expand-props\" is now replaced by \"--expand-props none\". You can now specify a position \"start\" or \"end\" for \"expandProps\"\n  property.\n- `svgAttributes` has been removed, please use `svgProps` instead.\n- \"ref\" option now uses `React.forwardRef`. You don't have to use \"svgRef\"\n  prop, just use \"ref\" and it will work. `React.forwardRef` requires React\n  > 16.3.\n- **config:** - Runtime configuration is always loaded (even with Node API `convert`)\n\n* In CLI, \"--config\" is now \"--config-file\"; this new option can be used\n  everywhere\n\n<a name=\"2.4.1\"></a>\n\n## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)\n\n### Bug Fixes\n\n- **config:** fix custom config & default options ([#176](https://github.com/gregberge/svgr/issues/176)) ([9a6c40b](https://github.com/gregberge/svgr/commit/9a6c40b))\n\n<a name=\"2.4.0\"></a>\n\n# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)\n\n### Features\n\n- **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))\n- new option \"svgProps\" ([#172](https://github.com/gregberge/svgr/issues/172)) ([9657110](https://github.com/gregberge/svgr/commit/9657110))\n\n<a name=\"2.3.0\"></a>\n\n# [2.3.0](https://github.com/gregberge/svgr/compare/v2.2.1...v2.3.0) (2018-09-03)\n\n### Features\n\n- upgrade to Babel v7 ([7bc908d](https://github.com/gregberge/svgr/commit/7bc908d))\n\n<a name=\"2.2.0\"></a>\n\n# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)\n\n**Note:** Version bump only for package @svgr/cli\n\n<a name=\"2.1.1\"></a>\n\n## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)\n\n**Note:** Version bump only for package @svgr/cli\n\n<a name=\"2.1.0\"></a>\n\n# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)\n\n### Features\n\n- **cli:** support custom filename cases ([#136](https://github.com/gregberge/svgr/issues/136)) ([4922f7a](https://github.com/gregberge/svgr/commit/4922f7a)), closes [#118](https://github.com/gregberge/svgr/issues/118)\n"
  },
  {
    "path": "packages/cli/README.md",
    "content": "# @svgr/cli\n\n[![Build Status][build-badge]][build]\n[![version][version-badge]][package]\n[![MIT License][license-badge]][license]\n\nCommand Line Interface for SVGR.\n\n```\nnpm install @svgr/cli --save-dev\n```\n\n## Usage\n\n```\nUsage: svgr [options] <file|directory>\n\nOptions:\n  -V, --version                    output the version number\n  --config-file <file>             specify the path of the svgr config\n  --no-runtime-config              disable runtime config (\".svgrrc\", \".svgo.yml\", \".prettierrc\")\n  -d, --out-dir <dirname>          output files into a directory\n  --ignore-existing                ignore existing files when used with --out-dir\n  --ext <ext>                      specify a custom file extension (default: \"js\")\n  --filename-case <case>           specify filename case (\"pascal\", \"kebab\", \"camel\", \"snake\") (default: \"pascal\")\n  --icon                           use \"1em\" as width and height\n  --native                         add react-native support with react-native-svg\n  --memo                           add React.memo into the result component\n  --ref                            forward ref to SVG root element\n  --no-dimensions                  remove width and height from root SVG tag\n  --expand-props [position]        disable props expanding (\"start\", \"end\", \"none\") (default: \"end\")\n  --svg-props <property=value>     add props to the svg element\n  --replace-attr-values <old=new>  replace an attribute value\n  --template <file>                specify a custom template to use\n  --index-template <file>          specify a custom index.js template to use\n  --no-index                       disable index file generation\n  --title-prop                     create a title element linked with props\n  --desc-prop                      create a desc element linked with props\n  --prettier-config <fileOrJson>   Prettier config\n  --no-prettier                    disable Prettier\n  --svgo-config <fileOrJson>       SVGO config\n  --no-svgo                        disable SVGO\n  --silent                         suppress output\n  --stdin                          force reading input from stdin\n  --stdin-filepath                 path to the file to pretend that stdin comesfrom\n  -h, --help                       output usage information\n\n  Examples:\n    svgr --replace-attr-values \"#fff=currentColor\" icon.svg\n```\n\n## License\n\nMIT\n\n[build-badge]: https://img.shields.io/travis/smooth-code/svgr.svg?style=flat-square\n[build]: https://travis-ci.org/smooth-code/svgr\n[version-badge]: https://img.shields.io/npm/v/@svgr/core.svg?style=flat-square\n[package]: https://www.npmjs.com/package/@svgr/core\n[license-badge]: https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square\n[license]: https://github.com/smooth-code/svgr/blob/master/LICENSE\n"
  },
  {
    "path": "packages/cli/bin/svgr",
    "content": "#!/usr/bin/env node\n\nrequire('../dist/index')\n"
  },
  {
    "path": "packages/cli/package.json",
    "content": "{\n  \"name\": \"@svgr/cli\",\n  \"description\": \"SVGR command line.\",\n  \"version\": \"8.1.0\",\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/cli\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr\",\n    \"svg\",\n    \"react\",\n    \"cli\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"bin\": {\n    \"svgr\": \"./bin/svgr\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"dependencies\": {\n    \"@svgr/core\": \"workspace:*\",\n    \"@svgr/plugin-jsx\": \"workspace:*\",\n    \"@svgr/plugin-prettier\": \"workspace:*\",\n    \"@svgr/plugin-svgo\": \"workspace:*\",\n    \"camelcase\": \"^6.2.0\",\n    \"chalk\": \"^4.1.2\",\n    \"commander\": \"^9.4.1\",\n    \"dashify\": \"^2.0.0\",\n    \"glob\": \"^8.0.3\",\n    \"snake-case\": \"^3.0.4\"\n  },\n  \"devDependencies\": {\n    \"@types/glob\": \"^8.1.0\",\n    \"del\": \"^6.1.1\"\n  }\n}\n"
  },
  {
    "path": "packages/cli/src/__snapshots__/index.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`cli should add Svg prefix to index.js exports staring with number 1`] = `\n\"export { default as Svg2File } from './2File'\nexport { default as File } from './File'\n\"\n`;\n\nexports[`cli should not override config with cli defaults 1`] = `\n\"import * as React from \"react\";\nconst SvgFile = () => <svg viewBox=\"0 0 48 1\" xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\"><title>{\"Rectangle 5\"}</title><desc>{\"Created with Sketch.\"}</desc><defs /><g id=\"Page-1\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\"><g id=\"19-Separator\" transform=\"translate(-129.000000, -156.000000)\" fill=\"#063855\"><g id=\"Controls/Settings\" transform=\"translate(80.000000, 0.000000)\"><g id=\"Content\" transform=\"translate(0.000000, 64.000000)\"><g id=\"Group\" transform=\"translate(24.000000, 56.000000)\"><g id=\"Group-2\"><rect id=\"Rectangle-5\" x={25} y={36} width={48} height={1} /></g></g></g></g></g></g></svg>;\nexport default SvgFile;\n\"\n`;\n\nexports[`cli should support --index-template in cli 1`] = `\n\"export { File } from './File'\n\"\n`;\n\nexports[`cli should support --no-index 1`] = `\n[\n  \"File.js\",\n]\n`;\n\nexports[`cli should support --prettier-config as file 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n     <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n          <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n     </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support --prettier-config as json 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n     <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n          <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n     </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support --svgo-config as file 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <title>{'Rectangle 5'}</title>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support --svgo-config as file with .cjs extension 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <title>{'Rectangle 5'}</title>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support --svgo-config as json 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <title>{'Rectangle 5'}</title>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support custom file extension 1`] = `\n[\n  \"File.ts\",\n  \"index.ts\",\n]\n`;\n\nexports[`cli should support custom index.js with directory output 1`] = `\n\"export { File } from './File'\n\"\n`;\n\nexports[`cli should support different filename cases with directory output 1`] = `\n[\n  \"CamelCase.js\",\n  \"KebabCase.js\",\n  \"MultipleDashes.js\",\n  \"PascalCase.js\",\n  \"index.js\",\n]\n`;\n\nexports[`cli should support different filename cases with directory output: --filename-case=camel 1`] = `\n[\n  \"camelCase.js\",\n  \"index.js\",\n  \"kebabCase.js\",\n  \"multipleDashes.js\",\n  \"pascalCase.js\",\n]\n`;\n\nexports[`cli should support different filename cases with directory output: --filename-case=kebab 1`] = `\n[\n  \"camel-case.js\",\n  \"index.js\",\n  \"kebab-case.js\",\n  \"multiple-dashes.js\",\n  \"pascal-case.js\",\n]\n`;\n\nexports[`cli should support different filename cases with directory output: --filename-case=pascal 1`] = `\n[\n  \"CamelCase.js\",\n  \"KebabCase.js\",\n  \"MultipleDashes.js\",\n  \"PascalCase.js\",\n  \"index.js\",\n]\n`;\n\nexports[`cli should support different filename cases with directory output: --filename-case=snake 1`] = `\n[\n  \"camel_case.js\",\n  \"index.js\",\n  \"kebab_case.js\",\n  \"multiple_dashes.js\",\n  \"pascal_case.js\",\n]\n`;\n\nexports[`cli should support stdin filepath 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --desc-prop 1`] = `\n\"import * as React from 'react'\nconst SvgFile = ({ desc, descId, ...props }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    aria-describedby={descId}\n    {...props}\n  >\n    {desc ? <desc id={descId}>{desc}</desc> : null}\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --expand-props none 1`] = `\n\"import * as React from 'react'\nconst SvgFile = () => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --expand-props start 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg {...props} xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --icon 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"1em\"\n    height=\"1em\"\n    viewBox=\"0 0 48 1\"\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --icon 2em 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"2em\"\n    height=\"2em\"\n    viewBox=\"0 0 48 1\"\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --icon 24 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={24}\n    height={24}\n    viewBox=\"0 0 48 1\"\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --jsx-runtime automatic 1`] = `\n\"const SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --jsx-runtime classic-preact 1`] = `\n\"import { h } from 'preact'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --native --expand-props none 1`] = `\n\"import * as React from 'react'\nimport Svg, { Path } from 'react-native-svg'\nconst SvgFile = () => (\n  <Svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1}>\n    <Path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </Svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --native --icon 1`] = `\n\"import * as React from 'react'\nimport Svg, { Path } from 'react-native-svg'\nconst SvgFile = (props) => (\n  <Svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={24}\n    height={24}\n    viewBox=\"0 0 48 1\"\n    {...props}\n  >\n    <Path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </Svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --native --ref 1`] = `\n\"import * as React from 'react'\nimport Svg, { Path } from 'react-native-svg'\nimport { forwardRef } from 'react'\nconst SvgFile = (props, ref) => (\n  <Svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    ref={ref}\n    {...props}\n  >\n    <Path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </Svg>\n)\nconst ForwardRef = forwardRef(SvgFile)\nexport default ForwardRef\n\n\"\n`;\n\nexports[`cli should support various args: --native 1`] = `\n\"import * as React from 'react'\nimport Svg, { Path } from 'react-native-svg'\nconst SvgFile = (props) => (\n  <Svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <Path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </Svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --no-dimensions 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 1\" {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --no-prettier 1`] = `\n\"import * as React from \"react\";\nconst SvgFile = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}><path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" /></svg>;\nexport default SvgFile;\n\"\n`;\n\nexports[`cli should support various args: --no-svgo 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg\n    width=\"48px\"\n    height=\"1px\"\n    viewBox=\"0 0 48 1\"\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n    {...props}\n  >\n    <title>{'Rectangle 5'}</title>\n    <desc>{'Created with Sketch.'}</desc>\n    <defs />\n    <g id=\"Page-1\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\">\n      <g\n        id=\"19-Separator\"\n        transform=\"translate(-129.000000, -156.000000)\"\n        fill=\"#063855\"\n      >\n        <g id=\"Controls/Settings\" transform=\"translate(80.000000, 0.000000)\">\n          <g id=\"Content\" transform=\"translate(0.000000, 64.000000)\">\n            <g id=\"Group\" transform=\"translate(24.000000, 56.000000)\">\n              <g id=\"Group-2\">\n                <rect id=\"Rectangle-5\" x={25} y={36} width={48} height={1} />\n              </g>\n            </g>\n          </g>\n        </g>\n      </g>\n    </g>\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --ref 1`] = `\n\"import * as React from 'react'\nimport { forwardRef } from 'react'\nconst SvgFile = (props, ref) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    ref={ref}\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nconst ForwardRef = forwardRef(SvgFile)\nexport default ForwardRef\n\n\"\n`;\n\nexports[`cli should support various args: --replace-attr-values \"#063855=currentColor\" 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"currentColor\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --svg-props \"hidden={true},id=hello\" 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    hidden={true}\n    id=\"hello\"\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --title-prop 1`] = `\n\"import * as React from 'react'\nconst SvgFile = ({ title, titleId, ...props }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    aria-labelledby={titleId}\n    {...props}\n  >\n    {title ? <title id={titleId}>{title}</title> : null}\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should support various args: --typescript --ref --desc-prop 1`] = `\n\"import * as React from 'react'\nimport type { SVGProps } from 'react'\nimport { Ref, forwardRef } from 'react'\ninterface SVGRProps {\n  desc?: string;\n  descId?: string;\n}\nconst SvgFile = (\n  { desc, descId, ...props }: SVGProps<SVGSVGElement> & SVGRProps,\n  ref: Ref<SVGSVGElement>,\n) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    ref={ref}\n    aria-describedby={descId}\n    {...props}\n  >\n    {desc ? <desc id={descId}>{desc}</desc> : null}\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nconst ForwardRef = forwardRef(SvgFile)\nexport default ForwardRef\n\n\"\n`;\n\nexports[`cli should support various args: --typescript --ref --title-prop 1`] = `\n\"import * as React from 'react'\nimport type { SVGProps } from 'react'\nimport { Ref, forwardRef } from 'react'\ninterface SVGRProps {\n  title?: string;\n  titleId?: string;\n}\nconst SvgFile = (\n  { title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps,\n  ref: Ref<SVGSVGElement>,\n) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    ref={ref}\n    aria-labelledby={titleId}\n    {...props}\n  >\n    {title ? <title id={titleId}>{title}</title> : null}\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nconst ForwardRef = forwardRef(SvgFile)\nexport default ForwardRef\n\n\"\n`;\n\nexports[`cli should support various args: --typescript --ref 1`] = `\n\"import * as React from 'react'\nimport type { SVGProps } from 'react'\nimport { Ref, forwardRef } from 'react'\nconst SvgFile = (props: SVGProps<SVGSVGElement>, ref: Ref<SVGSVGElement>) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={48}\n    height={1}\n    ref={ref}\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nconst ForwardRef = forwardRef(SvgFile)\nexport default ForwardRef\n\n\"\n`;\n\nexports[`cli should support various args: --typescript 1`] = `\n\"import * as React from 'react'\nimport type { SVGProps } from 'react'\nconst SvgFile = (props: SVGProps<SVGSVGElement>) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should suppress output when transforming a directory with a --silent option 1`] = `\"\"`;\n\nexports[`cli should transform a whole directory and output relative destination paths 1`] = `\n\"\n__fixtures__/cased/camelcase.svg -> __fixtures_build__/whole/cased/camelcase.js\n__fixtures__/cased/kebab-case.svg -> __fixtures_build__/whole/cased/kebabcase.js\n__fixtures__/cased/multiple---dashes.svg -> __fixtures_build__/whole/cased/multipledashes.js\n__fixtures__/cased/pascalcase.svg -> __fixtures_build__/whole/cased/pascalcase.js\n__fixtures__/complex/skype.svg -> __fixtures_build__/whole/complex/skype.js\n__fixtures__/complex/telegram.svg -> __fixtures_build__/whole/complex/telegram.js\n__fixtures__/nesting/a/c/three.svg -> __fixtures_build__/whole/nesting/a/c/three.js\n__fixtures__/nesting/a/two.svg -> __fixtures_build__/whole/nesting/a/two.js\n__fixtures__/nesting/one.svg -> __fixtures_build__/whole/nesting/one.js\n__fixtures__/numeric/2.file.svg -> __fixtures_build__/whole/numeric/2file.js\n__fixtures__/numeric/file.svg -> __fixtures_build__/whole/numeric/file.js\n__fixtures__/simple/file.svg -> __fixtures_build__/whole/simple/file.js\n__fixtures__/withprettierrc/file.svg -> __fixtures_build__/whole/withprettierrc/file.js\n__fixtures__/withsvgoconfig/file.svg -> __fixtures_build__/whole/withsvgoconfig/file.js\n__fixtures__/withsvgrrc/file.svg -> __fixtures_build__/whole/withsvgrrc/file.js\"\n`;\n\nexports[`cli should transform a whole directory with --typescript 1`] = `\n\"\n__fixtures__/cased/camelcase.svg -> __fixtures_build__/whole/cased/camelcase.tsx\n__fixtures__/cased/kebab-case.svg -> __fixtures_build__/whole/cased/kebabcase.tsx\n__fixtures__/cased/multiple---dashes.svg -> __fixtures_build__/whole/cased/multipledashes.tsx\n__fixtures__/cased/pascalcase.svg -> __fixtures_build__/whole/cased/pascalcase.tsx\n__fixtures__/complex/skype.svg -> __fixtures_build__/whole/complex/skype.tsx\n__fixtures__/complex/telegram.svg -> __fixtures_build__/whole/complex/telegram.tsx\n__fixtures__/nesting/a/c/three.svg -> __fixtures_build__/whole/nesting/a/c/three.tsx\n__fixtures__/nesting/a/two.svg -> __fixtures_build__/whole/nesting/a/two.tsx\n__fixtures__/nesting/one.svg -> __fixtures_build__/whole/nesting/one.tsx\n__fixtures__/numeric/2.file.svg -> __fixtures_build__/whole/numeric/2file.tsx\n__fixtures__/numeric/file.svg -> __fixtures_build__/whole/numeric/file.tsx\n__fixtures__/simple/file.svg -> __fixtures_build__/whole/simple/file.tsx\n__fixtures__/withprettierrc/file.svg -> __fixtures_build__/whole/withprettierrc/file.tsx\n__fixtures__/withsvgoconfig/file.svg -> __fixtures_build__/whole/withsvgoconfig/file.tsx\n__fixtures__/withsvgrrc/file.svg -> __fixtures_build__/whole/withsvgrrc/file.tsx\"\n`;\n\nexports[`cli should work with a simple file 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\n\"\n`;\n\nexports[`cli should work with stdin 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgComponent\n\n\"\n`;\n\nexports[`cli using typescript option, it creates index with \\`.ts\\` extension 1`] = `\n\"export { default as File } from './File'\n\"\n`;\n"
  },
  {
    "path": "packages/cli/src/__snapshots__/util.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`util #convertFile should convert a file 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}>\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\"\n`;\n\nexports[`util #convertFile should support a custom config path 1`] = `\n\"import * as React from 'react'\nconst SvgFile = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"1em\"\n    height=\"1em\"\n    viewBox=\"0 0 48 1\"\n    {...props}\n  >\n    <path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" />\n  </svg>\n)\nexport default SvgFile\n\"\n`;\n"
  },
  {
    "path": "packages/cli/src/dirCommand.ts",
    "content": "/* eslint-disable no-underscore-dangle, no-console */\nimport { promises as fs } from 'fs'\nimport * as path from 'path'\nimport { grey, white } from 'chalk'\nimport { loadConfig, Config } from '@svgr/core'\nimport { format, resolveConfig } from 'prettier'\nimport {\n  convertFile,\n  transformFilename,\n  politeWrite,\n  formatExportName,\n} from './util'\nimport type { Options, SvgrCommand } from './index'\n\nconst exists = async (filepath: string) => {\n  try {\n    await fs.access(filepath)\n    return true\n  } catch (error) {\n    return false\n  }\n}\n\nconst rename = (relative: string, ext: string, filenameCase: string) => {\n  const relativePath = path.parse(relative)\n  relativePath.ext = `.${ext}`\n  relativePath.base = ''\n  relativePath.name = transformFilename(relativePath.name, filenameCase)\n  return path.format(relativePath)\n}\n\nexport const isCompilable = (filename: string): boolean => {\n  const ext = path.extname(filename)\n  return ext === '.svg' || ext == '.SVG'\n}\n\nexport interface IndexTemplate {\n  (paths: FileInfo[]): string\n}\n\ninterface FileInfo {\n  path: string\n  originalPath: string\n}\n\nconst defaultIndexTemplate: IndexTemplate = (paths: FileInfo[]) => {\n  const exportEntries = paths.map(({ path: filePath }) => {\n    const basename = path.basename(filePath, path.extname(filePath))\n    const exportName = formatExportName(basename)\n    return `export { default as ${exportName} } from './${basename}'`\n  })\n  return exportEntries.join('\\n')\n}\n\nconst resolveExtension = (\n  config: Config,\n  ext: string | null | undefined,\n  jsx: boolean,\n) => ext || (config.typescript ? (jsx ? 'tsx' : 'ts') : 'js')\n\nexport const dirCommand: SvgrCommand = async (\n  opts,\n  _,\n  filenames,\n): Promise<void> => {\n  const {\n    ext: extOpt,\n    filenameCase = 'pascal',\n    ignoreExisting,\n    silent,\n    configFile,\n    outDir,\n  } = opts\n\n  const ext = resolveExtension(opts, extOpt, true)\n\n  const write = async (src: string, dest: string) => {\n    if (!isCompilable(src)) {\n      return { transformed: false, dest: null }\n    }\n\n    dest = rename(dest, ext, filenameCase)\n    const code = await convertFile(src, opts)\n    const cwdRelative = path.relative(process.cwd(), dest)\n    const logOutput = `${src} -> ${cwdRelative}\\n`\n\n    if (ignoreExisting && (await exists(dest))) {\n      politeWrite(grey(logOutput), silent)\n      return { transformed: false, dest }\n    }\n\n    await fs.mkdir(path.dirname(dest), { recursive: true })\n    await fs.writeFile(dest, code)\n    politeWrite(white(logOutput), silent)\n    return { transformed: true, dest }\n  }\n\n  const generateIndex = async (\n    dest: string,\n    files: FileInfo[],\n    opts: Options,\n  ) => {\n    const ext = resolveExtension(opts, extOpt, false)\n    const filepath = path.join(dest, `index.${ext}`)\n    const indexTemplate = opts.indexTemplate || defaultIndexTemplate\n    const fileContent = indexTemplate(files)\n    const prettyContent = await (async () => {\n      if (!opts.prettier) return fileContent\n      const prettierRcConfig = opts.runtimeConfig\n        ? await resolveConfig(filepath, { editorconfig: true })\n        : {}\n      return format(fileContent, {\n        filepath,\n        ...prettierRcConfig,\n        ...opts.prettierConfig,\n      })\n    })()\n    await fs.writeFile(filepath, prettyContent)\n  }\n\n  async function handle(filename: string, root: string) {\n    const stats = await fs.stat(filename)\n\n    if (stats.isDirectory()) {\n      const dirname = filename\n      const files = await fs.readdir(dirname)\n      const results = (await Promise.all(\n        files.map(async (relativeFile) => {\n          const absFile = path.join(dirname, relativeFile)\n          return [absFile, await handle(absFile, root)]\n        }),\n      )) as [\n        string,\n        {\n          dest: string | null\n          transformed: boolean\n        },\n      ][]\n      const transformed = results.filter(([, result]) => result.transformed)\n      if (transformed.length) {\n        const destFiles = results\n          .filter(([, result]) => result.dest)\n          .map(([originalPath, result]) => ({\n            path: result.dest,\n            originalPath,\n          }))\n          .filter(({ path }) => path) as FileInfo[]\n        const dest = path.resolve(\n          outDir as string,\n          path.relative(root, dirname),\n        )\n        const resolvedConfig = loadConfig.sync(\n          { configFile, ...opts },\n          { filePath: dest },\n        ) as Options\n        if (resolvedConfig.index) {\n          await generateIndex(dest, destFiles, opts)\n        }\n      }\n      return { transformed: false, dest: null }\n    }\n\n    const dest = path.resolve(outDir as string, path.relative(root, filename))\n    return write(filename, dest).catch((err) => {\n      console.error('Failed to handle file: ', filename)\n      throw err\n    })\n  }\n\n  await Promise.all(\n    filenames.map(async (file) => {\n      const stats = await fs.stat(file)\n      const root = stats.isDirectory() ? file : path.dirname(file)\n      await handle(file, root)\n    }),\n  )\n}\n"
  },
  {
    "path": "packages/cli/src/fileCommand.ts",
    "content": "/* eslint-disable no-underscore-dangle */\nimport { promises as fs } from 'fs'\nimport { convert, convertFile, exitError } from './util'\nimport type { SvgrCommand } from './index'\n\nconst readStdin = async () => {\n  return new Promise<string>((resolve) => {\n    let code = ''\n    process.stdin.setEncoding('utf8')\n    process.stdin.on('readable', () => {\n      const chunk = process.stdin.read()\n      if (chunk !== null) code += chunk\n    })\n    process.stdin.on('end', () => {\n      resolve(code)\n    })\n  })\n}\n\nexport const fileCommand: SvgrCommand = async (\n  opts,\n  program,\n  filenames,\n): Promise<void> => {\n  if (opts.stdin || (filenames.length === 0 && !process.stdin.isTTY)) {\n    const input = await readStdin()\n    const output = convert(input, opts, { filePath: opts.stdinFilepath })\n    process.stdout.write(`${output}\\n`)\n    return\n  }\n\n  if (filenames.length === 0) {\n    process.stdout.write(`${program.helpInformation()}\\n`)\n    return\n  }\n\n  if (filenames.length > 1) {\n    exitError('Please specify only one filename or use `--out-dir` option.')\n  }\n\n  const [filename] = filenames\n  const stats = await fs.stat(filename)\n\n  if (stats.isDirectory()) {\n    exitError('Directory are not supported without `--out-dir` option instead.')\n  }\n\n  const output = await convertFile(filename, opts)\n  process.stdout.write(`${output}\\n`)\n}\n"
  },
  {
    "path": "packages/cli/src/index.test.ts",
    "content": "import { promises as fs } from 'fs'\nimport * as path from 'path'\nimport { exec as execCb } from 'child_process'\nimport { promisify } from 'util'\n// @ts-ignore\nimport del from 'del'\n\nconst exec = promisify(execCb)\n\nconst svgr = path.join(__dirname, '../bin/svgr')\n\nconst sortCliResult = (result: string) => {\n  return result\n    .split(/\\n/)\n    .sort((a, b) => a.localeCompare(b))\n    .map((x) => x.toLowerCase())\n    .join('\\n')\n}\n\ndescribe('cli', () => {\n  const cli = async (args: string) => {\n    const { stdout } = await exec(`${svgr} ${args}`)\n    return stdout\n  }\n\n  it('should work with a simple file', async () => {\n    const result = await cli('__fixtures__/simple/file.svg')\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should not work with a directory without --out-dir option', async () => {\n    expect.assertions(1)\n    try {\n      await cli('__fixtures__/nesting')\n    } catch (error: any) {\n      expect(error.message).toMatch(\n        'Directory are not supported without `--out-dir` option instead',\n      )\n    }\n  })\n\n  it('should not work with several files without destination', async () => {\n    expect.assertions(1)\n    try {\n      await cli('__fixtures__/simple/file.svg __fixtures__/nesting/one.svg')\n    } catch (error: any) {\n      expect(error.message).toMatch(\n        'Please specify only one filename or use `--out-dir` option',\n      )\n    }\n  })\n\n  it('should work with stdin', async () => {\n    const result = await cli('< __fixtures__/simple/file.svg')\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should support stdin filepath', async () => {\n    const result = await cli(\n      '--stdin-filepath __fixtures__/simple/file.svg < __fixtures__/simple/file.svg',\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should transform a whole directory and output relative destination paths', async () => {\n    const result = await cli('--out-dir __fixtures_build__/whole __fixtures__')\n    expect(sortCliResult(result)).toMatchSnapshot()\n  })\n\n  it('should transform a whole directory with --typescript', async () => {\n    const result = await cli(\n      '--typescript --out-dir __fixtures_build__/whole __fixtures__',\n    )\n    expect(sortCliResult(result)).toMatchSnapshot()\n  })\n\n  it('should suppress output when transforming a directory with a --silent option', async () => {\n    const result = await cli(\n      '--silent --out-dir __fixtures_build__/whole __fixtures__',\n    )\n    expect(sortCliResult(result)).toMatchSnapshot()\n  })\n\n  it('should support --prettier-config as json', async () => {\n    const result = await cli(\n      `--prettier-config '{\"tabWidth\": 5}' __fixtures__/simple/file.svg`,\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should support --prettier-config as file', async () => {\n    const result = await cli(\n      `--prettier-config __fixtures__/withPrettierRc/.prettierrc __fixtures__/simple/file.svg`,\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should support --svgo-config as json', async () => {\n    const result = await cli(\n      `--svgo-config '{\"plugins\":[{\"name\":\"preset-default\",\"params\":{\"overrides\":{\"removeTitle\":false}}}]}' __fixtures__/simple/file.svg`,\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should support --svgo-config as file', async () => {\n    const result = await cli(\n      `--svgo-config __fixtures__/withSvgoConfig/svgo.config.js __fixtures__/simple/file.svg`,\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should support --svgo-config as file with .cjs extension', async () => {\n    const result = await cli(\n      `--svgo-config __fixtures__/withSvgoConfig/svgo.config.cjs __fixtures__/simple/file.svg`,\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it.each([\n    ['--no-dimensions'],\n    ['--jsx-runtime classic-preact'],\n    ['--jsx-runtime automatic'],\n    ['--expand-props none'],\n    ['--expand-props start'],\n    ['--icon'],\n    ['--icon 24'],\n    ['--icon 2em'],\n    ['--native'],\n    ['--native --icon'],\n    ['--native --expand-props none'],\n    ['--native --ref'],\n    ['--ref'],\n    ['--replace-attr-values \"#063855=currentColor\"'],\n    [`--svg-props \"hidden={true},id=hello\"`],\n    ['--no-svgo'],\n    ['--no-prettier'],\n    ['--title-prop'],\n    ['--desc-prop'],\n    ['--typescript'],\n    ['--typescript --ref'],\n    ['--typescript --ref --title-prop'],\n    ['--typescript --ref --desc-prop'],\n  ])(\n    'should support various args',\n    async (args) => {\n      const result = await cli(`${args} -- __fixtures__/simple/file.svg`)\n      expect(result).toMatchSnapshot(args)\n    },\n    10000,\n  )\n\n  it.each([\n    [0, ''],\n    [1, '--filename-case=camel'],\n    [2, '--filename-case=pascal'],\n    [3, '--filename-case=kebab'],\n    [4, '--filename-case=snake'],\n  ])(\n    'should support different filename cases with directory output',\n    async (index, args) => {\n      const inDir = '__fixtures__/cased'\n      const outDir = `__fixtures_build__/filename-case-${index}`\n      await del(outDir)\n      await cli(`${args} ${inDir} --out-dir=${outDir}`)\n      expect(await fs.readdir(outDir)).toMatchSnapshot(args)\n    },\n    10000,\n  )\n\n  it('should support custom file extension', async () => {\n    const inDir = '__fixtures__/simple'\n    const outDir = '__fixtures_build__/ext'\n    await del(outDir)\n    await cli(`--ext=ts ${inDir} --out-dir=${outDir}`)\n    expect(await fs.readdir(outDir)).toMatchSnapshot()\n  })\n\n  it('should support \"--ignore-existing\"', async () => {\n    const inDir = '__fixtures__/simple'\n    const outDir = '__fixtures__/simple-existing'\n    await cli(`${inDir} --out-dir=${outDir} --ignore-existing`)\n    const content = await fs.readFile(path.join(outDir, 'File.js'), 'utf-8')\n    expect(content).toBe('// nothing')\n  })\n\n  it('should not override config with cli defaults', async () => {\n    const result = await cli(\n      '__fixtures__/simple/file.svg --config-file=__fixtures__/overrides.config.js',\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should add Svg prefix to index.js exports staring with number', async () => {\n    const inDir = '__fixtures__/numeric'\n    const outDir = `__fixtures_build__/prefix-exports`\n    await del(outDir)\n    await cli(`${inDir} --out-dir=${outDir}`)\n    const content = await fs.readFile(path.join(outDir, 'index.js'), 'utf-8')\n    expect(content).toMatchSnapshot()\n  })\n\n  it('should support custom index.js with directory output', async () => {\n    const inDir = '__fixtures__/simple'\n    const outDir = `__fixtures_build__/custom-index`\n    await del(outDir)\n    await cli(\n      `${inDir} --out-dir=${outDir} --config-file=__fixtures__/custom-index.config.js`,\n    )\n    const content = await fs.readFile(path.join(outDir, 'index.js'), 'utf-8')\n    expect(content).toMatchSnapshot()\n  })\n\n  it('using typescript option, it creates index with `.ts` extension', async () => {\n    const inDir = '__fixtures__/simple'\n    const outDir = `__fixtures_build__/ts-index`\n    await del(outDir)\n    await cli(`${inDir} --out-dir=${outDir} --typescript`)\n    const content = await fs.readFile(path.join(outDir, 'index.ts'), 'utf-8')\n    expect(content).toMatchSnapshot()\n  })\n\n  it('should support --index-template in cli', async () => {\n    const inDir = '__fixtures__/simple'\n    const outDir = `__fixtures_build__/custom-index-arg`\n    await del(outDir)\n    await cli(\n      `${inDir} --out-dir=${outDir} --index-template=__fixtures__/custom-index-template.js`,\n    )\n    const content = await fs.readFile(path.join(outDir, 'index.js'), 'utf-8')\n    expect(content).toMatchSnapshot()\n  })\n\n  it('should support --no-index', async () => {\n    const inDir = '__fixtures__/simple'\n    const outDir = `__fixtures_build__/no-index-case`\n    await del(outDir)\n    await cli(`--no-index ${inDir} --out-dir=${outDir}`)\n    expect(await fs.readdir(outDir)).toMatchSnapshot()\n  })\n})\n"
  },
  {
    "path": "packages/cli/src/index.ts",
    "content": "/* eslint-disable no-console */\nimport { program, Command } from 'commander'\nimport * as path from 'path'\nimport { glob } from 'glob'\nimport { readFileSync, promises as fsPromises } from 'fs'\nimport { loadConfig, Config } from '@svgr/core'\nimport { fileCommand } from './fileCommand'\nimport { dirCommand } from './dirCommand'\nimport { exitError } from './util'\nimport type { IndexTemplate } from './dirCommand'\nimport { version } from '../package.json'\n\nconst noUndefinedKeys = <T extends Record<string, any>>(obj: T): T => {\n  return Object.entries(obj).reduce((obj, [key, value]) => {\n    if (value !== undefined) {\n      // @ts-ignore\n      obj[key] = value\n    }\n    return obj\n  }, {} as T)\n}\n\nconst parseObject = (arg: string, accumulation = {}) => {\n  const [name, value] = arg.split('=')\n  return { ...accumulation, [name]: value }\n}\n\nconst parseObjectList = (arg: string, accumulation = {}) => {\n  const args = arg.split(',').map((str) => str.trim())\n  return args.reduce((acc, arg) => parseObject(arg, acc), accumulation)\n}\n\nconst parseConfig = (name: string) => (arg: string) => {\n  try {\n    if (arg.endsWith('rc')) {\n      const content = readFileSync(arg, 'utf-8')\n      return JSON.parse(content)\n    }\n\n    const ext = path.extname(arg)\n    if (ext === '.js' || ext === '.json' || ext === '.cjs') {\n      return require(path.join(process.cwd(), arg))\n    }\n\n    return JSON.parse(arg)\n  } catch (error) {\n    exitError(\n      `\"${name}\" is not valid, please specify a valid file or use a inline JSON.`,\n    )\n  }\n}\n\nconst parseExpandProps = (arg: string) => (arg === 'none' ? false : arg)\n\nconst parseTemplate = (name: string) => (arg: string) => {\n  try {\n    // eslint-disable-next-line @typescript-eslint/no-var-requires\n    const template = require(path.join(process.cwd(), arg))\n    const resolved = template.default || template\n    if (typeof resolved !== 'function') {\n      throw new Error(`${name} file must export a function`)\n    }\n    return resolved\n  } catch (error: any) {\n    console.error(`Error when loading \"${name}\": ${arg}\\n`)\n    console.error(error.stack)\n    process.exit(2)\n  }\n}\n\nconst parseIconSize = (arg: string) => {\n  const num = Number(arg)\n  return Number.isNaN(num) ? arg : num\n}\n\nexport interface Options extends Config {\n  configFile?: string\n  runtimeConfig?: boolean\n  outDir?: string\n  ignoreExisting?: boolean\n  ext?: string\n  filenameCase?: string\n  silent?: boolean\n  stdin?: boolean\n  stdinFilepath?: string\n  indexTemplate?: IndexTemplate\n}\n\nexport interface SvgrCommand {\n  (opts: Options, program: Command, filenames: string[]): Promise<void>\n}\n\nprogram\n  .version(version)\n  .usage('[options] <file|directory>')\n  .option('--config-file <file>', 'specify the path of the svgr config')\n  .option(\n    '--no-runtime-config',\n    'disable runtime config (\".svgrrc\", \".svgo.yml\", \".prettierrc\")',\n  )\n  .option('-d, --out-dir <dirname>', 'output files into a directory')\n  .option('--ignore-existing', 'ignore existing files when used with --out-dir')\n  .option('--ext <ext>', 'specify a custom file extension (default: \"js\")')\n  .option(\n    '--filename-case <case>',\n    'specify filename case (\"pascal\", \"kebab\", \"camel\", \"snake\") (default: \"pascal\")',\n  )\n  .option(\n    '--icon [size]',\n    'specify width and height (default to \"1em\" or 24dp (native))',\n    parseIconSize,\n  )\n  .option(\n    '--jsx-runtime <runtime>',\n    'specify JSX runtime (\"automatic\", \"classic\", \"classic-preact\") (default: \"classic\")',\n  )\n  .option('--typescript', 'transform svg into typescript')\n  .option('--native', 'add react-native support with react-native-svg')\n  .option('--memo', 'add React.memo into the result component')\n  .option('--ref', 'forward ref to SVG root element')\n  .option('--no-dimensions', 'remove width and height from root SVG tag')\n  .option(\n    '--expand-props [position]',\n    'disable props expanding (\"start\", \"end\", \"none\") (default: \"end\")',\n    parseExpandProps,\n  )\n  .option(\n    '--svg-props <property=value>',\n    'add props to the svg element',\n    parseObjectList,\n  )\n  .option(\n    '--replace-attr-values <old=new>',\n    'replace an attribute value',\n    parseObjectList,\n  )\n  .option(\n    '--template <file>',\n    'specify a custom template to use',\n    parseTemplate('--template'),\n  )\n  .option(\n    '--index-template <file>',\n    'specify a custom index.js template to use',\n    parseTemplate('--index-template'),\n  )\n  .option('--no-index', 'disable index file generation')\n  .option('--title-prop', 'create a title element linked with props')\n  .option('--desc-prop', 'create a desc element linked with props')\n  .option(\n    '--prettier-config <fileOrJson>',\n    'Prettier config',\n    parseConfig('--prettier-config'),\n  )\n  .option('--no-prettier', 'disable Prettier')\n  .option(\n    '--svgo-config <fileOrJson>',\n    'SVGO config',\n    parseConfig('--svgo-config'),\n  )\n  .option('--no-svgo', 'disable SVGO')\n  .option('--silent', 'suppress output')\n  .option('--stdin', 'force reading input from stdin')\n  .option(\n    '--stdin-filepath',\n    'path to the file to pretend that stdin comes from',\n  )\n\nprogram.on('--help', () => {\n  console.log(`\n  Examples:\n    svgr --replace-attr-values \"#fff=currentColor\" icon.svg\n`)\n})\n\nprogram.parse(process.argv)\n\nasync function run() {\n  const errors: string[] = []\n  const filenames = program.args.reduce((globbed, input) => {\n    let files = glob.sync(input)\n    if (!files.length) files = [input]\n    return [...globbed, ...files]\n  }, [] as string[])\n\n  await Promise.all(\n    filenames.map(async (filename) => {\n      try {\n        await fsPromises.stat(filename)\n      } catch (error) {\n        errors.push(`${filename} does not exist`)\n      }\n    }),\n  )\n\n  if (errors.length) {\n    console.error(errors.join('. '))\n    process.exit(2)\n  }\n\n  const programOpts = noUndefinedKeys(program.opts<Options>())\n  if (programOpts.dimensions) delete programOpts.dimensions\n  if (programOpts.svgo) delete programOpts.svgo\n  if (programOpts.prettier) delete programOpts.prettier\n  const opts = (await loadConfig(programOpts, {\n    filePath: process.cwd(),\n  })) as Options\n\n  const command = opts.outDir ? dirCommand : fileCommand\n  await command(opts, program, filenames)\n}\n\nrun().catch((error) => {\n  setTimeout(() => {\n    throw error\n  })\n})\n"
  },
  {
    "path": "packages/cli/src/util.test.ts",
    "content": "import * as path from 'path'\nimport { convertFile, transformFilename, formatExportName } from './util'\n\nconst FIXTURES = path.join(__dirname, '../../../__fixtures__')\n\ndescribe('util', () => {\n  describe('#convertFile', () => {\n    it('should convert a file', async () => {\n      const file = path.join(FIXTURES, 'simple/file.svg')\n      const result = await convertFile(file)\n      expect(result).toMatchSnapshot()\n    })\n\n    it('should support a custom config path', async () => {\n      const file = path.join(FIXTURES, 'simple/file.svg')\n      const result = await convertFile(file, {\n        configFile: '__fixtures__/withSvgrRc/.svgrrc',\n      })\n      expect(result).toMatchSnapshot()\n    })\n  })\n\n  describe('#transformFilename', () => {\n    it('should transform filename', () => {\n      expect(transformFilename('FooBar', 'camel')).toBe('fooBar')\n      expect(transformFilename('FooBar', 'kebab')).toBe('foo-bar')\n      expect(transformFilename('FooBar', 'pascal')).toBe('FooBar')\n      expect(transformFilename('FooBar', 'snake')).toBe('foo_bar')\n\n      expect(transformFilename('foo_bar', 'camel')).toBe('fooBar')\n      expect(transformFilename('foo_bar', 'kebab')).toBe('foo-bar')\n      expect(transformFilename('foo_bar', 'pascal')).toBe('FooBar')\n      expect(transformFilename('foo_bar', 'snake')).toBe('foo_bar')\n    })\n  })\n\n  describe('#formatExportName', () => {\n    it('should ensure a valid export name', () => {\n      expect(formatExportName('foo')).toBe('Foo')\n      expect(formatExportName('foo-bar')).toBe('FooBar')\n      expect(formatExportName('2foo')).toBe('Svg2foo')\n      expect(formatExportName('2foo-bar')).toBe('Svg2FooBar')\n    })\n  })\n})\n"
  },
  {
    "path": "packages/cli/src/util.ts",
    "content": "/* eslint-disable no-console */\nimport { promises as fs } from 'fs'\nimport { red } from 'chalk'\nimport { transform, Config, State } from '@svgr/core'\nimport svgo from '@svgr/plugin-svgo'\nimport jsx from '@svgr/plugin-jsx'\nimport prettier from '@svgr/plugin-prettier'\n// @ts-ignore\nimport camelCase from 'camelcase'\n// @ts-ignore\nimport dashify from 'dashify'\nimport { snakeCase } from 'snake-case'\n\nexport function transformFilename(\n  filename: string,\n  filenameCase: string,\n): string {\n  switch (filenameCase) {\n    case 'kebab':\n      return dashify(filename.replace(/_/g, '-'), { condense: true })\n    case 'camel':\n      return camelCase(filename)\n    case 'pascal':\n      return camelCase(filename, { pascalCase: true })\n    case 'snake':\n      return snakeCase(filename)\n    default:\n      throw new Error(`Unknown --filename-case ${filenameCase}`)\n  }\n}\n\nexport const convert = (\n  code: string,\n  config: Config,\n  state: Partial<State>,\n): string => {\n  return transform.sync(code, config, {\n    ...state,\n    caller: {\n      name: '@svgr/cli',\n      defaultPlugins: [svgo, jsx, prettier],\n    },\n  })\n}\n\nexport const convertFile = async (\n  filePath: string,\n  config: Config = {},\n): Promise<string> => {\n  const code = await fs.readFile(filePath, 'utf-8')\n  return convert(code, config, { filePath })\n}\n\nexport const exitError = (error: string): never => {\n  console.error(red(error))\n  process.exit(1)\n}\n\nexport const politeWrite = (data: string, silent?: boolean): void => {\n  if (!silent) {\n    process.stdout.write(data)\n  }\n}\n\nexport const formatExportName = (name: string): string => {\n  if (/[-]/g.test(name) && /^\\d/.test(name)) {\n    return `Svg${camelCase(name, { pascalCase: true })}`\n  }\n\n  if (/^\\d/.test(name)) {\n    return `Svg${name}`\n  }\n\n  return camelCase(name, { pascalCase: true })\n}\n"
  },
  {
    "path": "packages/cli/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/core/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/core/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n\n### Bug Fixes\n\n* **config:** prefer cli config over rc config ([#845](https://github.com/gregberge/svgr/issues/845)) ([8b97248](https://github.com/gregberge/svgr/commit/8b972484266c45c7f8e4acce4fe2930a024fb4bc))\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n\n### Features\n\n* add snake_case filename option ([#857](https://github.com/gregberge/svgr/issues/857)) ([428b0c7](https://github.com/gregberge/svgr/commit/428b0c7f4c5205bb67ae3e9e7c7e819ec3fc03ba))\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* allow specifying `jsxRuntimeImport` in config ([86bb86f](https://github.com/gregberge/svgr/commit/86bb86f47748618f729742e56199355d9c0bc518)), closes [#801](https://github.com/gregberge/svgr/issues/801) [#801](https://github.com/gregberge/svgr/issues/801)\n* remove @svgr/plugin-jsx from core ([a0f078d](https://github.com/gregberge/svgr/commit/a0f078db13936800a32c14ade08b670a14b5a886))\n* upgrade to svgo v3 ([#798](https://github.com/gregberge/svgr/issues/798)) ([21b6209](https://github.com/gregberge/svgr/commit/21b6209ef34c51cc0313901f31061afe587ab29b))\n\n\n### BREAKING CHANGES\n\n* plugin-jsx is no longer included by default in core\n* svgr now requires Node.js v14+\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n### Bug Fixes\n\n- fix Yarn peer dependency warning from @babel/core ([#786](https://github.com/gregberge/svgr/issues/786)) ([db35837](https://github.com/gregberge/svgr/commit/db3583751474997dd72a0209ca61daddbac16c46)), closes [#785](https://github.com/gregberge/svgr/issues/785)\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Bug Fixes\n\n- **deps:** add babel-preset to core dependencies ([#782](https://github.com/gregberge/svgr/issues/782)) ([464ec5f](https://github.com/gregberge/svgr/commit/464ec5fe81c6ba98be5a26923f3ad19fc2ef7fc6))\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n- support spaces in file names ([#779](https://github.com/gregberge/svgr/issues/779)) ([6ee639a](https://github.com/gregberge/svgr/commit/6ee639a039a0001d3b97fef024f2bd0c3e107182))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **core:** types field in package.json ([#693](https://github.com/gregberge/svgr/issues/693)) ([a491ace](https://github.com/gregberge/svgr/commit/a491acee1b3fbe1cae304dbc399193cdb2148e1d))\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n**Note:** Version bump only for package @svgr/core\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n**Note:** Version bump only for package @svgr/core\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n**Note:** Version bump only for package @svgr/core\n\n## [6.1.1](https://github.com/gregberge/svgr/compare/v6.1.0...v6.1.1) (2021-12-04)\n\n### Bug Fixes\n\n- **webpack:** fix double export ([#648](https://github.com/gregberge/svgr/issues/648)) ([7595d37](https://github.com/gregberge/svgr/commit/7595d378b73d4826a4cead165b3f32386b07315b)), closes [#645](https://github.com/gregberge/svgr/issues/645)\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n**Note:** Version bump only for package @svgr/core\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- **typescript:** fix react-native support [#465](https://github.com/gregberge/svgr/tree/master/packages/core/issues/465) ([#488](https://github.com/gregberge/svgr/tree/master/packages/core/issues/488)) ([d61e0cf](https://github.com/gregberge/svgr/tree/master/packages/core/commit/d61e0cface065afc1478fdb44d87ca8177041eab))\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/core/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/core/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/core/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n### Features\n\n- allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/core/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/core/commit/16a58d6e817c065f72a68be91600a1a360205f44))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n### Bug Fixes\n\n- wrap svg component directly with memo/forwardRef ([#440](https://github.com/gregberge/svgr/tree/master/packages/core/issues/440)) ([#441](https://github.com/gregberge/svgr/tree/master/packages/core/issues/441)) ([a6de2da](https://github.com/gregberge/svgr/tree/master/packages/core/commit/a6de2dacb63e36572a2167b928418bdc39f3a9c2))\n\n### Features\n\n- **cli:** make all CLI options available in config ([a23a186](https://github.com/gregberge/svgr/tree/master/packages/core/commit/a23a18675c0dd4a461d2fcbdc72a305cabd32a13)), closes [#431](https://github.com/gregberge/svgr/tree/master/packages/core/issues/431) [#437](https://github.com/gregberge/svgr/tree/master/packages/core/issues/437)\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n**Note:** Version bump only for package @svgr/core\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n### Features\n\n- add typescript option ([4596d7b](https://github.com/gregberge/svgr/tree/master/packages/core/commit/4596d7bb470babb5ec4b87f5281174fb182bd9c7)), closes [#373](https://github.com/gregberge/svgr/tree/master/packages/core/issues/373)\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/core\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/core/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n### Bug Fixes\n\n- **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/core/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/core/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/core/issues/333)\n- invalid characters in component name ([#332](https://github.com/gregberge/svgr/tree/master/packages/core/issues/332)) ([4b4bd2c](https://github.com/gregberge/svgr/tree/master/packages/core/commit/4b4bd2c)), closes [#331](https://github.com/gregberge/svgr/tree/master/packages/core/issues/331)\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n**Note:** Version bump only for package @svgr/core\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/core\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n**Note:** Version bump only for package @svgr/core\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- keep viewBox when dimensions are removed ([#281](https://github.com/gregberge/svgr/tree/master/packages/core/issues/281)) ([f476c8e](https://github.com/gregberge/svgr/tree/master/packages/core/commit/f476c8e))\n\n### Features\n\n- add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/core/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/core/commit/978db3e))\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n**Note:** Version bump only for package @svgr/core\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/core\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/core\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n- allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n\n# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)\n\n### Bug Fixes\n\n- style & custom SVG properties ([#203](https://github.com/gregberge/svgr/issues/203)) ([f8b2212](https://github.com/gregberge/svgr/commit/f8b2212)), closes [#199](https://github.com/gregberge/svgr/issues/199) [#201](https://github.com/gregberge/svgr/issues/201)\n\n### Features\n\n- allow Mask & Image on React Native ([#202](https://github.com/gregberge/svgr/issues/202)) ([0256bc0](https://github.com/gregberge/svgr/commit/0256bc0))\n\n<a name=\"3.0.0\"></a>\n\n# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)\n\n### Bug Fixes\n\n- fix --icon + --no-dimensions ([7535693](https://github.com/gregberge/svgr/commit/7535693)), closes [#141](https://github.com/gregberge/svgr/issues/141)\n- fix expandProps when position is not allowed ([45522fc](https://github.com/gregberge/svgr/commit/45522fc))\n\n### Features\n\n- **config:** improve runtime config ([e52cdce](https://github.com/gregberge/svgr/commit/e52cdce)), closes [#192](https://github.com/gregberge/svgr/issues/192)\n- **template:** expose `getProps` util for template ([5cb238e](https://github.com/gregberge/svgr/commit/5cb238e)), closes [#187](https://github.com/gregberge/svgr/issues/187)\n- add synchronous API ([169eb2f](https://github.com/gregberge/svgr/commit/169eb2f)), closes [#185](https://github.com/gregberge/svgr/issues/185)\n- always prefix component name with \"Svg\" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)\n- do not remove style tag ([a4ce09a](https://github.com/gregberge/svgr/commit/a4ce09a)), closes [#191](https://github.com/gregberge/svgr/issues/191)\n- new \"expandProps\" option ([bb95828](https://github.com/gregberge/svgr/commit/bb95828)), closes [#170](https://github.com/gregberge/svgr/issues/170)\n- remove \"svgAttributes\" option ([4e46a5d](https://github.com/gregberge/svgr/commit/4e46a5d)), closes [#173](https://github.com/gregberge/svgr/issues/173)\n- use forwardRef on React Native ([4bdd989](https://github.com/gregberge/svgr/commit/4bdd989)), closes [#184](https://github.com/gregberge/svgr/issues/184)\n- use React.forwardRef ([cbee51c](https://github.com/gregberge/svgr/commit/cbee51c)), closes [#184](https://github.com/gregberge/svgr/issues/184)\n\n### BREAKING CHANGES\n\n- \"--no-expand-props\" is now replaced by \"--expand-props none\". You can now specify a position \"start\" or \"end\" for \"expandProps\"\n  property.\n- `svgAttributes` has been removed, please use `svgProps` instead.\n- \"ref\" option now uses `React.forwardRef`. You don't have to use \"svgRef\"\n  prop, just use \"ref\" and it will work. `React.forwardRef` requires React\n  > 16.3.\n- Style tag will no longer be automatically removed. SVGO should handle it\n  correctly using \"inlineStyles\" plugin. If you want to remove them,\n  enable \"removeStyleElement\" plugin in your SVGO config.\n- **config:** - Runtime configuration is always loaded (even with Node API `convert`)\n\n* In CLI, \"--config\" is now \"--config-file\"; this new option can be used\n  everywhere\n\n<a name=\"2.4.1\"></a>\n\n## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)\n\n### Bug Fixes\n\n- **config:** fix custom config & default options ([#176](https://github.com/gregberge/svgr/issues/176)) ([9a6c40b](https://github.com/gregberge/svgr/commit/9a6c40b))\n\n<a name=\"2.4.0\"></a>\n\n# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)\n\n### Bug Fixes\n\n- use literal instead of litteral ([7849fd4](https://github.com/gregberge/svgr/commit/7849fd4))\n\n### Features\n\n- allow to spread props at the start ([#166](https://github.com/gregberge/svgr/issues/166)) ([cd659dc](https://github.com/gregberge/svgr/commit/cd659dc))\n- **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))\n- new option \"svgProps\" ([#172](https://github.com/gregberge/svgr/issues/172)) ([9657110](https://github.com/gregberge/svgr/commit/9657110))\n\n<a name=\"2.2.0\"></a>\n\n# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)\n\n### Bug Fixes\n\n- remove null-byte characters ([#154](https://github.com/gregberge/svgr/issues/154)) ([de7f8a7](https://github.com/gregberge/svgr/commit/de7f8a7)), closes [#153](https://github.com/gregberge/svgr/issues/153)\n\n### Features\n\n- **core:** pass info to SVGO ([2b2353b](https://github.com/gregberge/svgr/commit/2b2353b)), closes [#152](https://github.com/gregberge/svgr/issues/152)\n\n<a name=\"2.1.1\"></a>\n\n## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)\n\n### Bug Fixes\n\n- **core:** config conflict with icon option ([#137](https://github.com/gregberge/svgr/issues/137)) ([e13a99a](https://github.com/gregberge/svgr/commit/e13a99a))\n\n<a name=\"2.1.0\"></a>\n\n# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)\n\n### Features\n\n- add .editorconfig support ([#129](https://github.com/gregberge/svgr/issues/129)) ([968fd82](https://github.com/gregberge/svgr/commit/968fd82))\n- **cli:** support custom filename cases ([#136](https://github.com/gregberge/svgr/issues/136)) ([4922f7a](https://github.com/gregberge/svgr/commit/4922f7a)), closes [#118](https://github.com/gregberge/svgr/issues/118)\n"
  },
  {
    "path": "packages/core/README.md",
    "content": "# @svgr/core\n\n[![Build Status][build-badge]][build]\n[![version][version-badge]][package]\n[![MIT License][license-badge]][license]\n\nNode API of SVGR.\n\n```\nnpm install @svgr/core\n```\n\n## Usage\n\n```js\nimport { transform } from '@svgr/core'\n\nconst svgCode = `\n<svg xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <rect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n    style=\"stroke:#ff0000; fill: #0000ff\"/>\n</svg>\n`\n\ntransform(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(\n  (jsCode) => {\n    console.log(jsCode)\n  },\n)\n```\n\nUse `svgr.sync(code, config, state)` if you would like to use sync version.\n\n### Plugins\n\nBy default `@svgr/core` doesn't include any plugin, if you want them, you have to install them and include them in config.\n\n```js\nsvgr(svgCode, {\n  plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],\n}).then((jsCode) => {\n  console.log(jsCode)\n})\n```\n\n## License\n\nMIT\n\n[build-badge]: https://img.shields.io/travis/smooth-code/svgr.svg?style=flat-square\n[build]: https://travis-ci.org/smooth-code/svgr\n[version-badge]: https://img.shields.io/npm/v/@svgr/core.svg?style=flat-square\n[package]: https://www.npmjs.com/package/@svgr/core\n[license-badge]: https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square\n[license]: https://github.com/smooth-code/svgr/blob/master/LICENSE\n"
  },
  {
    "path": "packages/core/package.json",
    "content": "{\n  \"name\": \"@svgr/core\",\n  \"description\": \"Transform SVG into React Components.\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/core\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr\",\n    \"svg\",\n    \"react\",\n    \"core\",\n    \"api\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"npm run reset && npm run build\"\n  },\n  \"dependencies\": {\n    \"@babel/core\": \"^7.21.3\",\n    \"@svgr/babel-preset\": \"workspace:*\",\n    \"camelcase\": \"^6.2.0\",\n    \"cosmiconfig\": \"^8.3.6\",\n    \"snake-case\": \"^3.0.4\"\n  },\n  \"devDependencies\": {\n    \"svgo\": \"^3.0.2\"\n  }\n}\n"
  },
  {
    "path": "packages/core/src/__fixtures__/svgo/svgo.config.js",
    "content": "module.exports = {\n  plugins: [\n    {\n      name: 'preset-default',\n      params: {\n        overrides: {\n          removeDesc: false,\n        },\n      },\n    },\n  ]\n}"
  },
  {
    "path": "packages/core/src/__fixtures__/svgr/.svgrrc",
    "content": "{\n    noSemi: true,\n    icon: true,\n    replaceAttrValues: [[\"#063855\", \"currentColor\"]]\n}"
  },
  {
    "path": "packages/core/src/__snapshots__/config.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`svgo async #loadConfig [async] should load config using filePath 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": true,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": true,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"noSemi\": true,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": [\n    [\n      \"#063855\",\n      \"currentColor\",\n    ],\n  ],\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n}\n`;\n\nexports[`svgo async #loadConfig [async] should not load config with \"runtimeConfig: false 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": true,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": true,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"noSemi\": true,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": [\n    [\n      \"#063855\",\n      \"currentColor\",\n    ],\n  ],\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n  \"useRuntimeConfig\": false,\n}\n`;\n\nexports[`svgo async #loadConfig [async] should use default config without state.filePath 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": false,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": false,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": undefined,\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n}\n`;\n\nexports[`svgo async #loadConfig [async] should work with custom config path 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": true,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": true,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"noSemi\": true,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": [\n    [\n      \"#063855\",\n      \"currentColor\",\n    ],\n  ],\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n}\n`;\n\nexports[`svgo sync #loadConfig [sync] should load config using filePath 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": true,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": true,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"noSemi\": true,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": [\n    [\n      \"#063855\",\n      \"currentColor\",\n    ],\n  ],\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n}\n`;\n\nexports[`svgo sync #loadConfig [sync] should not load config with \"runtimeConfig: false 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": true,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": true,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"noSemi\": true,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": [\n    [\n      \"#063855\",\n      \"currentColor\",\n    ],\n  ],\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n  \"useRuntimeConfig\": false,\n}\n`;\n\nexports[`svgo sync #loadConfig [sync] should use default config without state.filePath 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": false,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": false,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": undefined,\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n}\n`;\n\nexports[`svgo sync #loadConfig [sync] should work with custom config path 1`] = `\n{\n  \"descProp\": false,\n  \"dimensions\": true,\n  \"expandProps\": \"end\",\n  \"exportType\": \"default\",\n  \"icon\": true,\n  \"index\": false,\n  \"memo\": false,\n  \"namedExport\": \"ReactComponent\",\n  \"native\": false,\n  \"noSemi\": true,\n  \"prettier\": true,\n  \"prettierConfig\": undefined,\n  \"ref\": false,\n  \"replaceAttrValues\": [\n    [\n      \"#063855\",\n      \"currentColor\",\n    ],\n  ],\n  \"runtimeConfig\": true,\n  \"svgProps\": undefined,\n  \"svgo\": true,\n  \"svgoConfig\": undefined,\n  \"template\": undefined,\n  \"titleProp\": false,\n  \"typescript\": false,\n}\n`;\n"
  },
  {
    "path": "packages/core/src/__snapshots__/transform.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`convert config accepts options {\"descProp\":true} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = ({ desc, descId, ...props }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={88}\n    height={88}\n    aria-describedby={descId}\n    {...props}\n  >\n    {desc ? <desc id={descId}>{desc}</desc> : null}\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"dimensions\":false} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 88 88\" {...props}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"expandProps\":\"start\"} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg {...props} xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"expandProps\":false} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = () => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"exportType\":\"named\"} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport { SvgComponent as ReactComponent }\n\"\n`;\n\nexports[`convert config accepts options {\"icon\":\"2em\"} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"2em\"\n    height=\"2em\"\n    viewBox=\"0 0 88 88\"\n    {...props}\n  >\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"icon\":24} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={24}\n    height={24}\n    viewBox=\"0 0 88 88\"\n    {...props}\n  >\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"icon\":true} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"1em\"\n    height=\"1em\"\n    viewBox=\"0 0 88 88\"\n    {...props}\n  >\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"memo\":true} 1`] = `\n\"import * as React from 'react'\nimport { memo } from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nconst Memo = memo(SvgComponent)\nexport default Memo\n\"\n`;\n\nexports[`convert config accepts options {\"namedExport\":\"Component\",\"state\":{\"caller\":{\"previousExport\":\"export default \\\\\"logo.svg\\\\\";\"}}} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport { SvgComponent as Component }\nexport default 'logo.svg'\n\"\n`;\n\nexports[`convert config accepts options {\"native\":true,\"expandProps\":false} 1`] = `\n\"import * as React from 'react'\nimport Svg, { G, Path } from 'react-native-svg'\nconst SvgComponent = () => (\n  <Svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88}>\n    <G\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <Path d=\"M51 37 37 51M51 51 37 37\" />\n    </G>\n  </Svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"native\":true,\"icon\":true} 1`] = `\n\"import * as React from 'react'\nimport Svg, { G, Path } from 'react-native-svg'\nconst SvgComponent = (props) => (\n  <Svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={24}\n    height={24}\n    viewBox=\"0 0 88 88\"\n    {...props}\n  >\n    <G\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <Path d=\"M51 37 37 51M51 51 37 37\" />\n    </G>\n  </Svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"native\":true,\"ref\":true} 1`] = `\n\"import * as React from 'react'\nimport Svg, { G, Path } from 'react-native-svg'\nimport { forwardRef } from 'react'\nconst SvgComponent = (props, ref) => (\n  <Svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={88}\n    height={88}\n    ref={ref}\n    {...props}\n  >\n    <G\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <Path d=\"M51 37 37 51M51 51 37 37\" />\n    </G>\n  </Svg>\n)\nconst ForwardRef = forwardRef(SvgComponent)\nexport default ForwardRef\n\"\n`;\n\nexports[`convert config accepts options {\"native\":true} 1`] = `\n\"import * as React from 'react'\nimport Svg, { G, Path } from 'react-native-svg'\nconst SvgComponent = (props) => (\n  <Svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <G\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <Path d=\"M51 37 37 51M51 51 37 37\" />\n    </G>\n  </Svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"prettier\":false} 1`] = `\n\"import * as React from \"react\";\nconst SvgComponent = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}><g fill=\"none\" fillRule=\"evenodd\" stroke=\"#063855\" strokeLinecap=\"square\" strokeWidth={2}><path d=\"M51 37 37 51M51 51 37 37\" /></g></svg>;\nexport default SvgComponent;\"\n`;\n\nexports[`convert config accepts options {\"ref\":true} 1`] = `\n\"import * as React from 'react'\nimport { forwardRef } from 'react'\nconst SvgComponent = (props, ref) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={88}\n    height={88}\n    ref={ref}\n    {...props}\n  >\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nconst ForwardRef = forwardRef(SvgComponent)\nexport default ForwardRef\n\"\n`;\n\nexports[`convert config accepts options {\"replaceAttrValues\":{\"none\":\"{black}\"}} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <g\n      fill={black}\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"replaceAttrValues\":{\"none\":\"black\"}} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <g\n      fill=\"black\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"svgProps\":{\"a\":\"b\",\"b\":\"{props.b}\"}} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={88}\n    height={88}\n    a=\"b\"\n    b={props.b}\n    {...props}\n  >\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"svgo\":false} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    width=\"88px\"\n    height=\"88px\"\n    viewBox=\"0 0 88 88\"\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n    {...props}\n  >\n    <title>{'Dismiss'}</title>\n    <desc>{'Created with Sketch.'}</desc>\n    <defs />\n    <g\n      id=\"Blocks\"\n      stroke=\"none\"\n      strokeWidth={1}\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      strokeLinecap=\"square\"\n    >\n      <g id=\"Dismiss\" stroke=\"#063855\" strokeWidth={2}>\n        <path d=\"M51,37 L37,51\" id=\"Shape\" />\n        <path d=\"M51,51 L37,37\" id=\"Shape\" />\n      </g>\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {\"titleProp\":true} 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = ({ title, titleId, ...props }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width={88}\n    height={88}\n    aria-labelledby={titleId}\n    {...props}\n  >\n    {title ? <title id={titleId}>{title}</title> : null}\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config accepts options {} 1`] = `\n\"const noop = () => null\nexport default noop\n\"\n`;\n\nexports[`convert config descProp: without desc added 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = ({ desc, descId, ...props }) => (\n  <svg\n    width={0}\n    height={0}\n    style={{\n      position: 'absolute',\n    }}\n    aria-describedby={descId}\n    {...props}\n  >\n    {desc ? <desc id={descId}>{desc}</desc> : null}\n    <path fill=\"none\" d=\"M0 0h24v24H0z\" />\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert config titleProp: without title added 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = ({ title, titleId, ...props }) => (\n  <svg\n    width={0}\n    height={0}\n    style={{\n      position: 'absolute',\n    }}\n    aria-labelledby={titleId}\n    {...props}\n  >\n    {title ? <title id={titleId}>{title}</title> : null}\n    <path fill=\"none\" d=\"M0 0h24v24H0z\" />\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert should convert 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"#063855\"\n      strokeLinecap=\"square\"\n      strokeWidth={2}\n    >\n      <path d=\"M51 37 37 51M51 51 37 37\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert should convert style attribute 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n    width={48}\n    height={48}\n    {...props}\n  >\n    <g transform=\"translate(0 -1004.362)\">\n      <g id=\"prefix__a\">\n        <rect\n          width={4}\n          height={4}\n          x={4}\n          y={1010.362}\n          rx={0.2}\n          ry={0.2}\n          style={{\n            color: '#000',\n            fill: '#a3a3a3',\n            fillOpacity: 1,\n            fillRule: 'nonzero',\n            stroke: 'none',\n            strokeWidth: 8,\n            marker: 'none',\n            visibility: 'visible',\n            display: 'inline',\n            overflow: 'visible',\n            enableBackground: 'accumulate',\n          }}\n        />\n        <rect\n          width={32}\n          height={4}\n          x={12}\n          y={1010.362}\n          rx={0.2}\n          ry={0.2}\n          style={{\n            color: '#000',\n            fill: '#a3a3a3',\n            fillOpacity: 1,\n            fillRule: 'nonzero',\n            stroke: 'none',\n            strokeWidth: 8,\n            marker: 'none',\n            visibility: 'visible',\n            display: 'inline',\n            overflow: 'visible',\n            enableBackground: 'accumulate',\n          }}\n        />\n      </g>\n      <use xlinkHref=\"#prefix__a\" />\n      <use xlinkHref=\"#prefix__a\" transform=\"translate(0 8)\" />\n      <use xlinkHref=\"#prefix__a\" transform=\"translate(0 16)\" />\n      <use xlinkHref=\"#prefix__a\" transform=\"translate(0 24)\" />\n      <use xlinkHref=\"#prefix__a\" transform=\"translate(0 32)\" />\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert should handle special SVG attributes 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n    <path d=\"M10 10h100v100H10z\" externalResourcesRequired=\"false\" />\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert should not remove all style tags 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <style>{'path{fill:red}'}</style>\n    <g\n      id=\"prefix__Blocks\"\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      stroke=\"none\"\n      strokeLinecap=\"square\"\n      strokeWidth={1}\n    >\n      <g id=\"prefix__Dismiss\" stroke=\"#063855\" strokeWidth={2}>\n        <path id=\"prefix__Shape\" d=\"M51 37 37 51\" />\n        <path d=\"M51 51 37 37\" />\n      </g>\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert should remove null characters 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlSpace=\"preserve\"\n    width={25}\n    height={25}\n    style={{\n      enableBackground: 'new 0 0 25 25',\n    }}\n    {...props}\n  >\n    <path\n      d=\"M19.4 24.5H5.6c-2.8 0-5.1-2.3-5.1-5.1V5.6C.5 2.8 2.8.5 5.6.5h13.8c2.8 0 5.1 2.3 5.1 5.1v13.8c0 2.8-2.3 5.1-5.1 5.1z\"\n      style={{\n        fill: '#fff',\n        stroke: '#434a54',\n        strokeMiterlimit: 10,\n      }}\n    />\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n\nexports[`convert should remove style tags 1`] = `\n\"import * as React from 'react'\nconst SvgComponent = (props) => (\n  <svg xmlns=\"http://www.w3.org/2000/svg\" width={88} height={88} {...props}>\n    <style />\n    <g\n      fill=\"none\"\n      fillRule=\"evenodd\"\n      strokeLinecap=\"square\"\n      style={{\n        fill: 'red',\n      }}\n    >\n      <g id=\"prefix__Dismiss\" stroke=\"#063855\" strokeWidth={2}>\n        <path id=\"prefix__Shape\" d=\"M51 37 37 51\" />\n        <path d=\"M51 51 37 37\" />\n      </g>\n    </g>\n  </svg>\n)\nexport default SvgComponent\n\"\n`;\n"
  },
  {
    "path": "packages/core/src/config.test.ts",
    "content": "import * as path from 'path'\nimport { resolveConfig, resolveConfigFile, loadConfig } from './config'\n\nconst getMethod = (method: any, mode: string) =>\n  mode === 'sync' ? method.sync : method\n\ndescribe('svgo', () => {\n  describe.each([['sync'], ['async']])('%s', (mode) => {\n    describe(`#resolveConfig [${mode}]`, () => {\n      it('should return null if no config found', async () => {\n        const config = await getMethod(resolveConfig, mode)('/tmp')\n        expect(config).toBe(null)\n      })\n\n      it('should return config if found', async () => {\n        const config = await getMethod(\n          resolveConfig,\n          mode,\n        )(path.join(__dirname, '__fixtures__/svgr'))\n        expect(config).toEqual({\n          icon: true,\n          noSemi: true,\n          replaceAttrValues: [['#063855', 'currentColor']],\n        })\n      })\n    })\n\n    describe(`#resolveConfigFile [${mode}]`, () => {\n      it('should return null if no config found', async () => {\n        const config = await getMethod(resolveConfigFile, mode)('/tmp')\n        expect(config).toBe(null)\n      })\n\n      it('should return config path if found', async () => {\n        const config = await getMethod(\n          resolveConfigFile,\n          mode,\n        )(path.join(__dirname, '__fixtures__/svgr'))\n        expect(config).toMatch(/__fixtures__(\\/|\\\\)svgr(\\/|\\\\)\\.svgrrc$/)\n      })\n    })\n\n    describe(`#loadConfig [${mode}]`, () => {\n      it('should use default config without state.filePath', async () => {\n        const config = await getMethod(loadConfig, mode)({ dimensions: false })\n        expect(config).toMatchSnapshot()\n      })\n\n      it('should load config using filePath', async () => {\n        const config = await getMethod(loadConfig, mode)(\n          {},\n          { filePath: path.join(__dirname, '__fixtures__/svgr/icon.svg') },\n        )\n        expect(config).toMatchSnapshot()\n      })\n\n      it('should not load config with \"runtimeConfig: false', async () => {\n        const config = await getMethod(loadConfig, mode)(\n          { useRuntimeConfig: false },\n          { filePath: path.join(__dirname, '__fixtures__/svgr/icon.svg') },\n        )\n        expect(config).toMatchSnapshot()\n      })\n\n      it('should work with custom config path', async () => {\n        const config = await getMethod(loadConfig, mode)(\n          { configFile: path.join(__dirname, '__fixtures__/svgr/.svgrrc') },\n          { filePath: __dirname },\n        )\n        expect(config).toMatchSnapshot()\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/core/src/config.ts",
    "content": "import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig'\nimport type { Options as PrettierOptions } from 'prettier'\nimport type { Config as SvgoConfig } from 'svgo'\nimport type { Options as TransformOptions } from '@svgr/babel-preset'\nimport type { TransformOptions as BabelTransformOptions } from '@babel/core'\nimport type { ConfigPlugin } from './plugins'\nimport type { State } from './state'\n\nexport interface Config {\n  ref?: boolean\n  titleProp?: boolean\n  descProp?: boolean\n  expandProps?: boolean | 'start' | 'end'\n  dimensions?: boolean\n  icon?: boolean | string | number\n  native?: boolean\n  svgProps?: {\n    [key: string]: string\n  }\n  replaceAttrValues?: {\n    [key: string]: string\n  }\n  runtimeConfig?: boolean\n  typescript?: boolean\n  prettier?: boolean\n  prettierConfig?: PrettierOptions\n  svgo?: boolean\n  svgoConfig?: SvgoConfig\n  configFile?: string\n  template?: TransformOptions['template']\n  memo?: boolean\n  exportType?: 'named' | 'default'\n  namedExport?: string\n  jsxRuntime?: 'classic' | 'classic-preact' | 'automatic'\n  jsxRuntimeImport?: {\n    source: string\n    namespace?: string\n    specifiers?: string[]\n    defaultSpecifier?: string\n  }\n\n  // CLI only\n  index?: boolean\n  plugins?: ConfigPlugin[]\n\n  // JSX\n  jsx?: {\n    babelConfig?: BabelTransformOptions\n  }\n}\n\nexport const DEFAULT_CONFIG: Config = {\n  dimensions: true,\n  expandProps: 'end',\n  icon: false,\n  native: false,\n  typescript: false,\n  prettier: true,\n  prettierConfig: undefined,\n  memo: false,\n  ref: false,\n  replaceAttrValues: undefined,\n  svgProps: undefined,\n  svgo: true,\n  svgoConfig: undefined,\n  template: undefined,\n  index: false,\n  titleProp: false,\n  descProp: false,\n  runtimeConfig: true,\n  namedExport: 'ReactComponent',\n  exportType: 'default',\n}\n\nconst explorer = cosmiconfig('svgr')\nconst explorerSync = cosmiconfigSync('svgr')\n\nexport const resolveConfig = async (\n  searchFrom?: string,\n  configFile?: string,\n): Promise<Config | null> => {\n  if (configFile == null) {\n    const result = await explorer.search(searchFrom)\n    return result ? result.config : null\n  }\n  const result = await explorer.load(configFile)\n  return result ? result.config : null\n}\n\nresolveConfig.sync = (\n  searchFrom?: string,\n  configFile?: string,\n): Config | null => {\n  if (configFile == null) {\n    const result = explorerSync.search(searchFrom)\n    return result ? result.config : null\n  }\n  const result = explorerSync.load(configFile)\n  return result ? result.config : null\n}\n\nexport const resolveConfigFile = async (\n  filePath: string,\n): Promise<string | null> => {\n  const result = await explorer.search(filePath)\n  return result ? result.filepath : null\n}\n\nresolveConfigFile.sync = (filePath: string): string | null => {\n  const result = explorerSync.search(filePath)\n  return result ? result.filepath : null\n}\n\nexport const loadConfig = async (\n  { configFile, ...baseConfig }: Config,\n  state: Pick<State, 'filePath'> = {},\n): Promise<Config> => {\n  const rcConfig =\n    state.filePath && baseConfig.runtimeConfig !== false\n      ? await resolveConfig(state.filePath, configFile)\n      : {}\n  return { ...DEFAULT_CONFIG, ...baseConfig, ...rcConfig }\n}\n\nloadConfig.sync = (\n  { configFile, ...baseConfig }: Config,\n  state: Pick<State, 'filePath'> = {},\n): Config => {\n  const rcConfig =\n    state.filePath && baseConfig.runtimeConfig !== false\n      ? resolveConfig.sync(state.filePath, configFile)\n      : {}\n  return { ...DEFAULT_CONFIG, ...baseConfig, ...rcConfig }\n}\n"
  },
  {
    "path": "packages/core/src/index.ts",
    "content": "export { transform } from './transform'\nexport * from './config'\nexport type { State } from './state'\nexport type { Plugin, ConfigPlugin } from './plugins'\n"
  },
  {
    "path": "packages/core/src/plugins.test.ts",
    "content": "import jsx from '@svgr/plugin-jsx'\nimport { getPlugins, resolvePlugin } from './plugins'\nimport { State, Config } from '.'\n\ndescribe('#getPlugins', () => {\n  const state: Partial<State> = {\n    caller: { defaultPlugins: ['from-state-plugin'] },\n  }\n  const config: Config = { plugins: ['from-config'] }\n\n  it('should use config if plugins are specified in', () => {\n    expect(getPlugins(config, state)).toEqual(['from-config'])\n  })\n\n  it('should use caller.defaultPlugins in second choice', () => {\n    expect(getPlugins({}, state)).toEqual(['from-state-plugin'])\n  })\n\n  it('should default to []', () => {\n    expect(getPlugins({}, {})).toEqual([])\n  })\n\n  it('should support caller with \"defaultPlugins\" in second choice', () => {\n    expect(getPlugins({}, { caller: {} })).toEqual([])\n  })\n})\n\ndescribe('#resolvePlugin', () => {\n  it('should use function', () => {\n    expect(resolvePlugin(jsx)).toBe(jsx)\n  })\n\n  it('should throw if not found', () => {\n    expect(() => resolvePlugin('not-found-plugin')).toThrow(\n      'Module \"not-found-plugin\" missing. Maybe `npm install not-found-plugin` could help!',\n    )\n  })\n\n  it('should load plugin', () => {\n    expect(resolvePlugin('@svgr/plugin-jsx')).toBe(jsx)\n  })\n})\n"
  },
  {
    "path": "packages/core/src/plugins.ts",
    "content": "import { Config } from './config'\nimport type { State } from './state'\n\nexport interface Plugin {\n  (code: string, config: Config, state: State): string\n}\n\nexport type ConfigPlugin = string | Plugin\n\nconst DEFAULT_PLUGINS: Plugin[] = []\n\nexport const getPlugins = (\n  config: Config,\n  state: Partial<State>,\n): ConfigPlugin[] => {\n  if (config.plugins) {\n    return config.plugins\n  }\n\n  if (state.caller?.defaultPlugins) {\n    return state.caller.defaultPlugins\n  }\n\n  return DEFAULT_PLUGINS\n}\n\nexport const resolvePlugin = (plugin: ConfigPlugin): Plugin => {\n  if (typeof plugin === 'function') {\n    return plugin\n  }\n\n  if (typeof plugin === 'string') {\n    return loadPlugin(plugin)\n  }\n\n  throw new Error(`Invalid plugin \"${plugin}\"`)\n}\n\nconst pluginCache: Record<string, Plugin> = {}\n\nconst resolveModule = (m: any) => (m ? m.default || m : null)\n\nexport const loadPlugin = (moduleName: string): Plugin => {\n  if (pluginCache[moduleName]) {\n    return pluginCache[moduleName]\n  }\n\n  try {\n    // eslint-disable-next-line\n    const plugin = resolveModule(require(moduleName))\n    if (!plugin) {\n      throw new Error(`Invalid plugin \"${moduleName}\"`)\n    }\n    pluginCache[moduleName] = plugin\n    return pluginCache[moduleName]\n  } catch (error) {\n    console.log(error)\n    throw new Error(\n      `Module \"${moduleName}\" missing. Maybe \\`npm install ${moduleName}\\` could help!`,\n    )\n  }\n}\n"
  },
  {
    "path": "packages/core/src/state.test.ts",
    "content": "import { expandState } from './state'\n\ndescribe('state', () => {\n  describe('#expandState', () => {\n    it('should transform filePath into a component name', () => {\n      expect(expandState({})).toEqual({ componentName: 'SvgComponent' })\n      expect(expandState({ filePath: 'hello.svg' })).toEqual({\n        filePath: 'hello.svg',\n        componentName: 'SvgHello',\n      })\n      expect(expandState({ filePath: 'hello-you.svg' })).toEqual({\n        filePath: 'hello-you.svg',\n        componentName: 'SvgHelloYou',\n      })\n      expect(expandState({ filePath: 'hello_you.svg' })).toEqual({\n        filePath: 'hello_you.svg',\n        componentName: 'SvgHelloYou',\n      })\n      expect(expandState({ filePath: '1_big_svg.svg' })).toEqual({\n        filePath: '1_big_svg.svg',\n        componentName: 'Svg1BigSvg',\n      })\n      expect(expandState({ filePath: 'a&b~c-d_e.svg' })).toEqual({\n        filePath: 'a&b~c-d_e.svg',\n        componentName: 'SvgAbcDE',\n      })\n      expect(expandState({ filePath: 'Arrow up.svg' })).toEqual({\n        filePath: 'Arrow up.svg',\n        componentName: 'SvgArrowUp',\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/core/src/state.ts",
    "content": "import { parse as parsePath } from 'path'\n// @ts-ignore\nimport camelCase from 'camelcase'\nimport type { ConfigPlugin } from './plugins'\n\nexport interface State {\n  filePath?: string\n  componentName: string\n  caller?: {\n    name?: string\n    previousExport?: string | null\n    defaultPlugins?: ConfigPlugin[]\n  }\n}\n\nconst VALID_CHAR_REGEX = /[^a-zA-Z0-9 _-]/g\n\nconst getComponentName = (filePath?: string): string => {\n  if (!filePath) return 'SvgComponent'\n  const pascalCaseFileName = camelCase(\n    parsePath(filePath).name.replace(VALID_CHAR_REGEX, ''),\n    {\n      pascalCase: true,\n    },\n  )\n  return `Svg${pascalCaseFileName}`\n}\n\nexport const expandState = (state: Partial<State>): State => {\n  return {\n    componentName: state.componentName || getComponentName(state.filePath),\n    ...state,\n  }\n}\n"
  },
  {
    "path": "packages/core/src/transform.test.ts",
    "content": "import { transform, Config, State } from '.'\n\nfunction convertWithAllPlugins(\n  code: string,\n  config?: Config,\n  state?: Partial<State>,\n) {\n  return transform(\n    code,\n    {\n      plugins: [\n        '@svgr/plugin-svgo',\n        '@svgr/plugin-jsx',\n        '@svgr/plugin-prettier',\n      ],\n      ...config,\n    },\n    state,\n  )\n}\n\nfunction convertSyncWithAllPlugins(\n  code: string,\n  config?: Config,\n  state?: Partial<State>,\n) {\n  return transform.sync(\n    code,\n    {\n      plugins: [\n        '@svgr/plugin-svgo',\n        '@svgr/plugin-jsx',\n        '@svgr/plugin-prettier',\n      ],\n      ...config,\n    },\n    state,\n  )\n}\n\nconst svgBaseCode = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n    <title>Dismiss</title>\n    <desc>Created with Sketch.</desc>\n    <defs></defs>\n    <g id=\"Blocks\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\">\n        <g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\">\n            <path d=\"M51,37 L37,51\" id=\"Shape\"></path>\n            <path d=\"M51,51 L37,37\" id=\"Shape\"></path>\n        </g>\n    </g>\n</svg>\n`\n\ndescribe('convert', () => {\n  it('should convert', async () => {\n    const result = await convertWithAllPlugins(svgBaseCode)\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should work synchronously', async () => {\n    const syncResult = convertSyncWithAllPlugins(svgBaseCode)\n    const asyncResult = await convertWithAllPlugins(svgBaseCode)\n    expect(syncResult).toEqual(asyncResult)\n  })\n\n  it('should remove style tags', async () => {\n    const result = await convertWithAllPlugins(\n      `\n      <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n      <svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n          <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n          <title>Dismiss</title>\n          <desc>Created with Sketch.</desc>\n          <defs></defs>\n          <style>\n            #Blocks {\n              fill: red;\n            }\n          </style>\n          <g id=\"Blocks\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\">\n              <g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\">\n                  <path d=\"M51,37 L37,51\" id=\"Shape\"></path>\n                  <path d=\"M51,51 L37,37\" id=\"Shape\"></path>\n              </g>\n              <style>\n                #Shape {}\n              </style>\n          </g>\n      </svg>\n    `,\n    )\n\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should not remove all style tags', async () => {\n    const result = await convertWithAllPlugins(\n      `\n      <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n      <svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n          <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n          <title>Dismiss</title>\n          <desc>Created with Sketch.</desc>\n          <defs></defs>\n          <style>\n            path {\n              fill: red;\n            }\n          </style>\n          <g id=\"Blocks\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\">\n              <g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\">\n                  <path d=\"M51,37 L37,51\" id=\"Shape\"></path>\n                  <path d=\"M51,51 L37,37\" id=\"Shape\"></path>\n              </g>\n              <style>\n                #Shape {}\n              </style>\n          </g>\n      </svg>\n    `,\n    )\n\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should handle special SVG attributes', async () => {\n    const result = await convertWithAllPlugins(\n      `\n      <svg xmlns=\"http://www.w3.org/2000/svg\">\n        <rect x=\"10\" y=\"10\" width=\"100\" height=\"100\" externalResourcesRequired=\"false\" />\n      </svg>\n    `,\n    )\n\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should convert style attribute', async () => {\n    const result = await convertWithAllPlugins(\n      `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!-- Created with Inkscape (http://www.inkscape.org/) -->\n\n<svg\n   xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n   xmlns:cc=\"http://creativecommons.org/ns#\"\n   xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n   xmlns:svg=\"http://www.w3.org/2000/svg\"\n   xmlns=\"http://www.w3.org/2000/svg\"\n   xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n   xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n   xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n   width=\"48\"\n   height=\"48\"\n   id=\"svg2\"\n   version=\"1.1\"\n   inkscape:version=\"0.48.4 r9939\"\n   sodipodi:docname=\"list.inkscape.svg\">\n  <defs\n     id=\"defs4\" />\n  <sodipodi:namedview\n     id=\"base\"\n     pagecolor=\"#ffffff\"\n     bordercolor=\"#666666\"\n     borderopacity=\"1.0\"\n     inkscape:pageopacity=\"0.0\"\n     inkscape:pageshadow=\"2\"\n     inkscape:zoom=\"15.839192\"\n     inkscape:cx=\"25.129629\"\n     inkscape:cy=\"28.031549\"\n     inkscape:document-units=\"px\"\n     inkscape:current-layer=\"layer1\"\n     showgrid=\"true\"\n     inkscape:window-width=\"1920\"\n     inkscape:window-height=\"2050\"\n     inkscape:window-x=\"0\"\n     inkscape:window-y=\"55\"\n     inkscape:window-maximized=\"0\">\n    <inkscape:grid\n       type=\"xygrid\"\n       id=\"grid2985\"\n       empspacing=\"4\"\n       visible=\"true\"\n       enabled=\"true\"\n       snapvisiblegridlinesonly=\"true\"\n       dotted=\"true\" />\n  </sodipodi:namedview>\n  <metadata\n     id=\"metadata7\">\n    <rdf:RDF>\n      <cc:Work\n         rdf:about=\"\">\n        <dc:format>image/svg+xml</dc:format>\n        <dc:type\n           rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n        <dc:title></dc:title>\n      </cc:Work>\n    </rdf:RDF>\n  </metadata>\n  <g\n     inkscape:label=\"Layer 1\"\n     inkscape:groupmode=\"layer\"\n     id=\"layer1\"\n     transform=\"translate(0,-1004.3622)\">\n    <g\n       id=\"g4238\"\n       transform=\"translate(0,1.7382813e-5)\"\n       inkscape:tile-cx=\"24\"\n       inkscape:tile-cy=\"42\"\n       inkscape:tile-w=\"40\"\n       inkscape:tile-h=\"4\"\n       inkscape:tile-x0=\"4\"\n       inkscape:tile-y0=\"40\">\n      <rect\n         style=\"color:#000000;fill:#a3a3a3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:8;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate\"\n         id=\"rect4240\"\n         width=\"4\"\n         height=\"4\"\n         x=\"4\"\n         y=\"1010.3622\"\n         rx=\"0.2\"\n         ry=\"0.2\" />\n      <rect\n         ry=\"0.2\"\n         rx=\"0.2\"\n         y=\"1010.3622\"\n         x=\"12\"\n         height=\"4\"\n         width=\"32\"\n         id=\"rect4242\"\n         style=\"color:#000000;fill:#a3a3a3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:8;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate\" />\n    </g>\n    <use\n       x=\"0\"\n       y=\"0\"\n       inkscape:tiled-clone-of=\"#g4238\"\n       xlink:href=\"#g4238\"\n       id=\"use4358\" />\n    <use\n       x=\"0\"\n       y=\"0\"\n       inkscape:tiled-clone-of=\"#g4238\"\n       xlink:href=\"#g4238\"\n       transform=\"translate(0,8)\"\n       id=\"use4360\" />\n    <use\n       x=\"0\"\n       y=\"0\"\n       inkscape:tiled-clone-of=\"#g4238\"\n       xlink:href=\"#g4238\"\n       transform=\"translate(0,16)\"\n       id=\"use4362\" />\n    <use\n       x=\"0\"\n       y=\"0\"\n       inkscape:tiled-clone-of=\"#g4238\"\n       xlink:href=\"#g4238\"\n       transform=\"translate(0,24)\"\n       id=\"use4364\" />\n    <use\n       x=\"0\"\n       y=\"0\"\n       inkscape:tiled-clone-of=\"#g4238\"\n       xlink:href=\"#g4238\"\n       transform=\"translate(0,32)\"\n       id=\"use4366\" />\n  </g>\n</svg>`,\n    )\n\n    expect(result).toMatchSnapshot()\n  })\n\n  it('should remove null characters', async () => {\n    const result = await convertWithAllPlugins(\n      `<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In  -->\n<svg version=\"1.1\"\n\t xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:a=\"http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/\"\n\t x=\"0px\" y=\"0px\" width=\"25px\" height=\"25px\" viewBox=\"0 0 25 25\" style=\"enable-background:new 0 0 25 25;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#FFFFFF;stroke:#434A54;stroke-miterlimit:10;}\n</style>\n<defs>\n</defs>\n<path class=\"st0\" d=\"M19.4,24.5H5.6c-2.8,0-5.1-2.3-5.1-5.1V5.6c0-2.8,2.3-5.1,5.1-5.1h13.8c2.8,0,5.1,2.3,5.1,5.1v13.8\n\tC24.5,22.2,22.2,24.5,19.4,24.5z\"/>\n</svg>\n\\0`,\n    )\n\n    expect(result).toMatchSnapshot()\n    expect(result).not.toContain('\\0')\n  })\n\n  describe('config', () => {\n    const configs: (Config & { state?: Partial<State> })[] = [\n      { dimensions: false },\n      { expandProps: false },\n      { expandProps: 'start' },\n      { icon: true },\n      { icon: 24 },\n      { icon: '2em' },\n      { native: true },\n      { native: true, icon: true },\n      { native: true, expandProps: false },\n      { native: true, ref: true },\n      { ref: true },\n      { svgProps: { a: 'b', b: '{props.b}' } },\n      { replaceAttrValues: { none: 'black' } },\n      { replaceAttrValues: { none: '{black}' } },\n      { svgo: false },\n      { prettier: false },\n      {\n        template: (_, { tpl }) =>\n          tpl`const noop = () => null; export default noop;`,\n      },\n      { titleProp: true },\n      { descProp: true },\n      { memo: true },\n      {\n        namedExport: 'Component',\n        state: { caller: { previousExport: 'export default \"logo.svg\";' } },\n      },\n      { exportType: 'named' },\n    ]\n\n    test.each(configs)('accepts options %j', async ({ state, ...config }) => {\n      const result = await convertWithAllPlugins(svgBaseCode, config, state)\n      expect(result).toMatchSnapshot()\n    })\n\n    it('titleProp: without title added', async () => {\n      const svg = `\n      <svg width=\"0\" height=\"0\" style=\"position:absolute\">\n    <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n</svg>\n`\n      expect(\n        await convertWithAllPlugins(svg, { titleProp: true }),\n      ).toMatchSnapshot()\n    })\n\n    it('descProp: without desc added', async () => {\n      const svg = `\n      <svg width=\"0\" height=\"0\" style=\"position:absolute\">\n    <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n</svg>\n`\n      expect(\n        await convertWithAllPlugins(svg, { descProp: true }),\n      ).toMatchSnapshot()\n    })\n  })\n})\n"
  },
  {
    "path": "packages/core/src/transform.ts",
    "content": "import { expandState } from './state'\nimport { loadConfig } from './config'\nimport { resolvePlugin, getPlugins } from './plugins'\nimport type { Config } from './config'\nimport type { State } from './state'\n\nconst run = (code: string, config: Config, state: Partial<State>): string => {\n  const expandedState = expandState(state)\n  const plugins = getPlugins(config, state).map(resolvePlugin)\n  let nextCode = String(code).replace('\\0', '')\n  // eslint-disable-next-line no-restricted-syntax\n  for (const plugin of plugins) {\n    nextCode = plugin(nextCode, config, expandedState)\n  }\n  return nextCode\n}\n\nexport const transform = async (\n  code: string,\n  config: Config = {},\n  state: Partial<State> = {},\n): Promise<string> => {\n  config = await loadConfig(config, state)\n  return run(code, config, state)\n}\n\ntransform.sync = (\n  code: string,\n  config: Config = {},\n  state: Partial<State> = {},\n): string => {\n  config = loadConfig.sync(config, state)\n  return run(code, config, state)\n}\n"
  },
  {
    "path": "packages/core/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/.npmignore",
    "content": "src/\n.*\n/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/hast-util-to-babel-ast/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n### Bug Fixes\n\n- do not transform mask-type ([#673](https://github.com/gregberge/svgr/issues/673)) ([6e58f2c](https://github.com/gregberge/svgr/commit/6e58f2cb456bf5fbfa011ab8f8154333c0724e34)), closes [#643](https://github.com/gregberge/svgr/issues/643)\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n### Performance Improvements\n\n- replace rehype with svg-parser ([#321](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/issues/321)) ([7eb5ef6](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/commit/7eb5ef6))\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- **hast-util-to-babel-ast:** correctly handle aria attributes ([23d12aa](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/commit/23d12aa)), closes [#279](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/issues/279)\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n**Note:** Version bump only for package @svgr/hast-util-to-babel-ast\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n### Bug Fixes\n\n- **hast-util-to-babel-ast:** replace tabs by spaces in attributes ([b0f3d19](https://github.com/gregberge/svgr/commit/b0f3d19)), closes [#219](https://github.com/gregberge/svgr/issues/219)\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n### Bug Fixes\n\n- **hast-util-to-babel-ast:** correctly transforms data & aria attributes ([99711c4](https://github.com/gregberge/svgr/commit/99711c4)), closes [#221](https://github.com/gregberge/svgr/issues/221)\n- **hast-util-to-babel-ast:** replace line-breaks in attributes ([00a2625](https://github.com/gregberge/svgr/commit/00a2625)), closes [#219](https://github.com/gregberge/svgr/issues/219)\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/README.md",
    "content": "# @svgr/hast-util-to-babel-ast\n\n[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)\n[![Version](https://img.shields.io/npm/v/@svgr/hast-util-to-babel-ast.svg)](https://www.npmjs.com/package/@svgr/hast-util-to-babel-ast)\n[![MIT License](https://img.shields.io/npm/l/@svgr/hast-util-to-babel-ast.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)\n\nTransforms HAST into Babel AST.\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/hast-util-to-babel-ast\n```\n\n## Usage\n\n```js\nimport { parse } from 'svg-parser'\nimport hastToBabelAst from '@svgr/hast-util-to-babel-ast'\n\nconst hastTree = parse(`<svg></svg>`)\n\nconst babelTree = hastToBabelAst(hastTree)\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/package.json",
    "content": "{\n  \"name\": \"@svgr/hast-util-to-babel-ast\",\n  \"description\": \"Transform HAST to Babel AST (JSX)\",\n  \"version\": \"8.0.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/hast-util-to-babel-ast\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"html\",\n    \"hast\",\n    \"babel\",\n    \"hast-util\",\n    \"unist-util\",\n    \"unist\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"@babel/types\": \"^7.21.3\",\n    \"entities\": \"^4.4.0\"\n  },\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"npm run reset && npm run build\"\n  },\n  \"devDependencies\": {\n    \"@types/svg-parser\": \"^2.0.3\"\n  }\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/__snapshots__/index.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`hast-util-to-babel-ast should handle spaces and tab 1`] = `\"<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M25,5h-3V3c0-1.7-1.3-3-3-3H5C3.3,0,2,1.3,2,3v20c0,1.7,1.3,3,3,3h4v1c0,2.2,1.8,4,4,4h12c2.2,0,4-1.8,4-4V9        C29,6.8,27.2,5,25,5z M5,24c-0.6,0-1-0.5-1-1V3c0-0.6,0.4-1,1-1h14c0.5,0,1,0.4,1,1v2h-6.3H13H6.3c-0.6,0-1,0.4-1,1s0.4,1,1,1h3.2       C9.4,7.3,9.2,7.7,9.1,8C9.1,8,9,8,9,8H6.5c-0.6,0-1,0.4-1,1s0.4,1,1,1H9v3c-0.1,0-0.1,0-0.2,0H6.1c-0.6,0-1,0.4-1,1s0.4,1,1,1h2.7       c0.1,0,0.1,0,0.2,0V16c-0.1,0-0.1,0-0.2,0H6.1c-0.6,0-1,0.4-1,1c0,0.6,0.4,1,1,1h2.7c0.1,0,0.1,0,0.2,0V19c-0.1,0-0.1,0-0.2,0H6.1       c-0.6,0-1,0.4-1,1s0.4,1,1,1h2.7c0.1,0,0.1,0,0.2,0v3H5z M27,27c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h0.7H25       c1.1,0,2,0.9,2,2V27z M25.2,19c0,0.6-0.4,1-1,1H13.4c-0.6,0-1-0.4-1-1s0.4-1,1-1h10.7C24.7,18,25.2,18.4,25.2,19z M25.2,22       c0,0.6-0.4,1-1,1H13.4c-0.6,0-1-0.4-1-1s0.4-1,1-1h10.7C24.7,21,25.2,21.4,25.2,22z M25.2,25c0,0.6-0.4,1-1,1H13.4c-0.6,0-1-0.4-1-1       s0.4-1,1-1h10.7C24.7,24,25.2,24.4,25.2,25z M12.3,11c0-0.6,0.4-1,1-1h7.3c0.6,0,1,0.4,1,1s-0.4,1-1,1h-7.3       C12.8,12,12.3,11.6,12.3,11z M16,13c0.6,0,1,0.4,1,1s-0.4,1-1,1h-2.5c-0.6,0-1-0.4-1-1s0.4-1,1-1H16z\" /></svg>;\"`;\n\nexports[`hast-util-to-babel-ast transforms SVG 1`] = `\"<svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version={1.1} xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\"><title>{\"Dismiss\"}</title><desc>{\"Created with Sketch.\"}</desc><defs /><g id=\"Blocks\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\" strokeLinecap=\"square\"><g id=\"Dismiss\" stroke=\"#063855\" strokeWidth={2}><path d=\"M51,37 L37,51\" id=\"Shape\" /><path d=\"M51,51 L37,37\" id=\"Shape\" /></g></g></svg>;\"`;\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/all.ts",
    "content": "import { one } from './one'\nimport type * as t from '@babel/types'\nimport type { RootNode, ElementNode } from 'svg-parser'\nimport type { Helpers } from './helpers'\n\n/* Transform the children of `parent`. */\nexport const all = (\n  helpers: Helpers,\n  parent: RootNode | ElementNode,\n): (t.JSXElement | t.JSXExpressionContainer)[] => {\n  const nodes = parent.children || []\n  const { length } = nodes\n  const values = []\n  let index = -1\n\n  while (++index < length) {\n    const node = nodes[index]\n    if (typeof node !== 'string') {\n      const result = one(helpers, node, parent)\n      values.push(result)\n    }\n  }\n\n  return values.filter(Boolean) as (t.JSXElement | t.JSXExpressionContainer)[]\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/getAttributes.ts",
    "content": "import * as t from '@babel/types'\nimport type { ElementNode } from 'svg-parser'\nimport { isNumeric, kebabCase, replaceSpaces } from './util'\nimport { stringToObjectStyle } from './stringToObjectStyle'\nimport { ATTRIBUTE_MAPPING, ELEMENT_ATTRIBUTE_MAPPING } from './mappings'\n\nconst convertAriaAttribute = (kebabKey: string) => {\n  const [aria, ...parts] = kebabKey.split('-')\n  return `${aria}-${parts.join('').toLowerCase()}`\n}\n\nconst getKey = (key: string, node: ElementNode) => {\n  const lowerCaseKey = key.toLowerCase()\n  const mappedElementAttribute =\n    // @ts-ignore\n    ELEMENT_ATTRIBUTE_MAPPING[node.name] &&\n    // @ts-ignore\n    ELEMENT_ATTRIBUTE_MAPPING[node.name][lowerCaseKey]\n  // @ts-ignore\n  const mappedAttribute = ATTRIBUTE_MAPPING[lowerCaseKey]\n\n  if (mappedElementAttribute || mappedAttribute) {\n    return t.jsxIdentifier(mappedElementAttribute || mappedAttribute)\n  }\n\n  const kebabKey = kebabCase(key)\n\n  if (kebabKey.startsWith('aria-')) {\n    return t.jsxIdentifier(convertAriaAttribute(kebabKey))\n  }\n\n  if (kebabKey.startsWith('data-')) {\n    return t.jsxIdentifier(kebabKey)\n  }\n\n  return t.jsxIdentifier(key)\n}\n\nconst getValue = (key: string, value: string[] | string | number) => {\n  // Handle className\n  if (Array.isArray(value)) {\n    return t.stringLiteral(replaceSpaces(value.join(' ')))\n  }\n\n  if (key === 'style') {\n    return t.jsxExpressionContainer(stringToObjectStyle(value as string))\n  }\n\n  if (typeof value === 'number' || isNumeric(value)) {\n    return t.jsxExpressionContainer(t.numericLiteral(Number(value)))\n  }\n\n  return t.stringLiteral(replaceSpaces(value))\n}\n\nexport const getAttributes = (node: ElementNode): t.JSXAttribute[] => {\n  if (!node.properties) return []\n  const keys = Object.keys(node.properties)\n  const attributes = []\n  let index = -1\n\n  while (++index < keys.length) {\n    const key = keys[index]\n    const value = node.properties[key]\n    const attribute = t.jsxAttribute(getKey(key, node), getValue(key, value))\n    attributes.push(attribute)\n  }\n\n  return attributes\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/handlers.ts",
    "content": "import * as t from '@babel/types'\nimport { decodeXML } from 'entities'\nimport { all } from './all'\nimport { getAttributes } from './getAttributes'\nimport { ELEMENT_TAG_NAME_MAPPING } from './mappings'\nimport type { RootNode, ElementNode, TextNode } from 'svg-parser'\nimport type { Helpers } from './helpers'\n\nexport const root = (h: Helpers, node: RootNode): t.Program =>\n  // @ts-ignore\n  t.program(all(h, node))\n\nexport const comment = (\n  _: Helpers,\n  node: ElementNode,\n  parent: RootNode | ElementNode,\n): t.JSXExpressionContainer | null => {\n  if (parent.type === 'root' || !node.value) return null\n\n  const expression = t.jsxEmptyExpression()\n  t.addComment(expression, 'inner', node.value)\n  return t.jsxExpressionContainer(expression)\n}\n\nconst SPACE_REGEX = /^\\s+$/\n\nexport const text = (\n  h: Helpers,\n  node: TextNode,\n  parent: RootNode | ElementNode,\n): t.JSXExpressionContainer | null => {\n  if (parent.type === 'root') return null\n  if (typeof node.value === 'string' && SPACE_REGEX.test(node.value))\n    return null\n\n  return t.jsxExpressionContainer(\n    t.stringLiteral(decodeXML(String(node.value))),\n  )\n}\n\nexport const element = (\n  h: Helpers,\n  node: ElementNode,\n  parent: RootNode | ElementNode,\n): t.JSXElement | t.ExpressionStatement | null => {\n  if (!node.tagName) return null\n\n  const children = all(h, node)\n  const selfClosing = children.length === 0\n\n  const name = ELEMENT_TAG_NAME_MAPPING[node.tagName] || node.tagName\n\n  const openingElement = t.jsxOpeningElement(\n    t.jsxIdentifier(name),\n    getAttributes(node),\n    selfClosing,\n  )\n\n  const closingElement = !selfClosing\n    ? t.jsxClosingElement(t.jsxIdentifier(name))\n    : null\n\n  const jsxElement = t.jsxElement(openingElement, closingElement, children)\n\n  if (parent.type === 'root') {\n    return t.expressionStatement(jsxElement)\n  }\n\n  return jsxElement\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/helpers.ts",
    "content": "import * as handlers from './handlers'\n\nexport const helpers = { handlers }\n\nexport type Helpers = typeof helpers\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/index.test.ts",
    "content": "import { parse } from 'svg-parser'\nimport generate from '@babel/generator'\nimport hastToBabelAst from './index'\n\nfunction transform(code: string) {\n  const hastTree = parse(code)\n\n  const babelTree = hastToBabelAst(hastTree)\n\n  const { code: generatedCode } = generate(babelTree)\n\n  return generatedCode\n}\n\ndescribe('hast-util-to-babel-ast', () => {\n  it('transforms SVG', () => {\n    const code = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n    <title>Dismiss</title>\n    <desc>Created with Sketch.</desc>\n    <defs></defs>\n    <g id=\"Blocks\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\">\n        <g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\">\n            <path d=\"M51,37 L37,51\" id=\"Shape\"></path>\n            <path d=\"M51,51 L37,37\" id=\"Shape\"></path>\n        </g>\n    </g>\n</svg>\n`\n    expect(transform(code)).toMatchSnapshot()\n  })\n\n  it('transforms \"aria-x\"', () => {\n    const code = `<svg aria-hidden=\"true\"></svg>`\n    expect(transform(code)).toMatchInlineSnapshot(\n      `\"<svg aria-hidden=\"true\" />;\"`,\n    )\n  })\n\n  it('transforms \"aria-xxxXxx\"', () => {\n    const code = `<svg aria-labelledby=\"foo\" aria-describedat=\"foo\" aria-describedby=\"foo\"></svg>`\n    expect(transform(code)).toMatchInlineSnapshot(\n      `\"<svg aria-labelledby=\"foo\" aria-describedat=\"foo\" aria-describedby=\"foo\" />;\"`,\n    )\n  })\n\n  it('transformss \"data-x\"', () => {\n    const code = `<svg data-hidden=\"true\"></svg>`\n    expect(transform(code)).toMatchInlineSnapshot(\n      `\"<svg data-hidden=\"true\" />;\"`,\n    )\n  })\n\n  it('preserves \"mask-type\"', () => {\n    const code = `<svg><mask mask-type=\"alpha\" /></svg>`\n    expect(transform(code)).toBe('<svg><mask mask-type=\"alpha\" /></svg>;')\n  })\n\n  it('should handle spaces and tab', () => {\n    const code = `<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n    <path d=\"M25,5h-3V3c0-1.7-1.3-3-3-3H5C3.3,0,2,1.3,2,3v20c0,1.7,1.3,3,3,3h4v1c0,2.2,1.8,4,4,4h12c2.2,0,4-1.8,4-4V9\n      \\tC29,6.8,27.2,5,25,5z M5,24c-0.6,0-1-0.5-1-1V3c0-0.6,0.4-1,1-1h14c0.5,0,1,0.4,1,1v2h-6.3H13H6.3c-0.6,0-1,0.4-1,1s0.4,1,1,1h3.2\n      C9.4,7.3,9.2,7.7,9.1,8C9.1,8,9,8,9,8H6.5c-0.6,0-1,0.4-1,1s0.4,1,1,1H9v3c-0.1,0-0.1,0-0.2,0H6.1c-0.6,0-1,0.4-1,1s0.4,1,1,1h2.7\n      c0.1,0,0.1,0,0.2,0V16c-0.1,0-0.1,0-0.2,0H6.1c-0.6,0-1,0.4-1,1c0,0.6,0.4,1,1,1h2.7c0.1,0,0.1,0,0.2,0V19c-0.1,0-0.1,0-0.2,0H6.1\n      c-0.6,0-1,0.4-1,1s0.4,1,1,1h2.7c0.1,0,0.1,0,0.2,0v3H5z M27,27c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h0.7H25\n      c1.1,0,2,0.9,2,2V27z M25.2,19c0,0.6-0.4,1-1,1H13.4c-0.6,0-1-0.4-1-1s0.4-1,1-1h10.7C24.7,18,25.2,18.4,25.2,19z M25.2,22\n      c0,0.6-0.4,1-1,1H13.4c-0.6,0-1-0.4-1-1s0.4-1,1-1h10.7C24.7,21,25.2,21.4,25.2,22z M25.2,25c0,0.6-0.4,1-1,1H13.4c-0.6,0-1-0.4-1-1\n      s0.4-1,1-1h10.7C24.7,24,25.2,24.4,25.2,25z M12.3,11c0-0.6,0.4-1,1-1h7.3c0.6,0,1,0.4,1,1s-0.4,1-1,1h-7.3\n      C12.8,12,12.3,11.6,12.3,11z M16,13c0.6,0,1,0.4,1,1s-0.4,1-1,1h-2.5c-0.6,0-1-0.4-1-1s0.4-1,1-1H16z\"/>\n    </svg>\n    `\n\n    expect(transform(code)).toMatchSnapshot()\n  })\n\n  it('string literals children of text nodes should have decoded XML entities', () => {\n    const code = `<svg><text>&lt;</text></svg>`\n    expect(transform(code)).toMatchInlineSnapshot(\n      `\"<svg><text>{\"<\"}</text></svg>;\"`,\n    )\n  })\n\n  it('string literals children of tspan nodes should have decoded XML entities', () => {\n    const code = `<svg><text><tspan>&lt;</tspan></text></svg>`\n    expect(transform(code)).toMatchInlineSnapshot(\n      `\"<svg><text><tspan>{\"<\"}</tspan></text></svg>;\"`,\n    )\n  })\n\n  it('properly converts style with variables', () => {\n    const code = `<svg><path style=\"--index: 1; font-size: 24px;\"></path><path style=\"--index: 2\"></path></svg>`\n    expect(transform(code)).toMatchInlineSnapshot(`\n      \"<svg><path style={{\n          \"--index\": 1,\n          fontSize: 24\n        }} /><path style={{\n          \"--index\": 2\n        }} /></svg>;\"\n    `)\n  })\n})\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/index.ts",
    "content": "import type { RootNode } from 'svg-parser'\nimport type * as t from '@babel/types'\nimport { root } from './handlers'\nimport { helpers } from './helpers'\n\nconst toBabelAST = (tree: RootNode): t.Program => root(helpers, tree)\n\nexport default toBabelAST\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/mappings.ts",
    "content": "// From https://raw.githubusercontent.com/facebook/react/master/packages/react-dom/src/shared/possibleStandardNames.js\nexport const ATTRIBUTE_MAPPING = {\n  // HTML\n  accept: 'accept',\n  acceptcharset: 'acceptCharset',\n  'accept-charset': 'acceptCharset',\n  accesskey: 'accessKey',\n  action: 'action',\n  allowfullscreen: 'allowFullScreen',\n  alt: 'alt',\n  as: 'as',\n  async: 'async',\n  autocapitalize: 'autoCapitalize',\n  autocomplete: 'autoComplete',\n  autocorrect: 'autoCorrect',\n  autofocus: 'autoFocus',\n  autoplay: 'autoPlay',\n  autosave: 'autoSave',\n  capture: 'capture',\n  cellpadding: 'cellPadding',\n  cellspacing: 'cellSpacing',\n  challenge: 'challenge',\n  charset: 'charSet',\n  checked: 'checked',\n  children: 'children',\n  cite: 'cite',\n  class: 'className',\n  classid: 'classID',\n  classname: 'className',\n  cols: 'cols',\n  colspan: 'colSpan',\n  content: 'content',\n  contenteditable: 'contentEditable',\n  contextmenu: 'contextMenu',\n  controls: 'controls',\n  controlslist: 'controlsList',\n  coords: 'coords',\n  crossorigin: 'crossOrigin',\n  dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',\n  data: 'data',\n  datetime: 'dateTime',\n  default: 'default',\n  defaultchecked: 'defaultChecked',\n  defaultvalue: 'defaultValue',\n  defer: 'defer',\n  dir: 'dir',\n  disabled: 'disabled',\n  download: 'download',\n  draggable: 'draggable',\n  enctype: 'encType',\n  for: 'htmlFor',\n  form: 'form',\n  formmethod: 'formMethod',\n  formaction: 'formAction',\n  formenctype: 'formEncType',\n  formnovalidate: 'formNoValidate',\n  formtarget: 'formTarget',\n  frameborder: 'frameBorder',\n  headers: 'headers',\n  height: 'height',\n  hidden: 'hidden',\n  high: 'high',\n  href: 'href',\n  hreflang: 'hrefLang',\n  htmlfor: 'htmlFor',\n  httpequiv: 'httpEquiv',\n  'http-equiv': 'httpEquiv',\n  icon: 'icon',\n  id: 'id',\n  innerhtml: 'innerHTML',\n  inputmode: 'inputMode',\n  integrity: 'integrity',\n  is: 'is',\n  itemid: 'itemID',\n  itemprop: 'itemProp',\n  itemref: 'itemRef',\n  itemscope: 'itemScope',\n  itemtype: 'itemType',\n  keyparams: 'keyParams',\n  keytype: 'keyType',\n  kind: 'kind',\n  label: 'label',\n  lang: 'lang',\n  list: 'list',\n  loop: 'loop',\n  low: 'low',\n  manifest: 'manifest',\n  marginwidth: 'marginWidth',\n  marginheight: 'marginHeight',\n  max: 'max',\n  maxlength: 'maxLength',\n  media: 'media',\n  mediagroup: 'mediaGroup',\n  method: 'method',\n  min: 'min',\n  minlength: 'minLength',\n  multiple: 'multiple',\n  muted: 'muted',\n  name: 'name',\n  nomodule: 'noModule',\n  nonce: 'nonce',\n  novalidate: 'noValidate',\n  open: 'open',\n  optimum: 'optimum',\n  pattern: 'pattern',\n  placeholder: 'placeholder',\n  playsinline: 'playsInline',\n  poster: 'poster',\n  preload: 'preload',\n  profile: 'profile',\n  radiogroup: 'radioGroup',\n  readonly: 'readOnly',\n  referrerpolicy: 'referrerPolicy',\n  rel: 'rel',\n  required: 'required',\n  reversed: 'reversed',\n  role: 'role',\n  rows: 'rows',\n  rowspan: 'rowSpan',\n  sandbox: 'sandbox',\n  scope: 'scope',\n  scoped: 'scoped',\n  scrolling: 'scrolling',\n  seamless: 'seamless',\n  selected: 'selected',\n  shape: 'shape',\n  size: 'size',\n  sizes: 'sizes',\n  span: 'span',\n  spellcheck: 'spellCheck',\n  src: 'src',\n  srcdoc: 'srcDoc',\n  srclang: 'srcLang',\n  srcset: 'srcSet',\n  start: 'start',\n  step: 'step',\n  style: 'style',\n  summary: 'summary',\n  tabindex: 'tabIndex',\n  target: 'target',\n  title: 'title',\n  type: 'type',\n  usemap: 'useMap',\n  value: 'value',\n  width: 'width',\n  wmode: 'wmode',\n  wrap: 'wrap',\n\n  // SVG\n  about: 'about',\n  accentheight: 'accentHeight',\n  'accent-height': 'accentHeight',\n  accumulate: 'accumulate',\n  additive: 'additive',\n  alignmentbaseline: 'alignmentBaseline',\n  'alignment-baseline': 'alignmentBaseline',\n  allowreorder: 'allowReorder',\n  alphabetic: 'alphabetic',\n  amplitude: 'amplitude',\n  arabicform: 'arabicForm',\n  'arabic-form': 'arabicForm',\n  ascent: 'ascent',\n  attributename: 'attributeName',\n  attributetype: 'attributeType',\n  autoreverse: 'autoReverse',\n  azimuth: 'azimuth',\n  basefrequency: 'baseFrequency',\n  baselineshift: 'baselineShift',\n  'baseline-shift': 'baselineShift',\n  baseprofile: 'baseProfile',\n  bbox: 'bbox',\n  begin: 'begin',\n  bias: 'bias',\n  by: 'by',\n  calcmode: 'calcMode',\n  capheight: 'capHeight',\n  'cap-height': 'capHeight',\n  clip: 'clip',\n  clippath: 'clipPath',\n  'clip-path': 'clipPath',\n  clippathunits: 'clipPathUnits',\n  cliprule: 'clipRule',\n  'clip-rule': 'clipRule',\n  color: 'color',\n  colorinterpolation: 'colorInterpolation',\n  'color-interpolation': 'colorInterpolation',\n  colorinterpolationfilters: 'colorInterpolationFilters',\n  'color-interpolation-filters': 'colorInterpolationFilters',\n  colorprofile: 'colorProfile',\n  'color-profile': 'colorProfile',\n  colorrendering: 'colorRendering',\n  'color-rendering': 'colorRendering',\n  contentscripttype: 'contentScriptType',\n  contentstyletype: 'contentStyleType',\n  cursor: 'cursor',\n  cx: 'cx',\n  cy: 'cy',\n  d: 'd',\n  datatype: 'datatype',\n  decelerate: 'decelerate',\n  descent: 'descent',\n  diffuseconstant: 'diffuseConstant',\n  direction: 'direction',\n  display: 'display',\n  divisor: 'divisor',\n  dominantbaseline: 'dominantBaseline',\n  'dominant-baseline': 'dominantBaseline',\n  dur: 'dur',\n  dx: 'dx',\n  dy: 'dy',\n  edgemode: 'edgeMode',\n  elevation: 'elevation',\n  enablebackground: 'enableBackground',\n  'enable-background': 'enableBackground',\n  end: 'end',\n  exponent: 'exponent',\n  externalresourcesrequired: 'externalResourcesRequired',\n  fill: 'fill',\n  fillopacity: 'fillOpacity',\n  'fill-opacity': 'fillOpacity',\n  fillrule: 'fillRule',\n  'fill-rule': 'fillRule',\n  filter: 'filter',\n  filterres: 'filterRes',\n  filterunits: 'filterUnits',\n  floodopacity: 'floodOpacity',\n  'flood-opacity': 'floodOpacity',\n  floodcolor: 'floodColor',\n  'flood-color': 'floodColor',\n  focusable: 'focusable',\n  fontfamily: 'fontFamily',\n  'font-family': 'fontFamily',\n  fontsize: 'fontSize',\n  'font-size': 'fontSize',\n  fontsizeadjust: 'fontSizeAdjust',\n  'font-size-adjust': 'fontSizeAdjust',\n  fontstretch: 'fontStretch',\n  'font-stretch': 'fontStretch',\n  fontstyle: 'fontStyle',\n  'font-style': 'fontStyle',\n  fontvariant: 'fontVariant',\n  'font-variant': 'fontVariant',\n  fontweight: 'fontWeight',\n  'font-weight': 'fontWeight',\n  format: 'format',\n  from: 'from',\n  fx: 'fx',\n  fy: 'fy',\n  g1: 'g1',\n  g2: 'g2',\n  glyphname: 'glyphName',\n  'glyph-name': 'glyphName',\n  glyphorientationhorizontal: 'glyphOrientationHorizontal',\n  'glyph-orientation-horizontal': 'glyphOrientationHorizontal',\n  glyphorientationvertical: 'glyphOrientationVertical',\n  'glyph-orientation-vertical': 'glyphOrientationVertical',\n  glyphref: 'glyphRef',\n  gradienttransform: 'gradientTransform',\n  gradientunits: 'gradientUnits',\n  hanging: 'hanging',\n  horizadvx: 'horizAdvX',\n  'horiz-adv-x': 'horizAdvX',\n  horizoriginx: 'horizOriginX',\n  'horiz-origin-x': 'horizOriginX',\n  ideographic: 'ideographic',\n  imagerendering: 'imageRendering',\n  'image-rendering': 'imageRendering',\n  in2: 'in2',\n  in: 'in',\n  inlist: 'inlist',\n  intercept: 'intercept',\n  k1: 'k1',\n  k2: 'k2',\n  k3: 'k3',\n  k4: 'k4',\n  k: 'k',\n  kernelmatrix: 'kernelMatrix',\n  kernelunitlength: 'kernelUnitLength',\n  kerning: 'kerning',\n  keypoints: 'keyPoints',\n  keysplines: 'keySplines',\n  keytimes: 'keyTimes',\n  lengthadjust: 'lengthAdjust',\n  letterspacing: 'letterSpacing',\n  'letter-spacing': 'letterSpacing',\n  lightingcolor: 'lightingColor',\n  'lighting-color': 'lightingColor',\n  limitingconeangle: 'limitingConeAngle',\n  local: 'local',\n  markerend: 'markerEnd',\n  'marker-end': 'markerEnd',\n  markerheight: 'markerHeight',\n  markermid: 'markerMid',\n  'marker-mid': 'markerMid',\n  markerstart: 'markerStart',\n  'marker-start': 'markerStart',\n  markerunits: 'markerUnits',\n  markerwidth: 'markerWidth',\n  mask: 'mask',\n  maskcontentunits: 'maskContentUnits',\n  maskunits: 'maskUnits',\n  mathematical: 'mathematical',\n  mode: 'mode',\n  numoctaves: 'numOctaves',\n  offset: 'offset',\n  opacity: 'opacity',\n  operator: 'operator',\n  order: 'order',\n  orient: 'orient',\n  orientation: 'orientation',\n  origin: 'origin',\n  overflow: 'overflow',\n  overlineposition: 'overlinePosition',\n  'overline-position': 'overlinePosition',\n  overlinethickness: 'overlineThickness',\n  'overline-thickness': 'overlineThickness',\n  paintorder: 'paintOrder',\n  'paint-order': 'paintOrder',\n  panose1: 'panose1',\n  'panose-1': 'panose1',\n  pathlength: 'pathLength',\n  patterncontentunits: 'patternContentUnits',\n  patterntransform: 'patternTransform',\n  patternunits: 'patternUnits',\n  pointerevents: 'pointerEvents',\n  'pointer-events': 'pointerEvents',\n  points: 'points',\n  pointsatx: 'pointsAtX',\n  pointsaty: 'pointsAtY',\n  pointsatz: 'pointsAtZ',\n  prefix: 'prefix',\n  preservealpha: 'preserveAlpha',\n  preserveaspectratio: 'preserveAspectRatio',\n  primitiveunits: 'primitiveUnits',\n  property: 'property',\n  r: 'r',\n  radius: 'radius',\n  refx: 'refX',\n  refy: 'refY',\n  renderingintent: 'renderingIntent',\n  'rendering-intent': 'renderingIntent',\n  repeatcount: 'repeatCount',\n  repeatdur: 'repeatDur',\n  requiredextensions: 'requiredExtensions',\n  requiredfeatures: 'requiredFeatures',\n  resource: 'resource',\n  restart: 'restart',\n  result: 'result',\n  results: 'results',\n  rotate: 'rotate',\n  rx: 'rx',\n  ry: 'ry',\n  scale: 'scale',\n  security: 'security',\n  seed: 'seed',\n  shaperendering: 'shapeRendering',\n  'shape-rendering': 'shapeRendering',\n  slope: 'slope',\n  spacing: 'spacing',\n  specularconstant: 'specularConstant',\n  specularexponent: 'specularExponent',\n  speed: 'speed',\n  spreadmethod: 'spreadMethod',\n  startoffset: 'startOffset',\n  stddeviation: 'stdDeviation',\n  stemh: 'stemh',\n  stemv: 'stemv',\n  stitchtiles: 'stitchTiles',\n  stopcolor: 'stopColor',\n  'stop-color': 'stopColor',\n  stopopacity: 'stopOpacity',\n  'stop-opacity': 'stopOpacity',\n  strikethroughposition: 'strikethroughPosition',\n  'strikethrough-position': 'strikethroughPosition',\n  strikethroughthickness: 'strikethroughThickness',\n  'strikethrough-thickness': 'strikethroughThickness',\n  string: 'string',\n  stroke: 'stroke',\n  strokedasharray: 'strokeDasharray',\n  'stroke-dasharray': 'strokeDasharray',\n  strokedashoffset: 'strokeDashoffset',\n  'stroke-dashoffset': 'strokeDashoffset',\n  strokelinecap: 'strokeLinecap',\n  'stroke-linecap': 'strokeLinecap',\n  strokelinejoin: 'strokeLinejoin',\n  'stroke-linejoin': 'strokeLinejoin',\n  strokemiterlimit: 'strokeMiterlimit',\n  'stroke-miterlimit': 'strokeMiterlimit',\n  strokewidth: 'strokeWidth',\n  'stroke-width': 'strokeWidth',\n  strokeopacity: 'strokeOpacity',\n  'stroke-opacity': 'strokeOpacity',\n  suppresscontenteditablewarning: 'suppressContentEditableWarning',\n  suppresshydrationwarning: 'suppressHydrationWarning',\n  surfacescale: 'surfaceScale',\n  systemlanguage: 'systemLanguage',\n  tablevalues: 'tableValues',\n  targetx: 'targetX',\n  targety: 'targetY',\n  textanchor: 'textAnchor',\n  'text-anchor': 'textAnchor',\n  textdecoration: 'textDecoration',\n  'text-decoration': 'textDecoration',\n  textlength: 'textLength',\n  textrendering: 'textRendering',\n  'text-rendering': 'textRendering',\n  to: 'to',\n  transform: 'transform',\n  typeof: 'typeof',\n  u1: 'u1',\n  u2: 'u2',\n  underlineposition: 'underlinePosition',\n  'underline-position': 'underlinePosition',\n  underlinethickness: 'underlineThickness',\n  'underline-thickness': 'underlineThickness',\n  unicode: 'unicode',\n  unicodebidi: 'unicodeBidi',\n  'unicode-bidi': 'unicodeBidi',\n  unicoderange: 'unicodeRange',\n  'unicode-range': 'unicodeRange',\n  unitsperem: 'unitsPerEm',\n  'units-per-em': 'unitsPerEm',\n  unselectable: 'unselectable',\n  valphabetic: 'vAlphabetic',\n  'v-alphabetic': 'vAlphabetic',\n  values: 'values',\n  vectoreffect: 'vectorEffect',\n  'vector-effect': 'vectorEffect',\n  version: 'version',\n  vertadvy: 'vertAdvY',\n  'vert-adv-y': 'vertAdvY',\n  vertoriginx: 'vertOriginX',\n  'vert-origin-x': 'vertOriginX',\n  vertoriginy: 'vertOriginY',\n  'vert-origin-y': 'vertOriginY',\n  vhanging: 'vHanging',\n  'v-hanging': 'vHanging',\n  videographic: 'vIdeographic',\n  'v-ideographic': 'vIdeographic',\n  viewbox: 'viewBox',\n  viewtarget: 'viewTarget',\n  visibility: 'visibility',\n  vmathematical: 'vMathematical',\n  'v-mathematical': 'vMathematical',\n  vocab: 'vocab',\n  widths: 'widths',\n  wordspacing: 'wordSpacing',\n  'word-spacing': 'wordSpacing',\n  writingmode: 'writingMode',\n  'writing-mode': 'writingMode',\n  x1: 'x1',\n  x2: 'x2',\n  x: 'x',\n  xchannelselector: 'xChannelSelector',\n  xheight: 'xHeight',\n  'x-height': 'xHeight',\n  xlinkactuate: 'xlinkActuate',\n  'xlink:actuate': 'xlinkActuate',\n  xlinkarcrole: 'xlinkArcrole',\n  'xlink:arcrole': 'xlinkArcrole',\n  xlinkhref: 'xlinkHref',\n  'xlink:href': 'xlinkHref',\n  xlinkrole: 'xlinkRole',\n  'xlink:role': 'xlinkRole',\n  xlinkshow: 'xlinkShow',\n  'xlink:show': 'xlinkShow',\n  xlinktitle: 'xlinkTitle',\n  'xlink:title': 'xlinkTitle',\n  xlinktype: 'xlinkType',\n  'xlink:type': 'xlinkType',\n  xmlbase: 'xmlBase',\n  'xml:base': 'xmlBase',\n  xmllang: 'xmlLang',\n  'xml:lang': 'xmlLang',\n  xmlns: 'xmlns',\n  'xml:space': 'xmlSpace',\n  xmlnsxlink: 'xmlnsXlink',\n  'xmlns:xlink': 'xmlnsXlink',\n  xmlspace: 'xmlSpace',\n  y1: 'y1',\n  y2: 'y2',\n  y: 'y',\n  ychannelselector: 'yChannelSelector',\n  z: 'z',\n  zoomandpan: 'zoomAndPan',\n}\n\nexport const ELEMENT_ATTRIBUTE_MAPPING = {\n  input: {\n    checked: 'defaultChecked',\n    value: 'defaultValue',\n    maxlength: 'maxLength',\n  },\n  form: {\n    enctype: 'encType',\n  },\n}\n\n// Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element#SVG_elements\nexport const ELEMENT_TAG_NAME_MAPPING: Record<string, string> = {\n  a: 'a',\n  altglyph: 'altGlyph',\n  altglyphdef: 'altGlyphDef',\n  altglyphitem: 'altGlyphItem',\n  animate: 'animate',\n  animatecolor: 'animateColor',\n  animatemotion: 'animateMotion',\n  animatetransform: 'animateTransform',\n  audio: 'audio',\n  canvas: 'canvas',\n  circle: 'circle',\n  clippath: 'clipPath',\n  'color-profile': 'colorProfile',\n  cursor: 'cursor',\n  defs: 'defs',\n  desc: 'desc',\n  discard: 'discard',\n  ellipse: 'ellipse',\n  feblend: 'feBlend',\n  fecolormatrix: 'feColorMatrix',\n  fecomponenttransfer: 'feComponentTransfer',\n  fecomposite: 'feComposite',\n  feconvolvematrix: 'feConvolveMatrix',\n  fediffuselighting: 'feDiffuseLighting',\n  fedisplacementmap: 'feDisplacementMap',\n  fedistantlight: 'feDistantLight',\n  fedropshadow: 'feDropShadow',\n  feflood: 'feFlood',\n  fefunca: 'feFuncA',\n  fefuncb: 'feFuncB',\n  fefuncg: 'feFuncG',\n  fefuncr: 'feFuncR',\n  fegaussianblur: 'feGaussianBlur',\n  feimage: 'feImage',\n  femerge: 'feMerge',\n  femergenode: 'feMergeNode',\n  femorphology: 'feMorphology',\n  feoffset: 'feOffset',\n  fepointlight: 'fePointLight',\n  fespecularlighting: 'feSpecularLighting',\n  fespotlight: 'feSpotLight',\n  fetile: 'feTile',\n  feturbulence: 'feTurbulence',\n  filter: 'filter',\n  font: 'font',\n  'font-face': 'fontFace',\n  'font-face-format': 'fontFaceFormat',\n  'font-face-name': 'fontFaceName',\n  'font-face-src': 'fontFaceSrc',\n  'font-face-uri': 'fontFaceUri',\n  foreignobject: 'foreignObject',\n  g: 'g',\n  glyph: 'glyph',\n  glyphref: 'glyphRef',\n  hatch: 'hatch',\n  hatchpath: 'hatchpath',\n  hkern: 'hkern',\n  iframe: 'iframe',\n  image: 'image',\n  line: 'line',\n  lineargradient: 'linearGradient',\n  marker: 'marker',\n  mask: 'mask',\n  mesh: 'mesh',\n  meshgradient: 'meshgradient',\n  meshpatch: 'meshpatch',\n  meshrow: 'meshrow',\n  metadata: 'metadata',\n  'missing-glyph': 'missingGlyph',\n  mpath: 'mpath',\n  path: 'path',\n  pattern: 'pattern',\n  polygon: 'polygon',\n  polyline: 'polyline',\n  radialgradient: 'radialGradient',\n  rect: 'rect',\n  script: 'script',\n  set: 'set',\n  solidcolor: 'solidcolor',\n  stop: 'stop',\n  style: 'style',\n  svg: 'svg',\n  switch: 'switch',\n  symbol: 'symbol',\n  text: 'text',\n  textpath: 'textPath',\n  title: 'title',\n  tref: 'tref',\n  tspan: 'tspan',\n  unknown: 'unknown',\n  use: 'use',\n  video: 'video',\n  view: 'view',\n  vkern: 'vkern',\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/one.ts",
    "content": "import type { Node, RootNode, ElementNode } from 'svg-parser'\nimport type { Helpers } from './helpers'\nimport type * as t from '@babel/types'\n\nexport const one = (\n  h: Helpers,\n  node: Node,\n  parent?: RootNode | ElementNode,\n): t.JSXElement | t.ExpressionStatement | t.JSXExpressionContainer | null => {\n  const type = node && node.type\n  const fn = h.handlers[type]\n\n  /* Fail on non-nodes. */\n  if (!type) {\n    throw new Error(`Expected node, got \\`${node}\\``)\n  }\n\n  if (!fn) {\n    throw new Error(`Node of type ${type} is unknown`)\n  }\n\n  // @ts-ignore\n  return fn(h, node, parent)\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/stringToObjectStyle.ts",
    "content": "// Inspired by https://github.com/reactjs/react-magic/blob/master/src/htmltojsx.js\nimport * as t from '@babel/types'\nimport { hyphenToCamelCase, isNumeric, trimEnd } from './util'\n\nconst PX_REGEX = /^\\d+px$/\nconst MS_REGEX = /^-ms-/\nconst VAR_REGEX = /^--/\n\n/**\n * Determines if the CSS value can be converted from a\n * 'px' suffixed string to a numeric value.\n */\nconst isConvertiblePixelValue = (value: string) => {\n  return PX_REGEX.test(value)\n}\n\n/**\n * Format style key into JSX style object key.\n */\nconst formatKey = (key: string) => {\n  if (VAR_REGEX.test(key)) {\n    return t.stringLiteral(key)\n  }\n  key = key.toLowerCase()\n  // Don't capitalize -ms- prefix\n  if (MS_REGEX.test(key)) key = key.substr(1)\n  return t.identifier(hyphenToCamelCase(key))\n}\n\n/**\n * Format style value into JSX style object value.\n */\nconst formatValue = (value: string) => {\n  if (isNumeric(value)) return t.numericLiteral(Number(value))\n  if (isConvertiblePixelValue(value))\n    return t.numericLiteral(Number(trimEnd(value, 'px')))\n  return t.stringLiteral(value)\n}\n\n/**\n * Handle parsing of inline styles.\n */\nexport const stringToObjectStyle = (rawStyle: string): t.ObjectExpression => {\n  const entries = rawStyle.split(';')\n  const properties = []\n\n  let index = -1\n\n  while (++index < entries.length) {\n    const entry = entries[index]\n    const style = entry.trim()\n    const firstColon = style.indexOf(':')\n    const value = style.substr(firstColon + 1).trim()\n    const key = style.substr(0, firstColon)\n    if (key !== '') {\n      const property = t.objectProperty(formatKey(key), formatValue(value))\n      properties.push(property)\n    }\n  }\n\n  return t.objectExpression(properties)\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/src/util.ts",
    "content": "/**\n * Determines if the specified string consists entirely of numeric characters.\n */\nexport const isNumeric = (value: number | string): boolean => {\n  // @ts-ignore\n  return !Number.isNaN(value - parseFloat(value))\n}\n\n/**\n * Convert a hyphenated string to camelCase.\n */\nexport const hyphenToCamelCase = (string: string): string => {\n  return string.replace(/-(.)/g, (_, chr) => chr.toUpperCase())\n}\n\n/**\n * Trim the specified substring off the string. If the string does not end\n * with the specified substring, this is a no-op.\n *\n * @param {string} haystack String to search in\n * @param {string} needle   String to search for\n */\nexport const trimEnd = (haystack: string, needle: string): string => {\n  return haystack.endsWith(needle)\n    ? haystack.slice(0, -needle.length)\n    : haystack\n}\n\nconst KEBAB_REGEX = /[A-Z\\u00C0-\\u00D6\\u00D8-\\u00DE]/g\n\nexport const kebabCase = (str: string): string => {\n  return str.replace(KEBAB_REGEX, (match) => `-${match.toLowerCase()}`)\n}\n\nconst SPACES_REGEXP = /[\\t\\r\\n\\u0085\\u2028\\u2029]+/g\n\nexport const replaceSpaces = (str: string): string => {\n  return str.replace(SPACES_REGEXP, ' ')\n}\n"
  },
  {
    "path": "packages/hast-util-to-babel-ast/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/plugin-jsx/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/plugin-jsx/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n\n### Bug Fixes\n\n* fix peer dependencies ([2e05255](https://github.com/gregberge/svgr/commit/2e0525546eb21aa4bb790aa4284f4fe34f96d6b9))\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* allow specifying `jsxRuntimeImport` in config ([86bb86f](https://github.com/gregberge/svgr/commit/86bb86f47748618f729742e56199355d9c0bc518)), closes [#801](https://github.com/gregberge/svgr/issues/801) [#801](https://github.com/gregberge/svgr/issues/801)\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n### Features\n\n- add descProp option ([#729](https://github.com/gregberge/svgr/issues/729)) ([a0637d4](https://github.com/gregberge/svgr/commit/a0637d49b60243bbae461f7b96dab9b47cd82d8f))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n### Bug Fixes\n\n- specify valid peer deps ([45a76ed](https://github.com/gregberge/svgr/commit/45a76ed5f7d433e549c8513c0fdab08eb6c7bc2c))\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n### Performance Improvements\n\n- replace rehype with svg-parser ([#321](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/issues/321)) ([7eb5ef6](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/commit/7eb5ef6))\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/plugin-jsx\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/plugin-jsx/README.md",
    "content": "# @svgr/plugin-jsx\n\n[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)\n[![Version](https://img.shields.io/npm/v/@svgr/plugin-jsx.svg)](https://www.npmjs.com/package/@svgr/plugin-jsx)\n[![MIT License](https://img.shields.io/npm/l/@svgr/plugin-jsx.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)\n\nTransforms SVG into JSX.\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/plugin-jsx\n```\n\n## Usage\n\n**.svgrrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/plugin-jsx\"]\n}\n```\n\n## How does it work?\n\n`@svgr/plugin-jsx` consists in three phases:\n\n- Parsing the SVG code using [svg-parser](https://github.com/Rich-Harris/svg-parser)\n- Converting the [HAST](https://github.com/syntax-tree/hast) into a [Babel AST](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)\n- Applying [`@svgr/babel-preset`](../babel-preset/README.md) transformations\n\n## Applying custom transformations\n\nYou can extend the Babel config applied in this plugin using `jsx.babelConfig` config path:\n\n```js\n// .svgrrc.js\n\nmodule.exports = {\n  jsx: {\n    babelConfig: {\n      plugins: [\n        // For an example, this plugin will remove \"id\" attribute from \"svg\" tag\n        [\n          '@svgr/babel-plugin-remove-jsx-attribute',\n          {\n            elements: ['svg'],\n            attributes: ['id'],\n          },\n        ],\n      ],\n    },\n  },\n}\n```\n\nSeveral Babel plugins are available:\n\n- [`@svgr/babel-plugin-add-jsx-attribute`](../babel-plugin-add-jsx-attribute/README.md)\n- [`@svgr/babel-plugin-remove-jsx-attribute`](../babel-plugin-remove-jsx-attribute/README.md)\n- [`@svgr/babel-plugin-remove-jsx-empty-expression`](../babel-plugin-remove-jsx-empty-expression/README.md)\n- [`@svgr/babel-plugin-replace-jsx-attribute-value`](../babel-plugin-replace-jsx-attribute-value/README.md)\n- [`@svgr/babel-plugin-svg-dynamic-title`](../babel-plugin-svg-dynamic-title/README.md)\n- [`@svgr/babel-plugin-svg-em-dimensions`](../babel-plugin-svg-em-dimensions/README.md)\n- [`@svgr/babel-plugin-transform-react-native-svg`](../babel-plugin-transform-react-native-svg/README.md)\n- [`@svgr/babel-plugin-transform-svg-component`](../babel-plugin-transform-svg-component/README.md)\n\nIf you want to create your own, reading [Babel Handbook](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md) is a good start!\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/plugin-jsx/package.json",
    "content": "{\n  \"name\": \"@svgr/plugin-jsx\",\n  \"description\": \"Transform SVG into JSX\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/plugin-jsx\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"dependencies\": {\n    \"@babel/core\": \"^7.21.3\",\n    \"@svgr/babel-preset\": \"workspace:*\",\n    \"@svgr/hast-util-to-babel-ast\": \"workspace:*\",\n    \"svg-parser\": \"^2.0.4\"\n  },\n  \"devDependencies\": {\n    \"@svgr/core\": \"workspace:*\",\n    \"@types/svg-parser\": \"^2.0.3\"\n  },\n  \"peerDependencies\": {\n    \"@svgr/core\": \"*\"\n  }\n}\n"
  },
  {
    "path": "packages/plugin-jsx/src/index.test.ts",
    "content": "import jsx from '.'\n\nconst svgBaseCode = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n    <title>Dismiss</title>\n    <desc>Created with Sketch.</desc>\n    <defs></defs>\n    <g id=\"Blocks\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\">\n        <g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\">\n            <path d=\"M51,37 L37,51\" id=\"Shape\"></path>\n            <path d=\"M51,51 L37,37\" id=\"Shape\"></path>\n        </g>\n    </g>\n</svg>\n`\n\ndescribe('plugin', () => {\n  it('transforms code', () => {\n    const result = jsx(svgBaseCode, {}, { componentName: 'SvgComponent' })\n    expect(result).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = () => <svg viewBox=\"0 0 88 88\" xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\"><title>{\"Dismiss\"}</title><desc>{\"Created with Sketch.\"}</desc><defs /><g id=\"Blocks\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\" strokeLinecap=\"square\"><g id=\"Dismiss\" stroke=\"#063855\" strokeWidth={2}><path d=\"M51,37 L37,51\" id=\"Shape\" /><path d=\"M51,51 L37,37\" id=\"Shape\" /></g></g></svg>;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('supports \"automatic\" runtime', () => {\n    const result = jsx(\n      svgBaseCode,\n      { jsxRuntime: 'automatic' },\n      { componentName: 'SvgComponent' },\n    )\n    expect(result).toMatchInlineSnapshot(`\n      \"const SvgComponent = () => <svg viewBox=\"0 0 88 88\" xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\"><title>{\"Dismiss\"}</title><desc>{\"Created with Sketch.\"}</desc><defs /><g id=\"Blocks\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\" strokeLinecap=\"square\"><g id=\"Dismiss\" stroke=\"#063855\" strokeWidth={2}><path d=\"M51,37 L37,51\" id=\"Shape\" /><path d=\"M51,51 L37,37\" id=\"Shape\" /></g></g></svg>;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('supports \"preact\" preset', () => {\n    const result = jsx(\n      svgBaseCode,\n      { jsxRuntime: 'classic-preact' },\n      { componentName: 'SvgComponent' },\n    )\n    expect(result).toMatchInlineSnapshot(`\n      \"import { h } from \"preact\";\n      const SvgComponent = () => <svg viewBox=\"0 0 88 88\" xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\"><title>{\"Dismiss\"}</title><desc>{\"Created with Sketch.\"}</desc><defs /><g id=\"Blocks\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\" strokeLinecap=\"square\"><g id=\"Dismiss\" stroke=\"#063855\" strokeWidth={2}><path d=\"M51,37 L37,51\" id=\"Shape\" /><path d=\"M51,51 L37,37\" id=\"Shape\" /></g></g></svg>;\n      export default SvgComponent;\"\n    `)\n  })\n\n  it('accepts jsx config', () => {\n    const dropTitle = () => ({\n      visitor: {\n        JSXElement(path: any) {\n          if (\n            path.get('openingElement.name').isJSXIdentifier({ name: 'title' })\n          ) {\n            path.remove()\n          }\n        },\n      },\n    })\n\n    const result = jsx(\n      svgBaseCode,\n      { jsx: { babelConfig: { plugins: [dropTitle] } } },\n      { componentName: 'SvgComponent' },\n    )\n    expect(result).toMatchInlineSnapshot(`\n      \"import * as React from \"react\";\n      const SvgComponent = () => <svg viewBox=\"0 0 88 88\" xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\"><desc>{\"Created with Sketch.\"}</desc><defs /><g id=\"Blocks\" stroke=\"none\" strokeWidth={1} fill=\"none\" fillRule=\"evenodd\" strokeLinecap=\"square\"><g id=\"Dismiss\" stroke=\"#063855\" strokeWidth={2}><path d=\"M51,37 L37,51\" id=\"Shape\" /><path d=\"M51,51 L37,37\" id=\"Shape\" /></g></g></svg>;\n      export default SvgComponent;\"\n    `)\n  })\n})\n"
  },
  {
    "path": "packages/plugin-jsx/src/index.ts",
    "content": "import { parse } from 'svg-parser'\nimport hastToBabelAst from '@svgr/hast-util-to-babel-ast'\nimport { transformFromAstSync, createConfigItem } from '@babel/core'\nimport svgrBabelPreset, {\n  Options as SvgrPresetOptions,\n} from '@svgr/babel-preset'\nimport type { Plugin, Config } from '@svgr/core'\n\nconst getJsxRuntimeOptions = (config: Config): Partial<SvgrPresetOptions> => {\n  if (config.jsxRuntimeImport) {\n    return {\n      importSource: config.jsxRuntimeImport.source,\n      jsxRuntimeImport: config.jsxRuntimeImport,\n    }\n  }\n  switch (config.jsxRuntime) {\n    case null:\n    case undefined:\n    case 'classic':\n      return {\n        jsxRuntime: 'classic',\n        importSource: 'react',\n        jsxRuntimeImport: { namespace: 'React', source: 'react' },\n      }\n    case 'classic-preact':\n      return {\n        jsxRuntime: 'classic',\n        importSource: 'preact/compat',\n        jsxRuntimeImport: { specifiers: ['h'], source: 'preact' },\n      }\n    case 'automatic':\n      return { jsxRuntime: 'automatic' }\n    default:\n      throw new Error(`Unsupported \"jsxRuntime\" \"${config.jsxRuntime}\"`)\n  }\n}\n\nconst jsxPlugin: Plugin = (code, config, state) => {\n  const filePath = state.filePath || 'unknown'\n  const hastTree = parse(code)\n\n  const babelTree = hastToBabelAst(hastTree)\n\n  const svgPresetOptions: SvgrPresetOptions = {\n    ref: config.ref,\n    titleProp: config.titleProp,\n    descProp: config.descProp,\n    expandProps: config.expandProps,\n    dimensions: config.dimensions,\n    icon: config.icon,\n    native: config.native,\n    svgProps: config.svgProps,\n    replaceAttrValues: config.replaceAttrValues,\n    typescript: config.typescript,\n    template: config.template,\n    memo: config.memo,\n    exportType: config.exportType,\n    namedExport: config.namedExport,\n    ...getJsxRuntimeOptions(config),\n    state,\n  }\n\n  const result = transformFromAstSync(babelTree, code, {\n    caller: {\n      name: 'svgr',\n    },\n    presets: [\n      createConfigItem([svgrBabelPreset, svgPresetOptions], {\n        type: 'preset',\n      }),\n    ],\n    filename: filePath,\n    babelrc: false,\n    configFile: false,\n    code: true,\n    ast: false,\n    // @ts-ignore\n    inputSourceMap: false,\n    ...(config.jsx && config.jsx.babelConfig),\n  })\n\n  if (!result?.code) {\n    throw new Error(`Unable to generate SVG file`)\n  }\n\n  return result.code\n}\n\nexport default jsxPlugin\n"
  },
  {
    "path": "packages/plugin-jsx/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/plugin-prettier/.npmignore",
    "content": "src/\n.*\n"
  },
  {
    "path": "packages/plugin-prettier/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n\n### Bug Fixes\n\n* fix peer dependencies ([2e05255](https://github.com/gregberge/svgr/commit/2e0525546eb21aa4bb790aa4284f4fe34f96d6b9))\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n### Bug Fixes\n\n- specify valid peer deps ([45a76ed](https://github.com/gregberge/svgr/commit/45a76ed5f7d433e549c8513c0fdab08eb6c7bc2c))\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Performance Improvements\n\n- replace merge-deep with smaller deepmerge ([#463](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/issues/463)) ([1f015eb](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/commit/1f015eb16fca093a08b012236dc83623f7bcce55))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/plugin-prettier\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- **plugin-prettier:** fix prettier warning ([d01d33f](https://github.com/gregberge/svgr/tree/master/packages/plugin-prettier/commit/d01d33f))\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/plugin-prettier/README.md",
    "content": "# @svgr/plugin-prettier\n\n[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)\n[![Version](https://img.shields.io/npm/v/@svgr/plugin-prettier.svg)](https://www.npmjs.com/package/@svgr/plugin-prettier)\n[![MIT License](https://img.shields.io/npm/l/@svgr/plugin-prettier.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)\n\nFormat SVG code using Prettier.\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/plugin-prettier\n```\n\n## Usage\n\n**.svgrrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/plugin-prettier\"]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/plugin-prettier/package.json",
    "content": "{\n  \"name\": \"@svgr/plugin-prettier\",\n  \"description\": \"Format code using Prettier\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/plugin-prettier\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"peerDependencies\": {\n    \"@svgr/core\": \"*\"\n  },\n  \"dependencies\": {\n    \"deepmerge\": \"^4.3.1\",\n    \"prettier\": \"^2.8.7\"\n  },\n  \"devDependencies\": {\n    \"@svgr/core\": \"workspace:*\"\n  }\n}\n"
  },
  {
    "path": "packages/plugin-prettier/src/index.test.ts",
    "content": "/* eslint-disable @typescript-eslint/no-var-requires */\nimport prettier from '.'\n\nconst state = { componentName: 'Foo' }\n\ndescribe('prettier', () => {\n  it('should prettify code', () => {\n    const result = prettier(\n      `const foo = <div></div>`,\n      {\n        prettier: true,\n        runtimeConfig: true,\n      },\n      state,\n    )\n    expect(result).toBe('const foo = <div></div>\\n')\n  })\n\n  it('should support config.prettierConfig', () => {\n    const result = prettier(\n      `const foo = <div></div>`,\n      {\n        prettier: true,\n        runtimeConfig: true,\n        prettierConfig: { semi: true },\n      },\n      state,\n    )\n    expect(result).toBe('const foo = <div></div>;\\n')\n  })\n\n  it('should use state.filePath to detect configuration', () => {\n    const result = prettier(\n      `const foo = <div></div>`,\n      { prettier: true, runtimeConfig: true },\n      { ...state, filePath: '/tmp' },\n    )\n    expect(result).toBe('const foo = <div></div>;\\n')\n  })\n\n  it('should resolve the prettier config with the editorconfig option', () => {\n    jest.resetModules()\n    jest.doMock('prettier')\n    /* eslint-disable global-require */\n    const prettierPlugin = require('.').default\n    const { resolveConfig } = require('prettier')\n    /* eslint-enable global-require */\n\n    prettierPlugin(\n      `const foo = <div></div>`,\n      {\n        prettier: true,\n        runtimeConfig: true,\n      },\n      {},\n    )\n    expect(resolveConfig.sync).toHaveBeenCalledWith(expect.any(String), {\n      editorconfig: true,\n    })\n  })\n\n  it('should not load runtime configuration with `runtimeConfig: false`', () => {\n    jest.resetModules()\n    jest.doMock('prettier')\n    /* eslint-disable global-require */\n    const prettierPlugin = require('.').default\n    const { resolveConfig } = require('prettier')\n    /* eslint-enable global-require */\n\n    prettierPlugin(\n      `const foo = <div></div>`,\n      {\n        prettier: true,\n        runtimeConfig: false,\n      },\n      {},\n    )\n    expect(resolveConfig.sync).not.toHaveBeenCalled()\n  })\n})\n"
  },
  {
    "path": "packages/plugin-prettier/src/index.ts",
    "content": "import { format, resolveConfig } from 'prettier'\n// @ts-ignore\nimport deepmerge from 'deepmerge'\nimport type { Plugin } from '@svgr/core'\n\nconst prettierPlugin: Plugin = (code, config, state) => {\n  if (!config.prettier) return code\n  const filePath = state.filePath || process.cwd()\n  const prettierRcConfig = config.runtimeConfig\n    ? resolveConfig.sync(filePath, { editorconfig: true })\n    : {}\n  return format(\n    code,\n    deepmerge.all([\n      { parser: 'babel' },\n      prettierRcConfig || {},\n      config.prettierConfig || {},\n    ]),\n  )\n}\n\nexport default prettierPlugin\n"
  },
  {
    "path": "packages/plugin-prettier/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/plugin-svgo/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/plugin-svgo/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n\n### Features\n\n* **esm:** add support for svgo.config.cjs ([#879](https://github.com/gregberge/svgr/issues/879)) ([ae91e2e](https://github.com/gregberge/svgr/commit/ae91e2eacbe1156480c96219b993000eb1e7b9bf))\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n\n### Bug Fixes\n\n* fix peer dependencies ([2e05255](https://github.com/gregberge/svgr/commit/2e0525546eb21aa4bb790aa4284f4fe34f96d6b9))\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/plugin-svgo\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* upgrade to svgo v3 ([#798](https://github.com/gregberge/svgr/issues/798)) ([21b6209](https://github.com/gregberge/svgr/commit/21b6209ef34c51cc0313901f31061afe587ab29b))\n\n\n### BREAKING CHANGES\n\n* svgr now requires Node.js v14+\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n**Note:** Version bump only for package @svgr/plugin-svgo\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/plugin-svgo\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n### Bug Fixes\n\n- **plugin-svgo:** handle potential errors from optimize ([#663](https://github.com/gregberge/svgr/issues/663)) ([7582d31](https://github.com/gregberge/svgr/commit/7582d3130e5b6eb0f962e283f956a84552f839a6))\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n### Bug Fixes\n\n- specify valid peer deps ([45a76ed](https://github.com/gregberge/svgr/commit/45a76ed5f7d433e549c8513c0fdab08eb6c7bc2c))\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n### Features\n\n- **native:** automatically convert inline style in native ([138c493](https://github.com/gregberge/svgr/commit/138c493b2ae0c5c1cef488cf9ff7f94827dc2aa5)), closes [#588](https://github.com/gregberge/svgr/issues/588)\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Features\n\n- **svgo:** add .svgorc.js config file support ([#451](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/451)) ([8049b1a](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/8049b1a63603672096892b6ab3d303580c2f303f)), closes [#412](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/412)\n\n### Performance Improvements\n\n- replace merge-deep with smaller deepmerge ([#463](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/463)) ([1f015eb](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/1f015eb16fca093a08b012236dc83623f7bcce55))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/plugin-svgo\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n### Bug Fixes\n\n- **svgo:** support any SVGO config format ([#412](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/412)) ([f2b2367](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/f2b2367389fda20baba6e0a5e884e7f7fe29a3ed)), closes [#400](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/400)\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n### Bug Fixes\n\n- verify that `svgoConfig.plugins` is an array ([#397](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/397)) ([88110b6](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/88110b6eb4d93ded68ca2de05cc82654dfac977d))\n\n# [5.1.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.0.1...v5.1.0) (2020-01-20)\n\n### Bug Fixes\n\n- fix merging svgo plugins in config ([#384](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/384)) ([c9d2dfc](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/c9d2dfcb8d4da55eb21a13507c87d9e549a86e7e))\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/plugin-svgo\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n### Bug Fixes\n\n- keep viewBox when dimensions are removed ([#281](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/281)) ([f476c8e](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/f476c8e))\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n"
  },
  {
    "path": "packages/plugin-svgo/README.md",
    "content": "# @svgr/plugin-svgo\n\n[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)\n[![Version](https://img.shields.io/npm/v/@svgr/plugin-svgo.svg)](https://www.npmjs.com/package/@svgr/plugin-svgo)\n[![MIT License](https://img.shields.io/npm/l/@svgr/plugin-svgo.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)\n\nOptimize SVG using SVGO.\n\n## Install\n\n```\b\nnpm install --save-dev @svgr/plugin-svgo\n```\n\n## Usage\n\n**.svgrrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/plugin-svgo\"]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/plugin-svgo/package.json",
    "content": "{\n  \"name\": \"@svgr/plugin-svgo\",\n  \"description\": \"Optimize SVG\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/plugin-svgo\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"peerDependencies\": {\n    \"@svgr/core\": \"*\"\n  },\n  \"dependencies\": {\n    \"cosmiconfig\": \"^8.1.3\",\n    \"deepmerge\": \"^4.3.1\",\n    \"svgo\": \"^3.0.2\"\n  },\n  \"devDependencies\": {\n    \"@svgr/core\": \"workspace:*\"\n  }\n}\n"
  },
  {
    "path": "packages/plugin-svgo/src/__snapshots__/index.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`svgo does not load runtime configuration with \\`runtimeConfig: false\\` 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\"><style>.svgo__shape{fill:red}</style><g id=\"svgo__Blocks\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"none\" stroke-linecap=\"square\" stroke-width=\"1\" class=\"svgo__blocks\"><g id=\"svgo__Dismiss\" stroke=\"#063855\" stroke-width=\"2\"><path id=\"svgo__Shape\" d=\"M51 37 37 51\" class=\"svgo__shape\"/><path d=\"M51 51 37 37\" class=\"svgo__shape\"/></g></g></svg>\"`;\n\nexports[`svgo does not remove viewBox with \\`icon\\` option 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\" viewBox=\"0 0 88 88\"><style>.prefix__shape{fill:red}</style><g id=\"prefix__Blocks\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"none\" stroke-linecap=\"square\" stroke-width=\"1\" class=\"prefix__blocks\"><g id=\"prefix__Dismiss\" stroke=\"#063855\" stroke-width=\"2\"><path id=\"prefix__Shape\" d=\"M51 37 37 51\" class=\"prefix__shape\"/><path d=\"M51 51 37 37\" class=\"prefix__shape\"/></g></g></svg>\"`;\n\nexports[`svgo does not remove viewBox with when \\`dimensions\\` is false 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\" viewBox=\"0 0 88 88\"><style>.prefix__shape{fill:red}</style><g id=\"prefix__Blocks\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"none\" stroke-linecap=\"square\" stroke-width=\"1\" class=\"prefix__blocks\"><g id=\"prefix__Dismiss\" stroke=\"#063855\" stroke-width=\"2\"><path id=\"prefix__Shape\" d=\"M51 37 37 51\" class=\"prefix__shape\"/><path d=\"M51 51 37 37\" class=\"prefix__shape\"/></g></g></svg>\"`;\n\nexports[`svgo does remove style when \\`native\\` is true 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\"><g fill=\"none\" fill-rule=\"evenodd\" stroke=\"#063855\" stroke-linecap=\"square\" stroke-width=\"2\" class=\"prefix__blocks\"><path d=\"M51 37 37 51M51 51 37 37\" style=\"fill:red\"/></g></svg>\"`;\n\nexports[`svgo optimizes svg 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\"><style>.prefix__shape{fill:red}</style><g id=\"prefix__Blocks\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"none\" stroke-linecap=\"square\" stroke-width=\"1\" class=\"prefix__blocks\"><g id=\"prefix__Dismiss\" stroke=\"#063855\" stroke-width=\"2\"><path id=\"prefix__Shape\" d=\"M51 37 37 51\" class=\"prefix__shape\"/><path d=\"M51 51 37 37\" class=\"prefix__shape\"/></g></g></svg>\"`;\n\nexports[`svgo supports \\`config.svgoConfig\\` 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\"><desc>Created with Sketch.</desc><style>.shape{fill:red}</style><g id=\"Blocks\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"none\" stroke-linecap=\"square\" stroke-width=\"1\" class=\"blocks\"><g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\"><path id=\"Shape\" d=\"M51 37 37 51\" class=\"shape\"/><path d=\"M51 51 37 37\" class=\"shape\"/></g></g></svg>\"`;\n\nexports[`svgo uses \\`state.filePath\\` to detect configuration 1`] = `\"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"88\" height=\"88\"><style>.svgo__shape{fill:red}</style><g id=\"svgo__Blocks\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"none\" stroke-linecap=\"square\" stroke-width=\"1\" class=\"svgo__blocks\"><g id=\"svgo__Dismiss\" stroke=\"#063855\" stroke-width=\"2\"><path id=\"svgo__Shape\" d=\"M51 37 37 51\" class=\"svgo__shape\"/><path d=\"M51 51 37 37\" class=\"svgo__shape\"/></g></g></svg>\"`;\n"
  },
  {
    "path": "packages/plugin-svgo/src/config.test.ts",
    "content": "import { getSvgoConfig } from './config'\n\nconst state = { componentName: 'Icon' }\n\ndescribe('#getSvgoConfig', () => {\n  describe('with no specific config', () => {\n    it('returns config with `prefixIds: true`', async () => {\n      const config = {}\n      expect(await getSvgoConfig(config, state)).toEqual({\n        plugins: [\n          {\n            name: 'preset-default',\n            params: { overrides: {} },\n          },\n          'prefixIds',\n        ],\n      })\n    })\n  })\n\n  describe('with `config.icons` enabled', () => {\n    it('returns config with `removeViewBox: false`', async () => {\n      const config = { icon: true }\n      expect(await getSvgoConfig(config, state)).toEqual({\n        plugins: [\n          {\n            name: 'preset-default',\n            params: { overrides: { removeViewBox: false } },\n          },\n          'prefixIds',\n        ],\n      })\n    })\n  })\n\n  describe('with `config.dimensions` disabled', () => {\n    it('returns config with `removeViewBox: false`', async () => {\n      const config = { dimensions: false }\n      expect(await getSvgoConfig(config, state)).toEqual({\n        plugins: [\n          {\n            name: 'preset-default',\n            params: { overrides: { removeViewBox: false } },\n          },\n          'prefixIds',\n        ],\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/plugin-svgo/src/config.ts",
    "content": "import { cosmiconfigSync } from 'cosmiconfig'\nimport type { Config, State } from '@svgr/core'\n\nconst explorer = cosmiconfigSync('svgo', {\n  searchPlaces: [\n    'package.json',\n    '.svgorc',\n    '.svgorc.js',\n    '.svgorc.json',\n    '.svgorc.yaml',\n    '.svgorc.yml',\n    'svgo.config.js',\n    'svgo.config.cjs',\n    '.svgo.yml',\n  ],\n  transform: (result) => result && result.config,\n  cache: true,\n})\n\nconst getSvgoConfigFromSvgrConfig = (config: Config): any => {\n  const params = { overrides: {} as any }\n  if (config.icon || config.dimensions === false) {\n    params.overrides.removeViewBox = false\n  }\n  if (config.native) {\n    params.overrides.inlineStyles = {\n      onlyMatchedOnce: false,\n    }\n  }\n\n  return {\n    plugins: [\n      {\n        name: 'preset-default',\n        params,\n      },\n      'prefixIds',\n    ],\n  }\n}\n\nexport const getSvgoConfig = (config: Config, state: State): any => {\n  const cwd = state.filePath || process.cwd()\n  if (config.svgoConfig) return config.svgoConfig\n  if (config.runtimeConfig) {\n    const userConfig = explorer.search(cwd)\n    if (userConfig) return userConfig\n  }\n  return getSvgoConfigFromSvgrConfig(config)\n}\n"
  },
  {
    "path": "packages/plugin-svgo/src/index.test.ts",
    "content": "import * as path from 'path'\nimport svgo from '.'\n\nconst state = { componentName: 'SvgComponent' }\n\nconst baseSvg = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n  <title>Dismiss</title>\n  <desc>Created with Sketch.</desc>\n  <defs></defs>\n  <style>.shape{fill: red}</style>\n  <g id=\"Blocks\" class=\"blocks\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"square\">\n      <g id=\"Dismiss\" stroke=\"#063855\" stroke-width=\"2\">\n          <path d=\"M51,37 L37,51\" id=\"Shape\" class=\"shape\"></path>\n          <path d=\"M51,51 L37,37\" id=\"Shape\" class=\"shape\"></path>\n          <style>\n            #Shape {}\n          </style>\n      </g>\n  </g>\n</svg>`\n\ndescribe('svgo', () => {\n  it('optimizes svg', () => {\n    const result = svgo(baseSvg, { svgo: true, runtimeConfig: true }, state)\n    expect(result).toMatchSnapshot()\n  })\n\n  it('supports `config.svgoConfig`', () => {\n    const result = svgo(\n      baseSvg,\n      {\n        svgo: true,\n        runtimeConfig: true,\n        svgoConfig: {\n          plugins: [\n            {\n              name: 'preset-default',\n              params: {\n                overrides: {\n                  removeDesc: false,\n                },\n              },\n            },\n          ],\n        },\n      },\n      state,\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('throws error on invalid svg input', () => {\n    const errorSvg = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n  <svg width=\"88px\" height=\"88px\" viewBox=\"0 0 88 88\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <path d=M51,37 L37,51\" id=\"Shape\" class=\"shape\"></path>\n  </svg>`\n\n    expect(() =>\n      svgo(\n        errorSvg,\n        { svgo: true, runtimeConfig: true },\n        { ...state, filePath: path.join(__dirname, '../__fixtures__/svgo') },\n      ),\n    ).toThrowError()\n  })\n\n  it('uses `state.filePath` to detect configuration', () => {\n    const result = svgo(\n      baseSvg,\n      { svgo: true, runtimeConfig: true },\n      { ...state, filePath: path.join(__dirname, '../__fixtures__/svgo') },\n    )\n\n    expect(result).toMatchSnapshot()\n  })\n\n  it('does not load runtime configuration with `runtimeConfig: false`', () => {\n    const result = svgo(\n      baseSvg,\n      { svgo: true, runtimeConfig: false },\n      { ...state, filePath: path.join(__dirname, '../__fixtures__/svgo') },\n    )\n    expect(result).toMatchSnapshot()\n  })\n\n  it('does not remove viewBox with `icon` option', () => {\n    const result = svgo(baseSvg, { svgo: true, icon: true }, state)\n    expect(result).toMatchSnapshot()\n  })\n\n  it('does not remove viewBox with when `dimensions` is false', () => {\n    const result = svgo(baseSvg, { svgo: true, dimensions: false }, state)\n    expect(result).toMatchSnapshot()\n  })\n\n  it('does remove style when `native` is true', () => {\n    const result = svgo(baseSvg, { svgo: true, native: true }, state)\n    expect(result).toMatchSnapshot()\n  })\n})\n"
  },
  {
    "path": "packages/plugin-svgo/src/index.ts",
    "content": "import { optimize } from 'svgo'\nimport { getSvgoConfig } from './config'\nimport type { Plugin } from '@svgr/core'\n\nconst svgoPlugin: Plugin = (code, config, state) => {\n  if (!config.svgo) return code\n  const svgoConfig = getSvgoConfig(config, state)\n  const result = optimize(code, { ...svgoConfig, path: state.filePath })\n\n  // @ts-ignore\n  if (result.modernError) {\n    // @ts-ignore\n    throw result.modernError\n  }\n\n  return result.data\n}\n\nexport default svgoPlugin\n"
  },
  {
    "path": "packages/plugin-svgo/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/rollup/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/rollup/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n**Note:** Version bump only for package @svgr/rollup\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/rollup\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/rollup\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* upgrade to svgo v3 ([#798](https://github.com/gregberge/svgr/issues/798)) ([21b6209](https://github.com/gregberge/svgr/commit/21b6209ef34c51cc0313901f31061afe587ab29b))\n\n\n### BREAKING CHANGES\n\n* svgr now requires Node.js v14+\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n**Note:** Version bump only for package @svgr/rollup\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n### Bug Fixes\n\n- **rollup:** missing dep & missing map return ([#652](https://github.com/gregberge/svgr/issues/652)) ([12627fc](https://github.com/gregberge/svgr/commit/12627fcd91a425361e1fbe825a6668ce9a8b4f3b))\n\n## [6.1.1](https://github.com/gregberge/svgr/compare/v6.1.0...v6.1.1) (2021-12-04)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n### Bug Fixes\n\n- fix previous export system ([1872829](https://github.com/gregberge/svgr/commit/187282977af841cd5a2243a23abba72b20eec2fa)), closes [#635](https://github.com/gregberge/svgr/issues/635)\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/rollup/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/rollup/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/rollup/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n### Features\n\n- allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/rollup/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/rollup/commit/16a58d6e817c065f72a68be91600a1a360205f44))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/rollup\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [5.1.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.0.1...v5.1.0) (2020-01-20)\n\n**Note:** Version bump only for package @svgr/rollup\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/rollup/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n**Note:** Version bump only for package @svgr/rollup\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n**Note:** Version bump only for package @svgr/rollup\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/rollup/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n### Features\n\n- add parcel plugin ([#235](https://github.com/gregberge/svgr/issues/235)) ([144dbe3](https://github.com/gregberge/svgr/commit/144dbe3)), closes [#215](https://github.com/gregberge/svgr/issues/215)\n\n## [4.0.4](https://github.com/gregberge/svgr/compare/v4.0.3...v4.0.4) (2018-11-24)\n\n### Bug Fixes\n\n- **webpack:** use static babel config ([#240](https://github.com/gregberge/svgr/issues/240)) ([d67af31](https://github.com/gregberge/svgr/commit/d67af31)), closes [#232](https://github.com/gregberge/svgr/issues/232)\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/rollup\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/rollup\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Features\n\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n\n# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)\n\n### Bug Fixes\n\n- style & custom SVG properties ([#203](https://github.com/gregberge/svgr/issues/203)) ([f8b2212](https://github.com/gregberge/svgr/commit/f8b2212)), closes [#199](https://github.com/gregberge/svgr/issues/199) [#201](https://github.com/gregberge/svgr/issues/201)\n\n<a name=\"3.0.0\"></a>\n\n# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)\n\n### Bug Fixes\n\n- **rollup:** forward filePath in rollup plugin ([461492b](https://github.com/gregberge/svgr/commit/461492b)), closes [#177](https://github.com/gregberge/svgr/issues/177) [#188](https://github.com/gregberge/svgr/issues/188)\n\n### Features\n\n- always prefix component name with \"Svg\" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)\n\n### BREAKING CHANGES\n\n- **rollup:** runtime configuration is now loaded using rollup plugin.\n\n<a name=\"2.4.1\"></a>\n\n## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)\n\n**Note:** Version bump only for package @svgr/rollup\n\n<a name=\"2.4.0\"></a>\n\n# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)\n\n### Features\n\n- **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))\n\n<a name=\"2.3.0\"></a>\n\n# [2.3.0](https://github.com/gregberge/svgr/compare/v2.2.1...v2.3.0) (2018-09-03)\n\n### Features\n\n- upgrade to Babel v7 ([7bc908d](https://github.com/gregberge/svgr/commit/7bc908d))\n\n<a name=\"2.2.1\"></a>\n\n## [2.2.1](https://github.com/gregberge/svgr/compare/v2.2.0...v2.2.1) (2018-08-16)\n\n### Bug Fixes\n\n- **rollup:** fix to work with rollup-plugin-typescript2 ([#147](https://github.com/gregberge/svgr/issues/147)) ([4b3737e](https://github.com/gregberge/svgr/commit/4b3737e))\n\n<a name=\"2.2.0\"></a>\n\n# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)\n\n**Note:** Version bump only for package @svgr/rollup\n\n<a name=\"2.1.1\"></a>\n\n## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)\n\n**Note:** Version bump only for package @svgr/rollup\n\n<a name=\"2.1.0\"></a>\n\n# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)\n\n### Features\n\n- **cli:** support custom filename cases ([#136](https://github.com/gregberge/svgr/issues/136)) ([4922f7a](https://github.com/gregberge/svgr/commit/4922f7a)), closes [#118](https://github.com/gregberge/svgr/issues/118)\n"
  },
  {
    "path": "packages/rollup/README.md",
    "content": "# @svgr/rollup\n\n[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)\n[![Version](https://img.shields.io/npm/v/@svgr/rollup.svg)](https://www.npmjs.com/package/@svgr/rollup)\n[![MIT License](https://img.shields.io/npm/l/@svgr/rollup.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)\n\nRollup plugin for SVGR.\n\n```\nnpm install @svgr/rollup --save-dev\n```\n\nIn your `rollup.config.js`:\n\n```js\n{\n  plugins: [svgr()]\n}\n```\n\nIn your code:\n\n```js\nimport Star from './star.svg'\n\nconst App = () => (\n  <div>\n    <Star />\n  </div>\n)\n```\n\n### Passing options\n\n```js\n{\n  plugins: [svgr({ native: true })]\n}\n```\n\n### Using with `url` plugin\n\nIt is possible to use it with [`url`](https://github.com/rollup/rollup-plugin-url).\n\nIn your `rollup.config.js`:\n\n```js\n{\n  plugins: [url(), svgr()]\n}\n```\n\nIn your code:\n\n```js\nimport starUrl, { ReactComponent as Star } from './star.svg'\n\nconst App = () => (\n  <div>\n    <img src={starUrl} alt=\"star\" />\n    <Star />\n  </div>\n)\n```\n\nThe named export defaults to `ReactComponent`, but can be customized with the `namedExport` option.\n\nPlease note that by default, `@svgr/rollup` will try to export the React Component via default export if there is no other plugin handling svg files with default export. When there is already any other plugin using default export for svg files, `@svgr/rollup` will always export the React component via named export.\n\nIf you prefer named export in any case, you may set the `exportType` option to `named`.\n\n### Use your own Babel configuration\n\nBy default, `@svgr/rollup` applies a babel transformation with [optimized configuration](https://github.com/gregberge/svgr/blob/main/packages/rollup/src/index.ts). In some case you may want to apply a custom one (if you are using Preact for an example). You can turn off Babel transformation by specifying `babel: false` in options.\n\n```js\n{\n  plugins: [svgr({ babel: false })]\n}\n```\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/rollup/package.json",
    "content": "{\n  \"name\": \"@svgr/rollup\",\n  \"description\": \"SVGR Rollup plugin.\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/rollup\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr\",\n    \"svg\",\n    \"react\",\n    \"rollup\",\n    \"rollup-plugin\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"dependencies\": {\n    \"@babel/core\": \"^7.21.3\",\n    \"@babel/plugin-transform-react-constant-elements\": \"^7.21.3\",\n    \"@babel/preset-env\": \"^7.20.2\",\n    \"@babel/preset-react\": \"^7.18.6\",\n    \"@babel/preset-typescript\": \"^7.21.0\",\n    \"@rollup/pluginutils\": \"^5.0.2\",\n    \"@svgr/core\": \"workspace:*\",\n    \"@svgr/plugin-jsx\": \"workspace:*\",\n    \"@svgr/plugin-svgo\": \"workspace:*\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^3.20.2\",\n    \"rollup-plugin-image\": \"^1.0.2\",\n    \"rollup-plugin-url\": \"^3.0.1\"\n  }\n}\n"
  },
  {
    "path": "packages/rollup/src/__snapshots__/index.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`rollup loader should convert file 1`] = `\n\"var _path;\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from \"react\";\nvar SvgFile = function SvgFile(props) {\n  return /*#__PURE__*/React.createElement(\"svg\", _extends({\n    xmlns: \"http://www.w3.org/2000/svg\",\n    width: 48,\n    height: 1\n  }, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n    fill: \"#063855\",\n    fillRule: \"evenodd\",\n    d: \"M0 0h48v1H0z\"\n  })));\n};\nexport default SvgFile;\"\n`;\n\nexports[`rollup loader should convert file with previousExport of image plugin 1`] = `\n\"import * as React from \"react\";\nconst SvgFile = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}><path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" /></svg>;\nexport { SvgFile as ReactComponent };\nvar img = new Image();\nimg.src = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDhweCIgaGVpZ2h0PSIxcHgiIHZpZXdCb3g9IjAgMCA0OCAxIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0Ni4yICg0NDQ5NikgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+UmVjdGFuZ2xlIDU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iMTktU2VwYXJhdG9yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTI5LjAwMDAwMCwgLTE1Ni4wMDAwMDApIiBmaWxsPSIjMDYzODU1Ij4KICAgICAgICAgICAgPGcgaWQ9IkNvbnRyb2xzL1NldHRpbmdzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4MC4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iQ29udGVudCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDY0LjAwMDAwMCkiPgogICAgICAgICAgICAgICAgICAgIDxnIGlkPSJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjQuMDAwMDAwLCA1Ni4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICAgICAgPGcgaWQ9Ikdyb3VwLTIiPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS01IiB4PSIyNSIgeT0iMzYiIHdpZHRoPSI0OCIgaGVpZ2h0PSIxIj48L3JlY3Q+CiAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=';\nexport default img;\"\n`;\n\nexports[`rollup loader should convert file with previousExport of url plugin 1`] = `\n\"import * as React from \"react\";\nconst SvgFile = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}><path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" /></svg>;\nexport { SvgFile as ReactComponent };\nexport default \"data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Csvg%20width%3D%2248px%22%20height%3D%221px%22%20viewBox%3D%220%200%2048%201%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%20%20%20%20%20%20%20%20%3Ctitle%3ERectangle%205%3C%2Ftitle%3E%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%20%20%20%20%3Cdefs%3E%3C%2Fdefs%3E%20%20%20%20%3Cg%20id%3D%22Page-1%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%20%20%20%20%20%20%20%20%3Cg%20id%3D%2219-Separator%22%20transform%3D%22translate%28-129.000000%2C%20-156.000000%29%22%20fill%3D%22%23063855%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Controls%2FSettings%22%20transform%3D%22translate%2880.000000%2C%200.000000%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Content%22%20transform%3D%22translate%280.000000%2C%2064.000000%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Group%22%20transform%3D%22translate%2824.000000%2C%2056.000000%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Group-2%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Crect%20id%3D%22Rectangle-5%22%20x%3D%2225%22%20y%3D%2236%22%20width%3D%2248%22%20height%3D%221%22%3E%3C%2Frect%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E\";\"\n`;\n\nexports[`rollup loader should convert file without babel 1`] = `\n\"import * as React from \"react\";\nconst SvgFile = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={48} height={1} {...props}><path fill=\"#063855\" fillRule=\"evenodd\" d=\"M0 0h48v1H0z\" /></svg>;\nexport default SvgFile;\"\n`;\n"
  },
  {
    "path": "packages/rollup/src/index.test.ts",
    "content": "import { rollup, RollupBuild } from 'rollup'\n// @ts-ignore\nimport image from 'rollup-plugin-image'\n// @ts-ignore\nimport url from 'rollup-plugin-url'\nimport svgr from './index'\n\nconst compile = (plugins = [svgr()]) =>\n  rollup({\n    input: './__fixtures__/simple/file.svg',\n    plugins,\n  })\n\nconst getCode = (bundler: RollupBuild) =>\n  bundler.cache?.modules?.find(\n    ({ id }) =>\n      id.includes('__fixtures__/simple/file.svg') ||\n      id.includes('__fixtures__\\\\simple\\\\file.svg'),\n  )?.code\n\ndescribe('rollup loader', () => {\n  it('should convert file', async () => {\n    const code = await compile([svgr()])\n    expect(getCode(code)).toMatchSnapshot()\n  })\n\n  it('should convert file without babel', async () => {\n    const code = await compile([svgr({ babel: false })])\n    expect(getCode(code)).toMatchSnapshot()\n  })\n\n  it('should convert file with previousExport of image plugin', async () => {\n    const code = await compile([image(), svgr({ babel: false })])\n    expect(getCode(code)).toMatchSnapshot()\n  })\n\n  it('should convert file with previousExport of url plugin', async () => {\n    const code = await compile([url(), svgr({ babel: false })])\n    expect(getCode(code)).toMatchSnapshot()\n  })\n})\n"
  },
  {
    "path": "packages/rollup/src/index.ts",
    "content": "import * as fs from 'fs'\nimport { transform, Config } from '@svgr/core'\nimport { createFilter, CreateFilter } from '@rollup/pluginutils'\nimport { transformAsync, createConfigItem } from '@babel/core'\nimport svgo from '@svgr/plugin-svgo'\nimport jsx from '@svgr/plugin-jsx'\n// @ts-ignore\nimport presetReact from '@babel/preset-react'\n// @ts-ignore\nimport presetEnv from '@babel/preset-env'\n// @ts-ignore\nimport presetTS from '@babel/preset-typescript'\n// @ts-ignore\nimport pluginTransformReactConstantElements from '@babel/plugin-transform-react-constant-elements'\nimport type { PluginImpl } from 'rollup'\n\nconst babelOptions = {\n  babelrc: false,\n  configFile: false,\n  presets: [\n    createConfigItem(presetReact, { type: 'preset' }),\n    createConfigItem([presetEnv, { modules: false }], { type: 'preset' }),\n  ],\n  plugins: [createConfigItem(pluginTransformReactConstantElements)],\n}\n\nconst typeScriptBabelOptions = {\n  ...babelOptions,\n  presets: [\n    ...babelOptions.presets,\n    createConfigItem(\n      [presetTS, { allowNamespaces: true, allExtensions: true, isTSX: true }],\n      { type: 'preset' },\n    ),\n  ],\n}\nexport interface Options extends Config {\n  include?: Parameters<CreateFilter>[0]\n  exclude?: Parameters<CreateFilter>[1]\n  babel?: boolean\n}\n\nconst plugin: PluginImpl<Options> = (options = {}) => {\n  const EXPORT_REGEX = /(module\\.exports *= *|export default)/\n  const filter = createFilter(options.include || '**/*.svg', options.exclude)\n  const { babel = true } = options\n\n  return {\n    name: 'svgr',\n    async transform(data, id) {\n      if (!filter(id)) return null\n      if (id.slice(-4) !== '.svg') return null\n\n      const load = fs.readFileSync(id, 'utf8')\n\n      const previousExport = EXPORT_REGEX.test(data) ? data : null\n\n      const jsCode = await transform(load, options, {\n        filePath: id,\n        caller: {\n          name: '@svgr/rollup',\n          previousExport,\n          defaultPlugins: [svgo, jsx],\n        },\n      })\n\n      if (babel) {\n        const result = await transformAsync(\n          jsCode,\n          options.typescript ? typeScriptBabelOptions : babelOptions,\n        )\n        if (!result?.code) {\n          throw new Error(`Error while transforming using Babel`)\n        }\n        return { code: result.code, map: null }\n      }\n\n      return {\n        ast: {\n          type: 'Program',\n          start: 0,\n          end: 0,\n          sourceType: 'module',\n          body: [],\n        },\n        code: jsCode,\n        map: null,\n      }\n    },\n  }\n}\n\nexport default plugin\n"
  },
  {
    "path": "packages/rollup/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/webpack/.npmignore",
    "content": "/*\n/dist/*\n!/dist/index.{d.ts,js}\n!/dist/index.js.map"
  },
  {
    "path": "packages/webpack/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [8.1.0](https://github.com/gregberge/svgr/compare/v8.0.1...v8.1.0) (2023-08-15)\n\n**Note:** Version bump only for package @svgr/webpack\n\n\n\n\n\n## [8.0.1](https://github.com/gregberge/svgr/compare/v8.0.0...v8.0.1) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/webpack\n\n\n\n\n\n# [8.0.0](https://github.com/gregberge/svgr/compare/v7.0.0...v8.0.0) (2023-05-09)\n\n**Note:** Version bump only for package @svgr/webpack\n\n\n\n\n\n# [7.0.0](https://github.com/gregberge/svgr/compare/v6.5.1...v7.0.0) (2023-03-24)\n\n\n### Features\n\n* upgrade to svgo v3 ([#798](https://github.com/gregberge/svgr/issues/798)) ([21b6209](https://github.com/gregberge/svgr/commit/21b6209ef34c51cc0313901f31061afe587ab29b))\n\n\n### BREAKING CHANGES\n\n* svgr now requires Node.js v14+\n\n\n\n\n\n## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)\n\n### Reverts\n\n- Revert \"feat(a11y): add attribute role=\"img\" to the svg element (#750)\" ([1382232](https://github.com/gregberge/svgr/commit/138223284ad9aebc5bbf94ed3ae7174a66dbc7f5)), closes [#750](https://github.com/gregberge/svgr/issues/750)\n\n# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [6.4.0](https://github.com/gregberge/svgr/compare/v6.3.1...v6.4.0) (2022-10-01)\n\n### Features\n\n- **a11y:** add attribute role=\"img\" to the svg element ([#750](https://github.com/gregberge/svgr/issues/750)) ([8b9edc4](https://github.com/gregberge/svgr/commit/8b9edc4e712f3adbd9f9c503dfc5e4d627f763cd))\n\n## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)\n\n### Bug Fixes\n\n- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))\n\n# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)\n\n### Bug Fixes\n\n- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))\n\n## [6.2.1](https://github.com/gregberge/svgr/compare/v6.2.0...v6.2.1) (2022-01-30)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [6.2.0](https://github.com/gregberge/svgr/compare/v6.1.2...v6.2.0) (2022-01-10)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [6.1.2](https://github.com/gregberge/svgr/compare/v6.1.1...v6.1.2) (2021-12-12)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [6.1.1](https://github.com/gregberge/svgr/compare/v6.1.0...v6.1.1) (2021-12-04)\n\n### Bug Fixes\n\n- **webpack:** fix double export ([#648](https://github.com/gregberge/svgr/issues/648)) ([7595d37](https://github.com/gregberge/svgr/commit/7595d378b73d4826a4cead165b3f32386b07315b)), closes [#645](https://github.com/gregberge/svgr/issues/645)\n\n# [6.1.0](https://github.com/gregberge/svgr/compare/v6.0.0...v6.1.0) (2021-12-01)\n\n### Bug Fixes\n\n- fix previous export system ([1872829](https://github.com/gregberge/svgr/commit/187282977af841cd5a2243a23abba72b20eec2fa)), closes [#635](https://github.com/gregberge/svgr/issues/635)\n\n### Performance Improvements\n\n- remove useless loader-utils package ([387bc72](https://github.com/gregberge/svgr/commit/387bc727a4e07c2668544e3f5afbefe29a3de909)), closes [#631](https://github.com/gregberge/svgr/issues/631)\n\n# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.4.0...v5.5.0) (2020-11-15)\n\n### Bug Fixes\n\n- prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/webpack/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/webpack/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/webpack/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))\n\n### Features\n\n- allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/webpack/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/webpack/commit/16a58d6e817c065f72a68be91600a1a360205f44))\n\n# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.3.1...v5.4.0) (2020-04-27)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.3.0...v5.3.1) (2020-04-05)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.2.0...v5.3.0) (2020-03-22)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.1.0...v5.2.0) (2020-02-23)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [5.1.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.0.1...v5.1.0) (2020-01-20)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.0.0...v5.0.1) (2019-12-29)\n\n### Bug Fixes\n\n- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/webpack/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))\n\n## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.3.2...v4.3.3) (2019-09-24)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.3.1...v4.3.2) (2019-07-15)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.3.0...v4.3.1) (2019-07-01)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.2.0...v4.3.0) (2019-05-28)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.1.0...v4.2.0) (2019-04-11)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)\n\n### Features\n\n- add parcel plugin ([#235](https://github.com/gregberge/svgr/issues/235)) ([144dbe3](https://github.com/gregberge/svgr/commit/144dbe3)), closes [#215](https://github.com/gregberge/svgr/issues/215)\n\n## [4.0.4](https://github.com/gregberge/svgr/compare/v4.0.3...v4.0.4) (2018-11-24)\n\n### Bug Fixes\n\n- **webpack:** use static babel config ([#240](https://github.com/gregberge/svgr/issues/240)) ([d67af31](https://github.com/gregberge/svgr/commit/d67af31)), closes [#232](https://github.com/gregberge/svgr/issues/232)\n\n## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)\n\n### Bug Fixes\n\n- upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))\n\n## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/webpack\n\n## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)\n\n**Note:** Version bump only for package @svgr/webpack\n\n# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)\n\n### Bug Fixes\n\n- prevent babel read babel.config.js ([#206](https://github.com/gregberge/svgr/issues/206)) ([514d43d](https://github.com/gregberge/svgr/commit/514d43d))\n\n### Features\n\n- **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)\n- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))\n\n### BREAKING CHANGES\n\n- **v4:** - `template` option must now returns a Babel AST\n\n* `@svgr/core` does not include svgo & prettier by default\n\n# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)\n\n**Note:** Version bump only for package @svgr/webpack\n\n<a name=\"3.0.0\"></a>\n\n# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)\n\n### Bug Fixes\n\n- **webpack:** forward filePath in webpack loader ([b7a108e](https://github.com/gregberge/svgr/commit/b7a108e)), closes [#177](https://github.com/gregberge/svgr/issues/177) [#188](https://github.com/gregberge/svgr/issues/188)\n\n### Features\n\n- always prefix component name with \"Svg\" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)\n\n### BREAKING CHANGES\n\n- **webpack:** runtime configuration is now loaded using webpack\n  loader.\n\n<a name=\"2.4.1\"></a>\n\n## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)\n\n**Note:** Version bump only for package @svgr/webpack\n\n<a name=\"2.4.0\"></a>\n\n# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)\n\n### Features\n\n- **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))\n\n<a name=\"2.3.0\"></a>\n\n# [2.3.0](https://github.com/gregberge/svgr/compare/v2.2.1...v2.3.0) (2018-09-03)\n\n### Features\n\n- upgrade to Babel v7 ([7bc908d](https://github.com/gregberge/svgr/commit/7bc908d))\n\n<a name=\"2.2.1\"></a>\n\n## [2.2.1](https://github.com/gregberge/svgr/compare/v2.2.0...v2.2.1) (2018-08-16)\n\n**Note:** Version bump only for package @svgr/webpack\n\n<a name=\"2.2.0\"></a>\n\n# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)\n\n### Bug Fixes\n\n- **webpack:** use source when possible ([#139](https://github.com/gregberge/svgr/issues/139)) ([ae9965d](https://github.com/gregberge/svgr/commit/ae9965d))\n\n<a name=\"2.1.1\"></a>\n\n## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)\n\n**Note:** Version bump only for package @svgr/webpack\n\n<a name=\"2.1.0\"></a>\n\n# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)\n\n**Note:** Version bump only for package @svgr/webpack\n"
  },
  {
    "path": "packages/webpack/README.md",
    "content": "# @svgr/webpack\n\n[![Build Status](https://img.shields.io/travis/gregberge/svgr.svg)](https://travis-ci.org/gregberge/svgr)\n[![Version](https://img.shields.io/npm/v/@svgr/webpack.svg)](https://www.npmjs.com/package/@svgr/webpack)\n[![MIT License](https://img.shields.io/npm/l/@svgr/webpack.svg)](https://github.com/gregberge/svgr/blob/master/LICENSE)\n\nWebpack loader for SVGR.\n\n```\nnpm install @svgr/webpack --save-dev\n```\n\n## Usage\n\nIn your `webpack.config.js`:\n\n```js\n{\n  test: /\\.svg$/,\n  use: ['@svgr/webpack'],\n}\n```\n\nIn your code:\n\n```js\nimport Star from './star.svg'\n\nconst App = () => (\n  <div>\n    <Star />\n  </div>\n)\n```\n\n### Passing options\n\n```js\n{\n  test: /\\.svg$/,\n  use: [\n    {\n      loader: '@svgr/webpack',\n      options: {\n        native: true,\n      },\n    },\n  ],\n}\n```\n\n### Using with `url-loader` or `file-loader`\n\nIt is possible to use it with [`url-loader`](https://github.com/webpack-contrib/url-loader) or [`file-loader`](https://github.com/webpack-contrib/file-loader).\n\nIn your `webpack.config.js`:\n\n```js\n{\n  test: /\\.svg$/,\n  use: ['@svgr/webpack', 'url-loader'],\n}\n```\n\nIn your code:\n\n```js\nimport starUrl, { ReactComponent as Star } from './star.svg'\n\nconst App = () => (\n  <div>\n    <img src={starUrl} alt=\"star\" />\n    <Star />\n  </div>\n)\n```\n\nThe named export defaults to `ReactComponent`, but can be customized with the `namedExport` option.\n\nPlease note that by default, `@svgr/webpack` will try to export the React Component via default export if there is no other loader handling svg files with default export. When there is already any other loader using default export for svg files, `@svgr/webpack` will always export the React component via named export.\n\nIf you prefer named export in any case, you may set the `exportType` option to `named`.\n\n### Use your own Babel configuration\n\nBy default, `@svgr/webpack` includes a `babel-loader` with [an optimized configuration](https://github.com/gregberge/svgr/blob/main/packages/webpack/src/index.ts). In some case you may want to apply a custom one (if you are using Preact for an example). You can turn off Babel transformation by specifying `babel: false` in options.\n\n```js\n// Example using preact\n{\n  test: /\\.svg$/,\n  use: [\n    {\n      loader: 'babel-loader',\n      options: {\n        presets: ['preact', 'env'],\n      },\n    },\n    {\n      loader: '@svgr/webpack',\n      options: { babel: false },\n    }\n  ],\n}\n```\n\n### Handle SVG in CSS, Sass or Less\n\nIt is possible to detect the module that requires your SVG using [`Rule.issuer`](https://webpack.js.org/configuration/module/#ruleissuer) in Webpack 5. Using it you can specify two different configurations for JavaScript and the rest of your files.\n\n```js\n;[\n  {\n    test: /\\.svg(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n    issuer: /\\.[jt]sx?$/,\n    use: ['babel-loader', '@svgr/webpack', 'url-loader'],\n  },\n  {\n    test: /\\.svg(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n    loader: 'url-loader',\n  },\n]\n```\n\n_[Rule.issuer](https://v4.webpack.js.org/configuration/module/#ruleissuer) in Webpack 4 has additional conditions which are not available in Webpack 5._\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/webpack/package.json",
    "content": "{\n  \"name\": \"@svgr/webpack\",\n  \"description\": \"SVGR webpack loader.\",\n  \"version\": \"8.1.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"repository\": \"https://github.com/gregberge/svgr/tree/main/packages/webpack\",\n  \"author\": \"Greg Bergé <berge.greg@gmail.com>\",\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"keywords\": [\n    \"svgr\",\n    \"svg\",\n    \"react\",\n    \"webpack\",\n    \"webpack-loader\"\n  ],\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"homepage\": \"https://react-svgr.com\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/gregberge\"\n  },\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"reset\": \"rm -rf dist\",\n    \"build\": \"rollup -c ../../build/rollup.config.mjs\",\n    \"prepublishOnly\": \"pnpm run reset && pnpm run build\"\n  },\n  \"dependencies\": {\n    \"@babel/core\": \"^7.21.3\",\n    \"@babel/plugin-transform-react-constant-elements\": \"^7.21.3\",\n    \"@babel/preset-env\": \"^7.20.2\",\n    \"@babel/preset-react\": \"^7.18.6\",\n    \"@babel/preset-typescript\": \"^7.21.0\",\n    \"@svgr/core\": \"workspace:*\",\n    \"@svgr/plugin-jsx\": \"workspace:*\",\n    \"@svgr/plugin-svgo\": \"workspace:*\"\n  },\n  \"devDependencies\": {\n    \"babel-loader\": \"^9.1.2\",\n    \"memory-fs\": \"^0.5.0\",\n    \"url-loader\": \"^4.1.1\",\n    \"webpack\": \"^5.76.3\"\n  }\n}\n"
  },
  {
    "path": "packages/webpack/src/__snapshots__/index.test.ts.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`webpack loader supports url-loader 1`] = `\n\"var _svg;\nimport * as React from \"react\";\nvar SvgIcon = function SvgIcon() {\n  return _svg || (_svg = /*#__PURE__*/React.createElement(\"svg\", {\n    xmlns: \"http://www.w3.org/2000/svg\",\n    width: 88,\n    height: 88\n  }, /*#__PURE__*/React.createElement(\"g\", {\n    fill: \"none\",\n    fillRule: \"evenodd\",\n    stroke: \"#063855\",\n    strokeLinecap: \"square\",\n    strokeWidth: 2\n  }, /*#__PURE__*/React.createElement(\"path\", {\n    d: \"M51 37 37 51M51 51 37 37\"\n  }))));\n};\nexport { SvgIcon as ReactComponent };\nexport default \"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODhweCIgaGVpZ2h0PSI4OHB4IiB2aWV3Qm94PSIwIDAgODggODgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ2LjIgKDQ0NDk2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5EaXNtaXNzPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IkJsb2NrcyIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSI+CiAgICAgICAgPGcgaWQ9IkRpc21pc3MiIHN0cm9rZT0iIzA2Mzg1NSIgc3Ryb2tlLXdpZHRoPSIyIj4KICAgICAgICAgICAgPHBhdGggZD0iTTUxLDM3IEwzNyw1MSIgaWQ9IlNoYXBlIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik01MSw1MSBMMzcsMzciIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==\";\"\n`;\n\nexports[`webpack loader transforms file (babel: false) 1`] = `\n\"import * as React from \"react\";\nconst SvgIcon = () => /*#__PURE__*/React.createElement(\"svg\", {\n  xmlns: \"http://www.w3.org/2000/svg\",\n  width: 88,\n  height: 88\n}, /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\",\n  stroke: \"#063855\",\n  strokeLinecap: \"square\",\n  strokeWidth: 2\n}, /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M51 37 37 51M51 51 37 37\"\n})));\nexport default SvgIcon;\"\n`;\n\nexports[`webpack loader transforms file (typescript: true) 1`] = `\n\"var _g;\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from \"react\";\nvar SvgIcon = function SvgIcon(props) {\n  return /*#__PURE__*/React.createElement(\"svg\", _extends({\n    xmlns: \"http://www.w3.org/2000/svg\",\n    width: 88,\n    height: 88\n  }, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n    fill: \"none\",\n    fillRule: \"evenodd\",\n    stroke: \"#063855\",\n    strokeLinecap: \"square\",\n    strokeWidth: 2\n  }, /*#__PURE__*/React.createElement(\"path\", {\n    d: \"M51 37 37 51M51 51 37 37\"\n  }))));\n};\nexport default SvgIcon;\"\n`;\n\nexports[`webpack loader transforms file 1`] = `\n\"var _svg;\nimport * as React from \"react\";\nvar SvgIcon = function SvgIcon() {\n  return _svg || (_svg = /*#__PURE__*/React.createElement(\"svg\", {\n    xmlns: \"http://www.w3.org/2000/svg\",\n    width: 88,\n    height: 88\n  }, /*#__PURE__*/React.createElement(\"g\", {\n    fill: \"none\",\n    fillRule: \"evenodd\",\n    stroke: \"#063855\",\n    strokeLinecap: \"square\",\n    strokeWidth: 2\n  }, /*#__PURE__*/React.createElement(\"path\", {\n    d: \"M51 37 37 51M51 51 37 37\"\n  }))));\n};\nexport default SvgIcon;\"\n`;\n\nexports[`webpack loader transforms file 2`] = `\n\"var _svg;\nimport * as React from \"react\";\nvar SvgIcon = function SvgIcon() {\n  return _svg || (_svg = /*#__PURE__*/React.createElement(\"svg\", {\n    xmlns: \"http://www.w3.org/2000/svg\",\n    width: 88,\n    height: 88\n  }, /*#__PURE__*/React.createElement(\"g\", {\n    fill: \"none\",\n    fillRule: \"evenodd\",\n    stroke: \"#063855\",\n    strokeLinecap: \"square\",\n    strokeWidth: 2\n  }, /*#__PURE__*/React.createElement(\"path\", {\n    d: \"M51 37 37 51M51 51 37 37\"\n  }))));\n};\nexport default SvgIcon;\"\n`;\n"
  },
  {
    "path": "packages/webpack/src/index.test.ts",
    "content": "import * as path from 'path'\nimport { webpack, ModuleOptions } from 'webpack'\n// @ts-ignore\nimport MemoryFs from 'memory-fs'\n\nfunction compile(rules: ModuleOptions['rules']) {\n  const compiler = webpack({\n    mode: 'development',\n    context: __dirname,\n    entry: './__fixtures__/icon.svg',\n    output: {\n      path: __dirname,\n      filename: 'bundle.js',\n    },\n    module: { rules },\n  })\n\n  compiler.outputFileSystem = new MemoryFs()\n\n  return new Promise((resolve, reject) => {\n    compiler.run((err, stats) => {\n      if (err) reject(err)\n      else {\n        resolve(\n          stats\n            ?.toJson({ source: true })\n            ?.modules?.find(({ name }) => name === './__fixtures__/icon.svg')\n            ?.source,\n        )\n      }\n    })\n  })\n}\n\ndescribe('webpack loader', () => {\n  it('transforms file (typescript: true)', async () => {\n    const source = await compile([\n      {\n        test: /\\.svg$/,\n        use: [\n          {\n            loader: path.resolve(__dirname, '..'),\n            options: {\n              typescript: true,\n            },\n          },\n        ],\n      },\n    ])\n\n    expect(source).toMatchSnapshot()\n  })\n\n  it('transforms file', async () => {\n    const source = await compile([\n      {\n        test: /\\.svg$/,\n        use: [\n          {\n            loader: path.resolve(__dirname, '..'),\n            options: {\n              expandProps: false,\n            },\n          },\n        ],\n      },\n    ])\n\n    expect(source).toMatchSnapshot()\n  })\n\n  it('transforms file', async () => {\n    const source = await compile([\n      {\n        test: /\\.svg$/,\n        use: [\n          {\n            loader: path.resolve(__dirname, '..'),\n            options: {\n              expandProps: false,\n            },\n          },\n        ],\n      },\n    ])\n\n    expect(source).toMatchSnapshot()\n  })\n\n  it('supports url-loader', async () => {\n    const source = await compile([\n      {\n        test: /\\.svg$/,\n        use: [\n          {\n            loader: path.resolve(__dirname, '..'),\n            options: {\n              expandProps: false,\n            },\n          },\n          'url-loader',\n        ],\n      },\n    ])\n\n    expect(source).toMatchSnapshot()\n  })\n\n  it('transforms file (babel: false)', async () => {\n    const source = await compile([\n      {\n        test: /\\.svg$/,\n        use: [\n          {\n            loader: 'babel-loader',\n            options: {\n              babelrc: false,\n              presets: ['@babel/preset-react'],\n            },\n          },\n          {\n            loader: path.resolve(__dirname, '..'),\n            options: {\n              babel: false,\n              expandProps: false,\n            },\n          },\n        ],\n      },\n    ])\n\n    expect(source).toMatchSnapshot()\n  })\n})\n"
  },
  {
    "path": "packages/webpack/src/index.ts",
    "content": "import { callbackify } from 'util'\nimport { transformAsync, createConfigItem } from '@babel/core'\nimport { transform, Config, State } from '@svgr/core'\nimport { normalize } from 'path'\nimport svgo from '@svgr/plugin-svgo'\nimport jsx from '@svgr/plugin-jsx'\n// @ts-ignore\nimport presetReact from '@babel/preset-react'\n// @ts-ignore\nimport presetEnv from '@babel/preset-env'\n// @ts-ignore\nimport presetTS from '@babel/preset-typescript'\n// @ts-ignore\nimport pluginTransformReactConstantElements from '@babel/plugin-transform-react-constant-elements'\nimport type * as webpack from 'webpack'\n\nconst babelOptions = {\n  babelrc: false,\n  configFile: false,\n  presets: [\n    createConfigItem(presetReact, { type: 'preset' }),\n    createConfigItem([presetEnv, { modules: false }], { type: 'preset' }),\n  ],\n  plugins: [createConfigItem(pluginTransformReactConstantElements)],\n}\n\nconst typeScriptBabelOptions = {\n  ...babelOptions,\n  presets: [\n    ...babelOptions.presets,\n    createConfigItem(\n      [presetTS, { allowNamespaces: true, allExtensions: true, isTSX: true }],\n      { type: 'preset' },\n    ),\n  ],\n}\n\ninterface LoaderOptions extends Config {\n  babel?: boolean\n}\n\nconst tranformSvg = callbackify(\n  async (contents: string, options: LoaderOptions, state: Partial<State>) => {\n    const { babel = true, ...config } = options\n    const jsCode = await transform(contents, config, state)\n    if (!babel) return jsCode\n    const result = await transformAsync(\n      jsCode,\n      options.typescript ? typeScriptBabelOptions : babelOptions,\n    )\n    if (!result?.code) {\n      throw new Error(`Error while transforming using Babel`)\n    }\n    return result.code\n  },\n)\n\nfunction svgrLoader(\n  this: webpack.LoaderContext<LoaderOptions>,\n  contents: string,\n): void {\n  this.cacheable && this.cacheable()\n  const callback = this.async()\n\n  const options = this.getOptions()\n\n  const previousExport = (() => {\n    if (contents.startsWith('export ')) return contents\n    const exportMatches = contents.match(/^module.exports\\s*=\\s*(.*)/)\n    return exportMatches ? `export default ${exportMatches[1]}` : null\n  })()\n\n  const state = {\n    caller: {\n      name: '@svgr/webpack',\n      previousExport,\n      defaultPlugins: [svgo, jsx],\n    },\n    filePath: normalize(this.resourcePath),\n  }\n\n  if (!previousExport) {\n    tranformSvg(contents, options, state, callback)\n  } else {\n    this.fs.readFile(this.resourcePath, (err, result) => {\n      if (err) {\n        callback(err)\n        return\n      }\n      tranformSvg(String(result), options, state, (err, content) => {\n        if (err) {\n          callback(err)\n          return\n        }\n        callback(null, content)\n      })\n    })\n  }\n}\n\nexport default svgrLoader\n"
  },
  {
    "path": "packages/webpack/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "pnpm-workspace.yaml",
    "content": "packages:\n  - 'packages/*'\n  - 'examples/**'\n"
  },
  {
    "path": "public/.exists",
    "content": ""
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"moduleResolution\": \"Node\",\n    \"target\": \"es2019\",\n    \"lib\": [\n      \"es2019\",\n      \"es2020.bigint\",\n      \"es2020.string\",\n      \"es2020.symbol.wellknown\"\n    ],\n    \"module\": \"ESNext\",\n    \"strict\": true,\n    \"sourceMap\": true,\n    \"declaration\": true,\n    \"resolveJsonModule\": true\n  }\n}\n"
  },
  {
    "path": "website/.eslintignore",
    "content": ".cache/\nnode_modules/\n/public/"
  },
  {
    "path": "website/.eslintrc.js",
    "content": "module.exports = {\n  globals: {\n    __PATH_PREFIX__: true,\n  },\n  extends: `react-app`,\n}\n"
  },
  {
    "path": "website/.gitignore",
    "content": ".cache/\nnode_modules/\n/public/"
  },
  {
    "path": "website/.npmrc",
    "content": "node-linker=hoisted"
  },
  {
    "path": "website/.nvmrc",
    "content": "16"
  },
  {
    "path": "website/README.md",
    "content": "# SVGR documentation website\n\n[Documentation site](https://react-svgr.com) for [svgr](https://github.com/gregberge/svgr). `svgr-docs` is running on [gatsbyjs](https://gatsbyjs.org).\n\n## Getting Started\n\nTo install and run the docs site locally:\n\n```bash\nnpm install\nnpm run dev\n```\n\nThen, open your favorite browser to [localhost:8000](http://localhost:8000/). GraphiQL runs at [localhost:8000/\\_\\_\\_graphql](http://localhost:8000/___graphql).\n\n## Contributing\n\nBuild the site to test locally.\n\n```bash\nnpm run build\n```\n\nServe the build.\n\n```bash\nnpm run serve\n```\n\nThen, open your favorite browser to [localhost:9000](http://localhost:9000/) to verify everything looks correct.\n"
  },
  {
    "path": "website/_redirects",
    "content": "https://svgr.netlify.com/* https://react-svgr.com/:splat 301!"
  },
  {
    "path": "website/gatsby-config.js",
    "content": "const path = require('path')\n\nmodule.exports = {\n  plugins: [\n    {\n      resolve: 'smooth-doc',\n      options: {\n        name: 'SVGR',\n        author: 'Greg Bergé',\n        description: 'Transforms SVG into React Components.',\n        siteUrl: 'https://react-svgr.com',\n        githubRepositoryURL: 'https://github.com/gregberge/svgr',\n        githubDefaultBranch: 'main',\n        baseDirectory: path.resolve(__dirname, '..'),\n        navItems: [\n          { title: 'Playground', url: '/playground/' },\n          { title: 'Docs', url: '/docs/' },\n        ],\n        sections: ['About', 'Usage', 'Configuring SVGR', 'Advanced'],\n        carbonAdsURL:\n          '//cdn.carbonads.com/carbon.js?serve=CE7I5K3N&placement=react-svgrcom',\n        docSearch: {\n          apiKey: '0c7343afd83c189413499c62c1df6853',\n          indexName: 'smooth-code-svgr',\n        },\n      },\n    },\n    {\n      resolve: `gatsby-plugin-google-analytics`,\n      options: {\n        trackingId: 'UA-154496255-2',\n      },\n    },\n  ],\n}\n"
  },
  {
    "path": "website/netlify.toml",
    "content": "[build]\n  base = \"website/\"\n  publish = \"public/\"\n  command = \"npm ci && npm run build\""
  },
  {
    "path": "website/package.json",
    "content": "{\n  \"private\": true,\n  \"dependencies\": {\n    \"@xstyled/styled-components\": \"^3.7.3\",\n    \"ariakit\": \"^2.0.0-next.43\",\n    \"brace\": \"^0.11.1\",\n    \"final-form\": \"^4.20.9\",\n    \"gatsby\": \"^4.24.5\",\n    \"gatsby-plugin-google-analytics\": \"^4.24.0\",\n    \"history\": \"^5.3.0\",\n    \"isomorphic-fetch\": \"^3.0.0\",\n    \"react\": \"^18.2.0\",\n    \"react-ace\": \"^10.1.0\",\n    \"react-dom\": \"^18.2.0\",\n    \"react-final-form\": \"^6.5.9\",\n    \"react-icons\": \"^4.8.0\",\n    \"reakit\": \"^1.3.11\",\n    \"smooth-doc\": \"^10.1.0\"\n  },\n  \"scripts\": {\n    \"build\": \"gatsby build && cp _redirects public/\",\n    \"dev\": \"gatsby develop\",\n    \"serve\": \"gatsby serve\"\n  },\n  \"devDependencies\": {\n    \"eslint-config-react-app\": \"^7.0.1\"\n  },\n  \"overrides\": {\n    \"react\": \"^18.2.0\",\n    \"react-dom\": \"^18.2.0\"\n  }\n}\n"
  },
  {
    "path": "website/pages/docs/cli.mdx",
    "content": "---\nsection: Usage\ntitle: Command Line\nslug: /docs/cli/\norder: 20\n---\n\n# Command Line\n\nUse SVGR from command line to transform a single file or a whole directory.\n\n<carbon-ad />\n\n## Install\n\nDepending you usage, you can install `@svgr/cli` locally in your project:\n\n```sh\nnpm install --save-dev @svgr/cli\n# or use yarn\nyarn add --dev @svgr/cli\n```\n\nor use it on the fly using `npx @svgr/cli`.\n\n## Options\n\nAll [SVGR options](https://react-svgr.com/docs/options/) are available from command line or in configuration. Command line options have precedence over config file options.\n\n## Transform a single file\n\n### From file\n\nTransforms a single file by specifying file as the single argument.\n\n```sh\nnpx @svgr/cli -- icons/clock-icon.svg\n```\n\n### From standard input\n\n`@svgr/cli` supports standard input, just redirect file contents using `<` operator.\n\n```sh\nnpx @svgr/cli < icons/clock-icon.svg\n```\n\n### Output the result in another file\n\nYou can easily create another file using `>` operator.\n\n```sh\nnpx @svgr/cli -- icons/clock-icon.svg > dist/ClockIcon.js\n```\n\n## Transform a whole directory\n\nTransforms a whole directory using `--out-dir` option. All SVG presents in this directory tree are transformed into React components.\n\n```sh\n# Usage: npx @svgr/cli [--out-dir dir] [--ignore-existing] [src-dir]\n$ npx @svgr/cli --out-dir dist -- icons\nicons/web/clock-icon.svg -> dist/web/ClockIcon.js\nicons/web/wifi-icon.svg -> dist/web/WifiIcon.js\nicons/spinner/cog-icon.svg -> dist/spinner/CogIcon.js\nicons/spinner/spinner-icon.svg -> dist/spinner/SpinnerIcon.js\n```\n\n### Avoid replacing existing files\n\nEven if it is not recommended, you may be tempted to modify generated files. If you do so, you should use the `--ignore-existing` option to avoid replacing existing files.\n\n```sh\nnpx @svgr/cli --out-dir dist --ignore-existing -- icons\n```\n\n### Use a different filename case\n\nBy default, filenames uses \"PascalCase\", you can specify a different case for generated files using `--filename-case` option.\n\n```sh\nnpx @svgr/cli --out-dir dist --filename-case kebab -- icons\n```\n\n### Disable index generation\n\nBy default an index is generated, giving you opportunity to import all your components from the directory. If you does not want auto-generated index, turn it off using `--no-index` option.\n\n```sh\nnpx @svgr/cli --out-dir dist --no-index -- icons\n```\n\n### Use a custom index template\n\nAdvanced use cases could lead you to customize the index template. The `--index-template <template>` argument let you specify a custom one.\n\n```js\n// index-template.js\nconst path = require('path')\n\nfunction defaultIndexTemplate(filePaths) {\n  const exportEntries = filePaths.map(({ path: filePath, originalPath }) => {\n    const basename = path.basename(filePath, path.extname(filePath))\n    const exportName = /^\\d/.test(basename) ? `Svg${basename}` : basename\n    return `export { default as ${exportName} } from './${basename}'`\n  })\n  return exportEntries.join('\\n')\n}\n\nmodule.exports = defaultIndexTemplate\n```\n\n```sh\nnpx @svgr/cli  --out-dir dist --index-template index-template.js -- icons\n```\n"
  },
  {
    "path": "website/pages/docs/configuration-files.mdx",
    "content": "---\nsection: Configuring SVGR\ntitle: Configuration Files\nslug: /docs/configuration-files/\norder: 20\n---\n\n# Configuration Files\n\nSVGR supports project configuration files for SVGR, SVGO and Prettier.\n\n<carbon-ad />\n\n## SVGR\n\nSVGR uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure SVGR via:\n\n- A `.svgrrc` file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json/.js.\n- A `svgr.config.js` file that exports an object.\n- A \"svgr\" key in your package.json file.\n\nThe configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.\n\nThe options to the configuration file are the same as the API options.\n\n## Example\n\nJSON:\n\n```json\n{\n  \"icon\": true,\n  \"expandProps\": false\n}\n```\n\nJS:\n\n```js\n// .svgrrc.js\nmodule.exports = {\n  icon: true,\n  expandProps: false,\n}\n```\n\nYAML:\n\n```yml\n# .svgrrc\nicon: true\nexpandProps: false\n```\n\n## SVGO\n\nThe recommended way to configure SVGO for SVGR is to use [`svgo.config.js or svgo.config.cjs`](https://github.com/svg/svgo/blob/main/README.md#configuration).\n\nEven if it is not recommended, you can also use `svgoConfig` option to specify your SVGO configuration. `svgoConfig` has precedence on `svgo.config.js`.\n\n## Prettier\n\nThe recommended way to configure Prettier for SVGR is to use [`.prettierrc`](https://prettier.io/docs/en/configuration.html). It is fully supported in [all formats available](https://prettier.io/docs/en/configuration.html) and it is relative to the transformed SVG file.\n\nEven if it is not recommended, you can also use `prettierConfig` option to specify your Prettier configuration. `prettierConfig` has precedence on `.prettierrc`.\n"
  },
  {
    "path": "website/pages/docs/custom-templates.mdx",
    "content": "---\nsection: Advanced\ntitle: Custom Templates\nslug: /docs/custom-templates/\norder: 6\n---\n\n# Custom Templates\n\nCustomize template to personalize the result React component.\n\n<carbon-ad />\n\n## Custom Component template\n\nA custom template takes place in a file that exports a \"template function\".\n\nThis function is called in a babel plugin: `babel-plugin-transform-svg-component` and must returns a Babel AST. If you are not familiar with all Babel stuff, you should read [this guide](https://github.com/jamiebuilds/babel-handbook).\n\n- `variables`: All pre-compiled variables by SVGR\n  - `componentName`: The component name\n  - `props`: The properties\n  - `interfaces`: All necessary interfaces (typescript)\n  - `imports`: All necessary imports\n  - `exports`: The export of the component\n  - `jsx`: The JSX part of the component\n- `context`:\n  - `tpl`: A built-in template-tag function to create template\n  - `options`: Options passed to `babel-plugin-transform-svg-component`\n\nThe following template is the default template used by SVGR. It is a good idea to start with it:\n\n```js\nconst template = (variables, { tpl }) => {\n  return tpl`\n${variables.imports};\n\n${variables.interfaces};\n\nconst ${variables.componentName} = (${variables.props}) => (\n  ${variables.jsx}\n);\n\n${variables.exports};\n`\n}\n\nmodule.exports = template\n```\n\nLet's try something very simple. You want to add some PropTypes to your component:\n\n```js\nconst propTypesTemplate = (\n  { imports, interfaces, componentName, props, jsx, exports },\n  { tpl },\n) => {\n  return tpl`${imports}\nimport PropTypes from 'prop-types';\n${interfaces}\n\nfunction ${componentName}(${props}) {\n  return ${jsx};\n}\n\n${componentName}.propTypes = {\n  title: PropTypes.string,\n};\n\n${exports}\n  `\n}\n\nmodule.exports = propTypesTemplate\n```\n\nAs you can see it is very natural, we just add code and use AST parts in the template.\n\n### Use with CLI\n\nYou can use component template in the CLI:\n\n```sh\nnpx @svgr/cli --template template.js -- my-icon.svg\n```\n\n### Use with config\n\nSpecify the template in `.svgrrc.js`:\n\n```js\n// .svgrrc.js\nmodule.exports = {\n  template: require('./my-template'),\n}\n```\n\n## Custom index template\n\nWhen you use the CLI with `--out-dir` option, an index file is automatically generated.\n\nThe customization is the same, a file that exports a function. The function receives an argument that is an array containing objects made of the original file path and the path of the file containing the generated React component:\n\n- `originalPath`: the original file's path\n- `path`: the React component's file's path\n\nDefault template only uses `path` and it is similar to this:\n\n```js\nconst path = require('path')\n\nfunction defaultIndexTemplate(filePaths) {\n  const exportEntries = filePaths.map(({ path: filePath }) => {\n    const basename = path.basename(filePath, path.extname(filePath))\n    const exportName = /^\\d/.test(basename) ? `Svg${basename}` : basename\n    return `export { default as ${exportName} } from './${basename}'`\n  })\n  return exportEntries.join('\\n')\n}\n\nmodule.exports = defaultIndexTemplate\n```\n\nbut you could implement a more advanced template exploiting the original file name too:\n\n```js\nconst path = require('path')\n\nfunction defaultIndexTemplate(filePaths) {\n  const entries = filePaths.map(({ path: filePath, originalPath }) => {\n    const originalFileName = path.basename(\n      originalPath,\n      path.extname(originalPath),\n    )\n    const basename = path.basename(filePath, path.extname(filePath))\n    const exportName = /^\\d/.test(basename) ? `Svg${basename}` : basename\n    const importLine = `import ${exportName} from './${basename}';`\n    const mapLine = `${\n      /.*[.-].*/.test(originalFileName)\n        ? `'${originalFileName}'`\n        : originalFileName\n    }: ${exportName}`\n    return { importLine, mapLine }\n  })\n  return `${entries.map(({ importLine }) => importLine).join('\\n')}\nexport const map = {\n${entries.map(({ mapLine }) => mapLine).join(',\\n')}\n}\n`\n}\n\nmodule.exports = defaultIndexTemplate\n```\n\n### Use with CLI\n\nYou can use component template in the CLI:\n\n```sh\nnpx @svgr/cli --index-template index-template.js -- my-icon.svg\n```\n"
  },
  {
    "path": "website/pages/docs/custom-transformations.mdx",
    "content": "---\nsection: Advanced\ntitle: Custom transformations\nslug: /docs/custom-transformations/\norder: 10\n---\n\n# Custom transformations\n\nExtend the core of SVGR to creates complex transformations.\n\n<carbon-ad />\n\n## Install\n\n```bash\nnpm install @svgr/plugin-jsx\n# or use yarn\nyarn add @svgr/plugin-jsx\n```\n\n## Usage\n\n**.svgrrc**\n\n```json\n{\n  \"plugins\": [\"@svgr/plugin-jsx\"]\n}\n```\n\n## How does it work?\n\n`@svgr/plugin-jsx` consists in three phases:\n\n- Parsing the SVG code using [svg-parser](https://github.com/Rich-Harris/svg-parser)\n- Converting the [HAST](https://github.com/syntax-tree/hast) into a [Babel AST](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)\n- Applying [`@svgr/babel-preset`](../babel-preset/README.md) transformations\n\n## Applying custom transformations\n\nYou can extend the Babel config applied in this plugin using `jsx.babelConfig` config path:\n\n```js\n// .svgrrc.js\n\nmodule.exports = {\n  jsx: {\n    babelConfig: {\n      plugins: [\n        // For an example, this plugin will remove \"id\" attribute from \"svg\" tag\n        [\n          '@svgr/babel-plugin-remove-jsx-attribute',\n          {\n            elements: ['svg'],\n            attributes: ['id'],\n          },\n        ],\n      ],\n    },\n  },\n}\n```\n\nSeveral Babel plugins are available:\n\n- [`@svgr/babel-plugin-add-jsx-attribute`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-add-jsx-attribute/README.md)\n- [`@svgr/babel-plugin-remove-jsx-attribute`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-remove-jsx-attribute/README.md)\n- [`@svgr/babel-plugin-remove-jsx-empty-expression`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-remove-jsx-empty-expression/README.md)\n- [`@svgr/babel-plugin-replace-jsx-attribute-value`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-replace-jsx-attribute-value/README.md)\n- [`@svgr/babel-plugin-svg-dynamic-title`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-svg-dynamic-title/README.md)\n- [`@svgr/babel-plugin-svg-em-dimensions`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-svg-em-dimensions/README.md)\n- [`@svgr/babel-plugin-transform-react-native-svg`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-react-native-svg/README.md)\n- [`@svgr/babel-plugin-transform-svg-component`](https://github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/README.md)\n\nIf you want to create your own, reading [Babel Handbook](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md) is a good start!\n"
  },
  {
    "path": "website/pages/docs/ecosystem.mdx",
    "content": "---\nsection: About\ntitle: Ecosystem\nslug: /docs/ecosystem/\norder: 30\n---\n\n# Ecosystem\n\nThis is an incomplete list of awesome things built with SVGR.\n\n<carbon-ad />\n\n## Tools that includes official SVGR support ✨\n\n- [Create React App](https://facebook.github.io/create-react-app/)\n- [Parcel](https://parceljs.org/)\n- [React SSR Setup](https://github.com/manuelbieh/react-ssr-setup)\n- [SVG Gobbler Browser Extension](https://github.com/rossmoody/svg-gobbler)\n\n## Conferences\n\n- [SVGR or how a simple problem became a 2K stars library - Greg Bergé (@neoziro) at @ReactEurope 2018](https://www.youtube.com/watch?v=geKCzi7ZPkA)\n\n## Articles\n\n- [How to use SVG Icons as React Components?](https://www.robinwieruch.de/react-svg-icon-components/)\n- [Config Storybook 4 & 5 to use SVGR webpack plugin](https://medium.com/@derek_19900/config-storybook-4-to-use-svgr-webpack-plugin-22cb1152f004)\n- [Flexible SVG components in React](https://medium.com/@timothyde/flexible-svg-components-in-react-788b108c61c3)\n- [Using SVG as Component in React Native 0.57](https://medium.com/@prathik_63905/using-svg-as-component-in-react-native-0-57-76f6238ec80a)\n\n## Plugins\n\n- [gatsby-plugin-svgr](https://www.npmjs.com/package/gatsby-plugin-svgr) - SVGR plugin for [Gatsby](https://gatsbyjs.org)\n- [cogs-transformer-svgr](https://www.npmjs.com/package/cogs-transformer-svgr) - SVGR Transformer for [cogs](https://github.com/caseywebdev/cogs)\n- [chin-plugin-svgr](https://www.npmjs.com/package/chin-plugin-svgr) - SVGR plugin for [chin](https://github.com/chinjs/chin)\n- [@nice-js/svgr-loader](https://www.npmjs.com/package/@nice-js/svgr-loader) - SVGR loader for Nice.js\n- [bs-svgr](https://www.npmjs.com/package/bs-svgr) - SVGR plugin for BuckleScript (Reason)\n- [vite-plugin-svgr](https://github.com/pd4d10/vite-plugin-svgr) - SVGR loader for [Vite](https://vitejs.dev/)\n- [SVGR for Figma](https://www.figma.com/community/plugin/749818562498396194/SVG-to-JSX)\n- [esbuild-plugin-svgr](https://github.com/kazijawad/esbuild-plugin-svgr)\n\n## Macros & Babel Presets\n\n- [svgr.macro](https://www.npmjs.com/package/svgr.macro) - Babel macro for SVGR\n- [babel-preset-svgr](https://github.com/birdofpreyru/babel-preset-svgr)\n\nIf you have something to share, please submit a PR on [GitHub project](https://github.com/gregberge/svgr).\n"
  },
  {
    "path": "website/pages/docs/getting-started.mdx",
    "content": "---\nsection: Usage\ntitle: Getting started\nslug: /docs/getting-started/\norder: 10\n---\n\n# Getting started\n\nSVGR lets you transform SVG's into React components everywhere.\n\n<carbon-ad />\n\nSVGR provides a [powerful playground](https://react-svgr.com/playground/) for occasional usage.\n\nIf you want to automatise SVG transformation in your application, you should follow one of these guides:\n\n- [Next.js](/docs/next/)\n- [Remix](/docs/remix/)\n- [webpack](/docs/webpack/)\n- [Command Line](/docs/cli/)\n- [Node.js](/docs/node-api/)\n"
  },
  {
    "path": "website/pages/docs/index.mdx",
    "content": "---\nslug: /docs/\nredirect: /docs/getting-started/\n---\n"
  },
  {
    "path": "website/pages/docs/jest.mdx",
    "content": "---\nsection: Usage\ntitle: Jest\nslug: /docs/jest/\norder: 70\n---\n\n# Jest\n\nConfigure [Jest](https://jestjs.io/) to work properly with SVGR.\n\n<carbon-ad />\n\n## 1. Create a mock file\n\nCreate a mock file `__mocks__/svg.js`:\n\n```jsx\nexport default 'SvgrURL'\nexport const ReactComponent = 'div'\n```\n\nThe above mock would support the following import syntaxes:\n\n```js\nimport logoURL from '../assets/logo.svg'\n// and\nimport { ReactComponent as Logo } from '../assets/logo.svg'\n```\n\n## 2. Configure Jest\n\nIn your `package.json`\n\n```json\n\"jest\": {\n  \"moduleNameMapper\": {\n    \"\\\\.svg\": \"<rootDir>/__mocks__/svg.js\"\n  }\n}\n```\n\nor in your `jest.config.js`\n\n```js\nmodule.exports = {\n  moduleNameMapper: {\n    '\\\\.svg$': '<rootDir>/__mocks__/svg.js',\n  },\n}\n```\n\nYour snapshots will include all properties on the icon components, so they will be tested.\n"
  },
  {
    "path": "website/pages/docs/migrate.mdx",
    "content": "---\nsection: Usage\ntitle: Migrate to v6\nslug: /docs/migrate/\norder: 15\n---\n\n# Migrate to v6\n\nThis guide will help you migrating from SVGR v5.x to SVGR v6.x.\n\n<carbon-ad />\n\n## webpack\n\n`@svgr/webpack` is now **only compatible with webpack 5**.\n\nIt still works with deprecated `url-loader` and `file-loader` but it is recommended to use [asset modules](https://webpack.js.org/guides/asset-modules/) available in webpack 5.\n\nReport to [SVGR webpack documentation](/docs/webpack/) to learn more about it.\n\n## SVGO\n\nSVGR v6 now uses SVGO v2 and does not merge config any more.\n\nIf you have a custom SVGO configuration (using a dedicated file or using `svgo` key in SVGR config), then please follow [SVGO migration guide](https://github.com/svg/svgo/releases/tag/v2.0.0).\n\nConfiguration are not merged any more, it means you have to remove viewBox by yourself if you use a custom SVGO config with `--icon` or `--no-dimensions` option.\n\n```json\n{\n  \"name\": \"preset-default\",\n  \"params\": {\n    \"overrides\": {\n      \"removeViewBox\": false\n    }\n  }\n}\n```\n\n## Command line options\n\nIt is now recommended to add `--` to separate files from arguments. Since `--icon` can now accept an optional size, it could break your command if you have `--icon` as the last argument.\n\n**v5.x**\n\n```sh\nsvgr --icon assets/svg\n```\n\n**v6.x**\n\n```sh\nsvgr --icon -- assets/svg\n```\n\n## Template\n\nTemplate signature has changed, it is now much more simpler to create custom templates. Also you don't have to do anything specific to use TypeScript in your template. If you need some Babel specific things you have to import it by yourself from the relevant Babel package.\n\n**v5.x**\n\n```js\nconst template = (\n  { template },\n  opts,\n  { imports, interfaces, componentName, props, jsx, exports },\n) => {\n  const plugins = ['jsx']\n  if (opts.typescript) {\n    plugins.push('typescript')\n  }\n  const typeScriptTpl = template.smart({ plugins })\n  return typeScriptTpl.ast`${imports}\n\n${interfaces}\n\nfunction ${componentName}(${props}) {\n  return ${jsx};\n}\n${exports}\n  `\n}\n\nmodule.exports = template\n```\n\n**v6.x**\n\n```js\nconst template = (variables, { tpl }) => {\n  return tpl`\n${variables.imports};\n\n${variables.interfaces};\n\nconst ${variables.componentName} = (${variables.props}) => (\n  ${variables.jsx}\n);\n \n${variables.exports};\n`\n}\n\nmodule.exports = template\n```\n\n## Programmatic usage\n\n`@svgr/core` now exposes `transform` as a named export instead of using the `default` export.\n\n**v5.x**\n\n```js\nimport transform from '@svgr/core'\n```\n\n**v6.x**\n\n```js\nimport { transform } from '@svgr/core'\n```\n\n## ES Modules\n\nSVGR v6 will be the last version to support CommonJS. If you are still using CommonJS you should [Get Ready For ESM](https://medium.com/sindre-sorhus/get-ready-for-esm-aa53530b3f77) as soon as possible.\n"
  },
  {
    "path": "website/pages/docs/mocha.mdx",
    "content": "---\nsection: Usage\ntitle: Mocha\nslug: /docs/mocha/\norder: 80\n---\n\n# Mocha\n\nConfigure [Mocha](https://mochajs.org/) to work properly with SVGR.\n\n<carbon-ad />\n\n## Steps\n\nThis steps describe how to configure mocha to handle SVG generated from SVGR. It only covers EcmaScript modules because it is the only type of output supported by SVGR.\n\n### 1. Create a mock\n\nCreate a mock file `__mocks__/svg.js`:\n\n```jsx\nexport default 'SvgrURL'\nexport const ReactComponent = 'div'\n```\n\nThe above mock would support the following import syntaxes:\n\n```js\nimport logoURL from '../assets/logo.svg'\n// and\nimport { ReactComponent as Logo } from '../assets/logo.svg'\n```\n\n### 2. Create a custom loader\n\n```js\n// mock-loader.js\nimport { cwd } from 'node:process'\nimport { pathToFileURL } from 'node:url'\n\nconst baseURL = pathToFileURL(`${cwd()}/`).href\nconst SVG_REGEX = /^[./a-zA-Z0-9$_-]+\\.svg$/\n\nexport async function resolve(specifier, context, defaultResolve) {\n  if (SVG_REGEX.test(specifier)) {\n    return { url: new URL('./__mocks__/svg.js', baseURL).href }\n  }\n  return defaultResolve(specifier, context, defaultResolve)\n}\n```\n\n### 3. Run mocha with the loader\n\n```\nmocha --loader=./mock-loader.js\n```\n\n## Example\n\nA [full working example](https://github.com/gregberge/svgr/tree/main/examples/mocha-esm) is available in SVGR repository.\n"
  },
  {
    "path": "website/pages/docs/next.mdx",
    "content": "---\nsection: Usage\ntitle: Next.js\nslug: /docs/next/\norder: 45\n---\n\n# Next.js\n\nConfigure your [Next.js](https://nextjs.org/) project to import SVG as React components in your application.\n\n<carbon-ad />\n\n## Install\n\n```bash\nnpm install --save-dev @svgr/webpack\n# or use yarn\nyarn add --dev @svgr/webpack\n```\n\n## Usage\n\nUsing SVGR in Next.js is possible with `@svgr/webpack`.\n\n**next.config.js**\n\n```js\nimport type { NextConfig } from \"next\";\n\nconst nextConfig: NextConfig = {\n  webpack(config) {\n    config.module.rules.push({\n      test: /\\.svg$/,\n      use: [\n        {\n          loader: \"@svgr/webpack\",\n          options: {\n            icon: true,\n          },\n        },\n      ],\n    });\n    return config;\n  },\n  turbopack: {\n    rules: {\n      \"*.svg\": {\n        loaders: [\"@svgr/webpack\"],\n        as: \"*.js\",\n      },\n    },\n  }\n  /* other config options here */\n};\n\nexport default nextConfig;\n\n```\n\n**Your code**\n\n```js\nimport Star from './star.svg'\n\nconst Example = () => (\n  <div>\n    <Star />\n  </div>\n)\n```\n\nOr, using the classic (URL) import:\n\n```js\nimport Image from 'next/image'\nimport starUrl from './star.svg?url'\n\nconst Example = () => (\n  <div>\n    <Image src={starUrl} />\n  </div>\n)\n```\n\nPlease refer to [SVGR webpack guide](/docs/webpack/) for advanced use cases.\n\n## TypeScript\n\nUsing SVGR with TypeScript support.\n\n**Type decleration**\n\nAdd a custom type decleration file (e.g. **svgr.d.ts**) to the root of your repo.\n\n```ts\ndeclare module '*.svg' {\n  import { FC, SVGProps } from 'react'\n  const content: FC<SVGProps<SVGElement>>\n  export default content\n}\n\ndeclare module '*.svg?url' {\n  const content: any\n  export default content\n}\n```\n\n**tsconfig.json**\n\nAdd the type decleration file to your tsconfig.json's `include` array. **Ensure it's the first item.**\n\n```json\n{\n  \"include\": [\n    \"svgr.d.ts\",\n    \"next-env.d.ts\",\n    \"**/*.ts\",\n    \"**/*.tsx\",\n    \".next/types/**/*.ts\"\n  ]\n  // ...other config\n}\n```\n"
  },
  {
    "path": "website/pages/docs/node-api.mdx",
    "content": "---\nsection: Usage\ntitle: Node.js\nslug: /docs/node-api/\norder: 30\n---\n\n# Node.js\n\nUse SVGR in Node.js to complex transformations or tools.\n\n<carbon-ad />\n\n## Install\n\n```bash\nnpm install --save-dev @svgr/core\n# or use yarn\nyarn add --dev @svgr/core\n```\n\n## Usage\n\nImport `transform` from `@svgr/core` to transform a file. It takes three arguments:\n\n- `source`: the SVG source code to transform\n- `options`: the options used to transform the SVG\n- `state`: a state linked to the transformation\n\n```js\nimport { transform } from '@svgr/core'\n\nconst svgCode = `\n<svg xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <rect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n    style=\"stroke:#ff0000; fill: #0000ff\"/>\n</svg>\n`\n\nconst jsCode = await transform(\n  svgCode,\n  { icon: true },\n  { componentName: 'MyComponent' },\n)\n```\n\n### Options\n\n[SVGR options reference](https://react-svgr.com/docs/options/) describes all options available.\n\n### State\n\n`state` argument have two main properties:\n\n- `componentName` (required): the name of the component that will be used in the generated component\n- `filePath` (required): the name of the file that is generated, mainly used to find runtime config file to apply\n\n## Use SVGO and Prettier\n\nBy default `@svgr/core` doesn't include `svgo` and `prettier` plugins. If you need these, you have to install it and to specify it in options.\n\n```bash\nnpm install @svgr/plugin-jsx @svgr/plugin-prettier\n```\n\n```js\nimport { transform } from '@svgr/core'\n\nconst svgCode = `\n<svg xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <rect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n    style=\"stroke:#ff0000; fill: #0000ff\"/>\n</svg>\n`\n\nconst jsCode = await transform(\n  svgCode,\n  {\n    plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],\n    icon: true,\n  },\n  { componentName: 'MyComponent' },\n)\n```\n\n## Synchronous usage\n\nSVGR provides two API, an asynchronous one and a synchronous one. It is recommended to use the asynchronous one as possible, but sometimes you may have to use the synchronous one. SVGR exposes `transform.sync` for synchronous usage.\n\n```js\nimport { transform } from '@svgr/core'\n\nconst svgCode = `\n<svg xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <rect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n    style=\"stroke:#ff0000; fill: #0000ff\"/>\n</svg>\n`\n\nconst jsCode = transform.sync(\n  svgCode,\n  { icon: true },\n  { componentName: 'MyComponent' },\n)\n```\n\n## Note for tools creator\n\nIf you want to create a tool based on SVGR, you must follow some rules:\n\n### Specify `state.caller`\n\nIf you create a tool based on SVGR, it is always better to specify `state.caller`. It permits the inter-operability betweens plugins. If someone create a SVGR plugin it could adapt it specifically to your tool.\n\n```js\ninterface State {\n  filePath?: string\n  componentName: string\n  caller?: {\n    name?: string\n    previousExport?: string | null\n    defaultPlugins?: ConfigPlugin[]\n  }\n}\n```\n\nAditionnaly you can specify `defaultPlugins` if your tool needs plugins by default and you still want users to be able to customize it.\n\n### Use asynchronous API\n\nAsynchronous API uses Node.js asychronous API under the hood, it is more performant. So it is always better to use that API if possible.\n\n### Do not overrides SVGR options\n\nSVGR has lot of options, every options are describe in this documentation. It is always easier for users to refer to this documentation.\n\n- Always prefer asynchronous API if possible\n- Do not override SVGR options, it is easier for users to refer to this documentation\n- Specify `state.caller` argument:\n"
  },
  {
    "path": "website/pages/docs/options.mdx",
    "content": "---\nsection: Configuring SVGR\ntitle: Options\nslug: /docs/options/\norder: 10\n---\n\n# Options\n\nSVGR ships with a handful of customizable options, usable in both the CLI and\nAPI.\n\n<carbon-ad />\n\n## Config file\n\nSpecify a custom config file.\n\n| Default | CLI Override    | API Override         |\n| ------- | --------------- | -------------------- |\n| `null`  | `--config-file` | `configFile: string` |\n\n## Runtime config\n\nDisable runtime config (`.svgrrc`, `.svgo.yml`, `.prettierrc`).\n\n| Default | CLI Override          | API Override             |\n| ------- | --------------------- | ------------------------ |\n| `true`  | `--no-runtime-config` | `runtimeConfig: boolean` |\n\n## JSX runtime\n\nSpecify a JSX runtime to use.\n\n- \"classic\": adds `import * as React from 'react'` on the top of file\n- \"automatic\": do not add anything\n- \"classic-preact\": adds `import { h } from 'preact'` on the top of file\n\n| Default   | CLI Override    | API Override                                               |\n| --------- | --------------- | ---------------------------------------------------------- |\n| `classic` | `--jsx-runtime` | `jsxRuntime: 'classic' \\| 'automatic' \\| 'classic-preact'` |\n\n## JSX runtime import source\n\nSpecify a custom JSX runtime source to use. Allows to customize the import added at the top of generated file.\n\nExample: `jsxRuntimeImport: { source: 'preact', specifiers: ['h'] }` for \"classic-preact\" equivalent.\n\nTo use the default import instead of a list of names, you can use `defaultSpecifier`, for example to use svgr with `hyperapp-jsx-pragma`, you can specify `jsxRuntimeImport: { source: 'hyperapp-jsx-pragma', defaultSpecifier: 'h' }` to get an end result of `import h from \"hyperapp-jsx-pragma\";`\n\n| Default | CLI Override | API Override                                                                           |\n| ------- | ------------ | -------------------------------------------------------------------------------------- |\n| `null`  | -            | `jsxRuntimeImport: { source: string, specifiers: string[], defaultSpecifier: string }` |\n\n## Icon\n\nReplace SVG `width` and `height` by a custom value. If value is omitted, it uses `1em` in order to make SVG size inherits from text size.\n\n| Default | CLI Override     | API Override                        |\n| ------- | ---------------- | ----------------------------------- |\n| `false` | `--icon [value]` | `icon: boolean \\| string \\| number` |\n\n> If you use `--icon` without any argument, be careful of separating files from arguments using `--`, ex: `svgr --icon -- assets/svg`\n\n## Native\n\nModify all SVG nodes with uppercase and use a specific template with\n[`react-native-svg`](https://github.com/react-native-community/react-native-svg) imports. **All unsupported nodes will be removed.**\n\n| Default | CLI Override | API Override      |\n| ------- | ------------ | ----------------- |\n| `false` | `--native`   | `native: boolean` |\n\n## TypeScript\n\nGenerates `.tsx` files with [TypeScript](https://www.typescriptlang.org/) typings.\n\n| Default | CLI Override   | API Override          |\n| ------- | -------------- | --------------------- |\n| `false` | `--typescript` | `typescript: boolean` |\n\n## Dimensions\n\nKeep `width` and `height` attributes from the root SVG tag.\n\nRemoval is guaranteed if `dimensions: false`, unlike the `removeDimensions: true` SVGO plugin option which also generates a `viewBox` from the dimensions if no `viewBox` is present.\n\n**NOTE:**\n\n- Any SVGO processing will occur prior to this removal.\n- When removing dimensions, SVGO will be configured not to remove the `viewBox` if one is present. You can override this behaviour via your own config.\n\n| Default | CLI Override      | API Override          |\n| ------- | ----------------- | --------------------- |\n| `true`  | `--no-dimensions` | `dimensions: boolean` |\n\n## Expand props\n\nAll properties given to component will be forwarded on SVG tag. Possible values: `\"start\"`, `\"end\"` or `false` (`\"none\"` in CLI).\n\n| Default | CLI Override     | API Override          |\n| ------- | ---------------- | --------------------- |\n| `end`   | `--expand-props` | `expandProps: string` |\n\n## Prettier\n\nUse [Prettier](https://github.com/prettier/prettier) to format JavaScript code\noutput.\n\n| Default | CLI Override    | API Override        |\n| ------- | --------------- | ------------------- |\n| `true`  | `--no-prettier` | `prettier: boolean` |\n\n## Prettier config\n\nSpecify Prettier config. [See Prettier options](https://prettier.io/docs/en/options.html).\n\n| Default | CLI Override        | API Override                     |\n| ------- | ------------------- | -------------------------------- |\n| `null`  | `--prettier-config` | `prettierConfig: PrettierConfig` |\n\n## SVGO\n\nUse [SVGO](https://github.com/svg/svgo/) to optimize SVG code before transforming it into a component.\n\n**NOTE:** SVGR implicitly enables the [`prefixIds` SVGO plugin](https://github.com/svg/svgo/blob/master/plugins/prefixIds.js) which adds a prefix to values of `id` and `class` attributes to [reduce the chance of collision issues](https://github.com/gregberge/svgr/issues/210).\n\n| Default | CLI Override | API Override    |\n| ------- | ------------ | --------------- |\n| `true`  | `--no-svgo`  | `svgo: boolean` |\n\n## SVGO config\n\nSpecify SVGO config. [See SVGO options](https://github.com/svg/svgo#configuration).\n\n| Default | CLI Override    | API Override             |\n| ------- | --------------- | ------------------------ |\n| `null`  | `--svgo-config` | `svgoConfig: SVGOConfig` |\n\n## Ref\n\nSetting this to `true` will forward ref to the root SVG tag.\n\n| Default | CLI Override | API Override   |\n| ------- | ------------ | -------------- |\n| `false` | `--ref`      | `ref: boolean` |\n\n## Memo\n\nSetting this to `true` will wrap the exported component in [`React.memo`](https://react.dev/reference/react/memo).\n\n| Default | CLI Override | API Override    |\n| ------- | ------------ | --------------- |\n| `false` | `--memo`     | `memo: boolean` |\n\n## Replace attribute value\n\nReplace an attribute value by an other. The main usage of this option is to change an icon color to \"currentColor\" in order to inherit from text color.\n\n| Default | CLI Override                      | API Override                                   |\n| ------- | --------------------------------- | ---------------------------------------------- |\n| `[]`    | `--replace-attr-values <old=new>` | `replaceAttrValues: { [key: string]: string }` |\n\n> You can specify dynamic property using curly braces: `{ '#000': \"{props.color}\" }` or `--replace-attr-values #000={props.color}`. It is particularly useful with a custom template.\n\n## SVG props\n\nAdd props to the root SVG tag.\n\n| Default | CLI Override               | API Override                          |\n| ------- | -------------------------- | ------------------------------------- |\n| `[]`    | `--svg-props <name=value>` | `svgProps: { [key: string]: string }` |\n\n> You can specify dynamic property using curly braces: `{ focusable: \"{true}\" }` or `--svg-props focusable={true}`. It is particularly useful with a custom template.\n\n### Accessibility\n\nSVGs by default have an implicit `role=\"graphics-document\"`. To make SVG content accessible you may want to override the default behavior which can be done via the `svgProps` override.\n\n#### For web:\n\n| Default | CLI Override           | API Override                |\n| ------- | ---------------------- | --------------------------- |\n| `[]`    | `--svg-props role=img` | `svgProps: { role: 'img' }` |\n\n#### For native:\n\n| Default | CLI Override                          | API Override                               |\n| ------- | ------------------------------------- | ------------------------------------------ |\n| `[]`    | `--svg-props accessibilityRole=image` | `svgProps: { accessibilityRole: 'image' }` |\n\nTypically for role=img you will want to add either `alt` text or `aria` label/description properties to describe the image when rendering the SVG in your application.\n\n> **NOTE**: On the web once you add `role: 'img'` some screen-readers will automatically announce any `title`/`text`/`desc` nodes within your SVG.\n>\n> SVGO can be configured to remove those nodes via the built-in `removeDesc` and `removeTitle` plugins if you only want to use `aria` properties during consumption of the SVGs.\n\n## Title\n\nAdd title tag via title property. If titleProp is set to true and no title is provided (`title={undefined}`) at render time, this will fallback to an existing title element in the svg if exists.\n\n| Default | CLI Override   | API Override         |\n| ------- | -------------- | -------------------- |\n| `false` | `--title-prop` | `titleProp: boolean` |\n\n## Description\n\nAdd desc tag via desc property. If descProp is set to true and no description is provided (`desc={undefined}`) at render time, this will fallback to an existing desc element in the svg if exists.\n\n| Default | CLI Override  | API Override        |\n| ------- | ------------- | ------------------- |\n| `false` | `--desc-prop` | `descProp: boolean` |\n\n## Template\n\nSpecify a template file (CLI) or a template function (API) to use. For an example of template, see [the default one](https://github.com/gregberge/svgr/blob/main/packages/babel-plugin-transform-svg-component/src/defaultTemplate.ts).\n\n| Default                                                                                                                              | CLI Override | API Override       |\n| ------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ------------------ |\n| [`basic template`](https://github.com/gregberge/svgr/blob/main/packages/babel-plugin-transform-svg-component/src/defaultTemplate.ts) | `--template` | `template: <func>` |\n\n## Output Directory\n\nOutput files into a directory.\n\n| Default     | CLI Override          | API Override     |\n| ----------- | --------------------- | ---------------- |\n| `undefined` | `--out-dir <dirname>` | `outDir: string` |\n\n## index.js template\n\nSpecify a template function (API) to change default index.js output (when --out-dir is used).\n\n| Default                                                                                        | CLI Override       | API Override  |\n| ---------------------------------------------------------------------------------------------- | ------------------ | ------------- |\n| [`basic template`](https://github.com/gregberge/svgr/blob/main/packages/cli/src/dirCommand.ts) | `--index-template` | `indexTemplate: <func>` |\n\n## index.js file\n\nDisable index.js file generation\n\n| Default | CLI Override | API Override     |\n| ------- | ------------ | ---------------- |\n| `false` | `--no-index` | `index: boolean` |\n\n## Ignore existing\n\nWhen used with `--out-dir`, it ignores already existing files.\n\n| Default | CLI Override        | API Override  |\n| ------- | ------------------- | ------------- |\n| `false` | `--ignore-existing` | not available |\n\n## Filename case\n\nSpecify a custom filename case. Possible values: `pascal` for PascalCase, `kebab` for kebab-case, `camel` for camelCase, or `snake` for snake_case.\n\n| Default  | CLI Override      | API Override           |\n| -------- | ----------------- | ---------------------- |\n| `pascal` | `--filename-case` | `filenameCase: string` |\n\n## File extension\n\nSpecify a custom extension for generated files.\n\n| Default | CLI Override | API Override  |\n| ------- | ------------ | ------------- |\n| `\"js\"`  | `--ext`      | `ext: string` |\n"
  },
  {
    "path": "website/pages/docs/parcel.mdx",
    "content": "---\nsection: Usage\ntitle: Parcel\nslug: /docs/parcel/\norder: 60\n---\n\n# Parcel\n\n[Parcel](https://parceljs.org/) provides an official plugin to import SVG as React components.\n\n<carbon-ad />\n\nSVGR is natively supported by [Parcel v2+](https://parceljs.org/). Please report to [\"Importing SVG as a React component\" guide](https://parceljs.org/languages/svg/#importing-as-a-react-component) on official parcel documentation.\n\n> If you still use Parcel v1, [`@svgr/parcel-plugin-svgr`](https://www.npmjs.com/package/@svgr/parcel-plugin-svgr) is deprecated and only compatible with Parcel v1.\n"
  },
  {
    "path": "website/pages/docs/remix.mdx",
    "content": "---\nsection: Usage\ntitle: Remix\nslug: /docs/remix/\norder: 45\n---\n\n# Remix\n\nConfigure your [Remix](https://remix.run/) project to import SVG as React components in your application.\n\n<carbon-ad />\n\n## Install\n\n```bash\nnpm install --save-dev @svgr/cli @svgr/plugin-svgo @svgr/plugin-jsx @svgr/plugin-prettier npm-watch npm-run-all\n```\n\n## Usage\n\nUsing SVGR into Remix is possible by configuring `package.json` scripts.\n\n**package.json**\n\n```js\n{\n  //...\n  \"scripts\": {\n    //...\n\n    // task to convert icons to components\n    // you may change the input and output directories\n    \"icons\": \"npx @svgr/cli --out-dir app/components/icons -- app/icons\",\n\n    // watch task\n    \"icons:watch\": \"npm-watch icons\",\n\n    // compile once and start watching for changes\n    \"dev:svg\": \"run-s icons icons:watch\",\n\n    // remix dev\n    \"dev:remix\": \"remix dev\",\n\n    // run all dev: scripts including `dev:svg`\n    \"dev\": \"run-p dev:*\"\n  },\n  // npm-watch configuration\n  \"watch\": {\n    \"icons\": {\n      \"patterns\": [\n        \"icons\"\n      ],\n      \"extensions\": \"svg\",\n      \"quiet\": false\n    }\n  },\n  //...\n}\n```\n\n**svgr.config.js**\n\n```js\nmodule.exports = {\n  plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],\n  typescript: true,\n}\n```\n\n**svgo.config.js**\n\n```js\nmodule.exports = {\n  plugins: [\n    {\n      name: 'preset-default',\n      params: {\n        overrides: {\n          removeViewBox: false,\n        },\n      },\n    },\n  ],\n}\n```\n\n**Your code**\n\n```js\nimport Star from '~/icons/star.svg'\n\nconst Example = () => (\n  <div>\n    <Star />\n  </div>\n)\n```\n"
  },
  {
    "path": "website/pages/docs/rollup.mdx",
    "content": "---\nsection: Usage\ntitle: Rollup.js\nslug: /docs/rollup/\norder: 50\n---\n\n# Rollup.js\n\nSVGR provides an official [rollup.js](https://rollupjs.org) plugin to import SVG as React components.\n\n<carbon-ad />\n\n## Install\n\n```bash\nnpm install --save-dev @svgr/rollup\n# or use yarn\nyarn add --dev @svgr/rollup\n```\n\n## Usage\n\n**rollup.config.js**\n\n```js\nimport svgr from '@svgr/rollup'\n\nexport default {\n  plugins: [svgr()],\n  input: 'src/main.js',\n  output: {\n    file: 'bundle.js',\n    format: 'cjs',\n  },\n}\n```\n\n**Your code**\n\n```js\nimport Star from './star.svg'\n\nconst App = () => (\n  <div>\n    <Star />\n  </div>\n)\n```\n\n## Options\n\nSVGR let you specify options in a runtime config file like `svgr.config.js` or directly in the rollup.js plugin:\n\n**rollup.config.js**\n\n```js\nimport svgr from '@svgr/rollup'\n\nexport default {\n  plugins: [svgr({ icon: true })],\n  input: 'src/main.js',\n  output: {\n    file: 'bundle.js',\n    format: 'cjs',\n  },\n}\n```\n\n[SVGR options reference](https://react-svgr.com/docs/options/) describes all options available.\n\n## Using with `@rollup/plugin-url`\n\nIt is possible to use it with [`@rollup/plugin-url`](https://github.com/rollup/plugins/tree/master/packages/url).\n\n**rollup.config.js**\n\n```js\nimport url from '@rollup/plugin-url'\nimport svgr from '@svgr/rollup'\n\nexport default {\n  plugins: [url(), svgr({ icon: true })],\n  input: 'src/main.js',\n  output: {\n    file: 'bundle.js',\n    format: 'cjs',\n  },\n}\n```\n\n**Your code**\n\n```js\nimport starUrl, { ReactComponent as Star } from './star.svg'\n\nconst App = () => (\n  <div>\n    <img src={starUrl} alt=\"star\" />\n    <Star />\n  </div>\n)\n```\n\nThe named export defaults to `ReactComponent`, but can be customized with the `namedExport` option.\n\nPlease note that by default, `@svgr/rollup` will try to export the React Component via default export if there is no other plugin handling svg files with default export. When there is already any other plugin using default export for svg files, `@svgr/rollup` will always export the React component via named export.\n\nIf you prefer named export in any case, you may set the `exportType` option to `named`.\n\n### Use your own Babel configuration\n\nBy default, `@svgr/rollup` applies a babel transformation with [optimized configuration](https://github.com/gregberge/svgr/blob/main/packages/rollup/src/index.ts). In some case you may want to apply a custom one (if you are using Preact for an example). You can turn off Babel transformation by specifying `babel: false` in options.\n\n```js\n{\n  plugins: [svgr({ babel: false })]\n}\n```\n"
  },
  {
    "path": "website/pages/docs/supporting-svgr.mdx",
    "content": "---\nsection: About\ntitle: Supporting SVGR\nslug: /docs/supporting-svgr/\norder: 20\n---\n\n# Supporting SVGR\n\nHelps SVGR to keep up with React ecosystem.\n\nI ([Greg Bergé](https://gregberge.com/)) am the creator of SVGR and the only maintainer. As of today SVGR is used in almost all React projects. It is downloaded 4.5M times per week, it's huge! To help you realize what it represents, [Next.js](https://nextjs.org/) is downloaded 2M times per week.\n\nMaintaining a project like SVGR takes time, answering to users, fixing bugs, follow the React features, releasing updates. If you are a developer, you know that even the smallest task takes time.\n\nSVGR is not sponsored by any of the big project using it and not sponsored by any of big company using it. I am not asking for having a good salary like some maintainers do, no. But I would really appreciate a small encouragement ☺️.\n\nThe easiest way for that is [sponsoring me on GitHub](https://github.com/sponsors/gregberge) or [donating on OpenCollective](https://opencollective.com/svgr).\n\nThank you! ❤️\n"
  },
  {
    "path": "website/pages/docs/webpack.mdx",
    "content": "---\nsection: Usage\ntitle: Webpack\nslug: /docs/webpack/\norder: 20\n---\n\n# Webpack\n\nSVGR provides an official [webpack.js](https://webpack.js.org/) loader to import SVG as React components.\n\n<carbon-ad />\n\n## Install\n\n```bash\nnpm install --save-dev @svgr/webpack\n# or use yarn\nyarn add --dev @svgr/webpack\n```\n\n## Usage\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.svg$/i,\n        issuer: /\\.[jt]sx?$/,\n        use: ['@svgr/webpack'],\n      },\n    ],\n  },\n}\n```\n\n**Your code**\n\n```js\nimport Star from './star.svg'\n\nconst Example = () => (\n  <div>\n    <Star />\n  </div>\n)\n```\n\n## Options\n\nSVGR let you specify options in a runtime config file like `svgr.config.js` or directly in the loader:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.svg$/i,\n        issuer: /\\.[jt]sx?$/,\n        use: [{ loader: '@svgr/webpack', options: { icon: true } }],\n      },\n    ],\n  },\n}\n```\n\n[SVGR options reference](https://react-svgr.com/docs/options/) describes all options available.\n\n## Use SVGR and asset SVG in the same project\n\nYou may be interested to use some SVG as an asset (url) and other SVG as a React component. The easiest way to do it is to use a `resourceQuery` for one of the two type.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.svg$/i,\n        type: 'asset',\n        resourceQuery: /url/, // *.svg?url\n      },\n      {\n        test: /\\.svg$/i,\n        issuer: /\\.[jt]sx?$/,\n        resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url\n        use: ['@svgr/webpack'],\n      },\n    ],\n  },\n}\n```\n\n**Your code**\n\n```js\nimport svg from './assets/file.svg?url'\nimport Svg from './assets/file.svg'\n\nconst App = () => {\n  return (\n    <div>\n      <img src={svg} width=\"200\" height=\"200\" />\n      <Svg width=\"200\" height=\"200\" viewBox=\"0 0 3500 3500\" />\n    </div>\n  )\n}\n```\n\n## Use SVG in CSS files\n\nThe `issuer: /\\.[jt]sx?$/` option ensures that SVGR will only apply if the SVG is imported from a JavaScript or a TypeScript file. It allows you to safely import SVG into your `.css` or `.scss` without any issue.\n\n```css\n.example {\n  background-image: url(./assets/file.svg);\n}\n```\n\n## Use with `url-loader` or `file-loader`\n\n> `url-loader` and `file-loader` are deprecated over [Asset Modules](https://webpack.js.org/guides/asset-modules/) in webpack v5. It is widely encouraged to use `resourceQuery` method described before.\n\nSVGR can be used with [`url-loader`](https://github.com/webpack-contrib/url-loader) or [`file-loader`](https://github.com/webpack-contrib/file-loader).\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.svg$/i,\n        issuer: /\\.[jt]sx?$/,\n        use: ['@svgr/webpack', 'url-loader'],\n      },\n    ],\n  },\n}\n```\n\n**Your code**\n\n```js\nimport starUrl, { ReactComponent as Star } from './star.svg'\n\nconst App = () => (\n  <div>\n    <img src={starUrl} alt=\"star\" />\n    <Star />\n  </div>\n)\n```\n\nThe named export defaults to `ReactComponent` and can be customized with the `namedExport` option.\n\nPlease note that by default, `@svgr/webpack` will try to export the React Component via default export if there is no other loader handling svg files with default export. When there is already any other loader using default export for svg files, `@svgr/webpack` will always export the React component via named export.\n\nIf you prefer named export in any case, you may set the `exportType` option to `named`.\n\n## Use your own Babel configuration\n\nBy default, `@svgr/webpack` includes a `babel-loader` with [an optimized configuration](https://github.com/gregberge/svgr/blob/main/packages/webpack/src/index.ts). In some case you may want to apply a custom one (if you are using Preact for an example). You can turn off Babel transformation by specifying `babel: false` in options.\n\n```js\n// Example using preact\n{\n  test: /\\.svg$/,\n  use: [\n    {\n      loader: 'babel-loader',\n      options: {\n        presets: ['preact', 'env'],\n      },\n    },\n    {\n      loader: '@svgr/webpack',\n      options: { babel: false },\n    }\n  ],\n}\n```\n"
  },
  {
    "path": "website/pages/docs/what-is-svgr.mdx",
    "content": "---\nsection: About\ntitle: What is SVGR?\nslug: /docs/what-is-svgr/\norder: 10\n---\n\n# What is SVGR?\n\nSVGR is an universal tool to transform SVG into React components.\n\nSVGR takes a raw SVG and transforms it into a ready-to-use React component.\n\nFor example, take the following SVG:\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg\n  width=\"48px\"\n  height=\"1px\"\n  viewBox=\"0 0 48 1\"\n  version=\"1.1\"\n  xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n  <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n  <title>Rectangle 5</title>\n  <desc>Created with Sketch.</desc>\n  <defs></defs>\n  <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n    <g\n      id=\"19-Separator\"\n      transform=\"translate(-129.000000, -156.000000)\"\n      fill=\"#063855\"\n    >\n      <g id=\"Controls/Settings\" transform=\"translate(80.000000, 0.000000)\">\n        <g id=\"Content\" transform=\"translate(0.000000, 64.000000)\">\n          <g id=\"Group\" transform=\"translate(24.000000, 56.000000)\">\n            <g id=\"Group-2\">\n              <rect id=\"Rectangle-5\" x=\"25\" y=\"36\" width=\"48\" height=\"1\"></rect>\n            </g>\n          </g>\n        </g>\n      </g>\n    </g>\n  </g>\n</svg>\n```\n\nAfter running SVGR, we got:\n\n```js\nimport * as React from 'react'\n\nconst SvgComponent = (props) => (\n  <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 48 1\" {...props}>\n    <path d=\"M0 0h48v1H0z\" fill=\"currentColor\" fillRule=\"evenodd\" />\n  </svg>\n)\n\nexport default SvgComponent\n```\n\nTo achieve this result, SVGR applies several complex transformations:\n\n- Optimizing using [SVGO](https://github.com/svg/svgo)\n- Transforming HTML into JSX in several steps:\n  - Converting SVG into HAST (HTML AST)\n  - Converting HAST into Babel AST (JSX AST)\n  - Transforming AST using Babel (renaming attribute, changing attribute values, ...)\n- Wrapping JSX into a React Component\n- Converting Babel AST into code\n- Formatting code using [Prettier](https://prettier.io/)\n\nThis complex pipeline makes SVGR a reliable, safe and extendable tool.\n\nIt can be used through:\n\n- [Online playground](/playground/)\n- [Command line tool](/docs/cli/)\n- [webpack loader](/docs/webpack/)\n- [Node.js API](/docs/node-api/)\n- [rollup.js plugin](/docs/rollup/)\n- [parcel plugin](/docs/parcel/)\n- [Next.js plugin](/docs/next/)\n\nIt is just the list of official integrations, but the community around SVGR is huge. If you are looking for a plugin, it probably already exists. Give a look to [ecosystem](/docs/ecosystem/) to learn more about existing SVGR integrations.\n\nIf you want to learn more, this conference talk is a great introduction:\n\n<iframe\n  width=\"560\"\n  height=\"315\"\n  src=\"https://www.youtube.com/embed/geKCzi7ZPkA\"\n  title=\"YouTube video player\"\n  frameborder=\"0\"\n  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n  allowfullscreen\n/>\n"
  },
  {
    "path": "website/pages/index.mdx",
    "content": "---\ntitle: SVGR - Transforms SVG into React Components.\n---\n\nimport { Home } from '../src/components/Home'\n\n<Home />\n"
  },
  {
    "path": "website/pages/playground.mdx",
    "content": "---\ntitle: SVGR Playground\n---\n\nimport { Playground } from '../src/components/playground/Playground'\n\n<Playground />\n"
  },
  {
    "path": "website/src/components/Home.js",
    "content": "import * as React from 'react'\nimport { Link } from 'gatsby'\nimport {\n  Button,\n  Hero,\n  HeroBody,\n  HeroSection,\n  HeroTitle,\n  HeroTeaser,\n  ScreenContainer,\n  HeroActionList,\n  HeroAction,\n  FeatureSection,\n  FeatureList,\n  Feature,\n  FeatureTitle,\n  FeatureText,\n} from 'smooth-doc/components'\nimport heroBackgroundURL from './images/hero-bg.png'\n\nexport const Home = () => (\n  <>\n    <HeroSection>\n      <ScreenContainer>\n        <Hero backgroundImageURL={heroBackgroundURL}>\n          <HeroBody>\n            <HeroTitle>Transform SVGs into React components</HeroTitle>\n            <HeroTeaser>\n              A complete tool box to take advantage of using SVGs in your React\n              applications.\n            </HeroTeaser>\n            <HeroActionList>\n              <HeroAction>\n                <Button as={Link} to=\"/docs/getting-started\">\n                  Getting Started\n                </Button>\n              </HeroAction>\n              <HeroAction>\n                <Button\n                  variant=\"neutral\"\n                  as=\"a\"\n                  href=\"https://github.com/gregberge/svgr\"\n                >\n                  Browse GitHub\n                </Button>\n              </HeroAction>\n            </HeroActionList>\n          </HeroBody>\n        </Hero>\n      </ScreenContainer>\n    </HeroSection>\n    <FeatureSection>\n      <FeatureList>\n        <Feature>\n          <FeatureTitle>Powerful</FeatureTitle>\n          <FeatureText>\n            SVGR handles all type of SVG and transforms it into a React\n            component.\n          </FeatureText>\n        </Feature>\n        <Feature>\n          <FeatureTitle>Universal</FeatureTitle>\n          <FeatureText>\n            SVGR is everywhere. Available online, in CLI, Node.js, as a webpack\n            plugin... The list is long.\n          </FeatureText>\n        </Feature>\n        <Feature>\n          <FeatureTitle>Customizable</FeatureTitle>\n          <FeatureText>\n            SVGR is entirely configurable. Use built-in settings or create your\n            own plugin for advanced use-cases.\n          </FeatureText>\n        </Feature>\n        <Feature>\n          <FeatureTitle>Used by everyone</FeatureTitle>\n          <FeatureText>\n            SVGR is literally everywhere. WordPress, Next.js, Create React App.\n            You probably already use SVGR in your project.\n          </FeatureText>\n        </Feature>\n      </FeatureList>\n    </FeatureSection>\n  </>\n)\n"
  },
  {
    "path": "website/src/components/playground/Ad.js",
    "content": "import styled from '@xstyled/styled-components'\n\nexport const Ad = styled.a`\n  display: block;\n  background-color: darker;\n  border-radius: 3;\n  padding: 8;\n  display: flex;\n`\n\nexport const AdImg = styled.img`\n  width: 130;\n  height: 100;\n  margin-right: 8;\n  flex-shrink: 0;\n`\n\nexport const AdText = styled.div`\n  font-size: 14;\n  line-height: 1.4;\n  font-weight: 400;\n  color: lighter;\n  width: 200;\n`\n"
  },
  {
    "path": "website/src/components/playground/CheckGroup.js",
    "content": "import styled from '@xstyled/styled-components'\n\nexport const CheckGroup = styled.div`\n  display: grid;\n  grid-template-columns: min-content 1fr;\n  align-items: center;\n  gap: 2;\n`\n"
  },
  {
    "path": "website/src/components/playground/DropArea.js",
    "content": "import * as React from 'react'\nimport { useState } from 'react'\nimport styled from '@xstyled/styled-components'\n\nconst FullWidth = styled.div`\n  width: 100%;\n  height: 100%;\n`\n\nconst ChildWrapper = styled(FullWidth)`\n  transition: base;\n  opacity: 1;\n\n  &[data-dragging] {\n    opacity: 0.1;\n  }\n`\n\nconst Area = styled(FullWidth)`\n  position: relative;\n`\n\nconst Help = styled(FullWidth)`\n  position: absolute;\n  z-index: 20;\n  pointer-events: none;\n  padding-top: 20%;\n  text-align: center;\n  color: light800;\n  font-size: 28;\n  border: 2px dashed;\n  border-color: light800;\n`\n\nconst prevent = (event) => {\n  event.preventDefault()\n  event.stopPropagation()\n}\n\nexport const DropArea = ({ onChange, children }) => {\n  const [dragging, setDragging] = useState(false)\n\n  return (\n    <Area\n      onDragEnterCapture={() => {\n        setDragging(true)\n      }}\n      onDragLeaveCapture={() => {\n        setDragging(false)\n      }}\n      onDragOverCapture={prevent}\n      onDrop={prevent}\n      onDropCapture={(event) => {\n        setDragging(false)\n        prevent(event)\n        const {\n          files: [file],\n        } = event.dataTransfer\n        if (!file || file.type !== 'image/svg+xml') return\n\n        const fileReader = new FileReader()\n        fileReader.onload = () => {\n          onChange(fileReader.result)\n        }\n        fileReader.readAsText(file)\n      }}\n    >\n      {dragging && (\n        <Help>\n          <p id=\"drop-zone\">📄 Drop .svg file here.</p>\n        </Help>\n      )}\n      <ChildWrapper data-dragging={dragging ? '' : undefined}>\n        {children}\n      </ChildWrapper>\n    </Area>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/Editor.js",
    "content": "import * as React from 'react'\nimport { useColorMode } from '@xstyled/styled-components'\n\nimport AceEditor from 'react-ace'\nimport 'brace'\nimport 'brace/mode/xml'\nimport 'brace/mode/jsx'\nimport 'brace/theme/tomorrow_night'\nimport 'brace/theme/github'\n\nconst editorProps = { $blockScrolling: true }\nconst scrollMargin = [8, 0, 0, 0]\n\nexport default function Editor(props) {\n  const [colorMode] = useColorMode()\n  const theme = colorMode === 'dark' ? 'tomorrow_night' : 'github'\n  return (\n    <AceEditor\n      width=\"100%\"\n      height=\"100%\"\n      showPrintMargin={false}\n      theme={theme}\n      editorProps={editorProps}\n      scrollMargin={scrollMargin}\n      fontSize={13}\n      {...props}\n    />\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/Loading.js",
    "content": "import * as React from 'react'\nimport styled, { keyframes } from '@xstyled/styled-components'\nimport { graphql, StaticQuery } from 'gatsby'\n\nconst QUERY = graphql`\n  query Loading {\n    logo: file(relativePath: { eq: \"home-logo.png\" }) {\n      childImageSharp {\n        fluid(maxWidth: 800, maxHeight: 800) {\n          ...GatsbyImageSharpFluid\n        }\n      }\n    }\n  }\n`\n\nconst fadeIn = keyframes`\n  0% { opacity: 1; }\n  100% { opacity: 0.4; }\n`\n\nconst Loader = styled.div`\n  flex: 1;\n  animation: ${fadeIn} 1000ms ease-in infinite alternate;\n  background-repeat: no-repeat;\n  background-position: center;\n  background-size: 30%;\n`\n\nexport const Loading = () => {\n  return (\n    <StaticQuery\n      query={QUERY}\n      render={(data) => (\n        <Loader\n          style={{ backgroundImage: data.logo.childImageSharp.fluid.src }}\n        />\n      )}\n    />\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/Playground.js",
    "content": "/* eslint-disable jsx-a11y/accessible-emoji */\nimport * as React from 'react'\nimport { useState, useEffect, lazy, useRef, Suspense } from 'react'\nimport styled, { x, createGlobalStyle } from '@xstyled/styled-components'\nimport {\n  useDialogState,\n  Dialog as ReakitDialog,\n  DialogBackdrop as ReakitDialogBackdrop,\n} from 'reakit/Dialog'\nimport { CarbonAd } from 'smooth-doc/src/components/CarbonAd'\nimport { Settings } from './Settings'\nimport { svgr } from './modules/svgr'\nimport defaultSvg from './defaultSVG'\nimport { DropArea } from './DropArea'\nimport { Loading } from './Loading'\nimport { settings, getInitialState, stateToSettings } from './config/settings'\nimport { useQuery } from './Query'\n\nconst GlobalStyle = createGlobalStyle`\n  :root {\n    color-scheme: light;\n  }\n\n  .xstyled-color-mode-dark {\n    color-scheme: dark;\n  }\n\n  .loading {\n    transition: opacity 300ms;\n    opacity: 0.5;\n  }\n\n  .ace_gutter {\n    @media(max-width: sm) {\n      width: 5px !important;\n    }\n  }\n`\n\nconst Container = styled.div`\n  display: grid;\n  grid-template-columns: min-content 1fr;\n  height: calc(100vh - 50px);\n  background-color: background;\n`\n\nconst Editors = styled.div`\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n\n  > :first-child {\n    border-right: 1px solid;\n    border-color: layout-border;\n  }\n`\n\nconst EditorContainer = styled.div`\n  display: grid;\n  grid-template-rows: min-content 1fr;\n  transition: opacity 300ms;\n\n  &[data-loading] {\n    opacity: 0.5;\n  }\n`\n\nconst FloatingAd = styled.div`\n  position: absolute;\n  bottom: 16;\n  right: 16;\n  z-index: 500;\n  width: 400;\n`\n\nconst EditorTitleContainer = styled.div`\n  padding: 0 2;\n  font-size: 12;\n  height: 28;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  text-transform: uppercase;\n  border-bottom: 1;\n  border-color: layout-border;\n  color: on-background-light;\n`\n\nconst EditorTitle = styled.h3`\n  display: flex;\n  align-items: center;\n  font-weight: bold;\n`\n\nconst EditorTitleButton = styled.button`\n  border-radius: 4;\n  height: 20;\n`\n\nconst InnerDialog = styled.div`\n  background-color: background-light;\n  color: on-background;\n  position: fixed;\n  top: 20%;\n  left: 50%;\n  max-width: 90%;\n  min-width: 600;\n  transform: translateX(-50%);\n  border-radius: 10;\n  padding: 5;\n  outline: 0;\n  z-index: 999;\n  box-shadow: 5px 5px rgba(50, 50, 50, 0.4), 10px 10px rgba(50, 50, 50, 0.3),\n    15px 15px rgba(50, 50, 50, 0.2), 20px 20px rgba(50, 50, 50, 0.1),\n    25px 25px rgba(50, 50, 50, 0.05);\n`\n\nconst InnerBackdrop = styled.div`\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  background-color: on-background;\n  opacity: 0.4;\n  z-index: 899;\n`\n\nconst ThankBody = styled.div`\n  text-align: center;\n\n  h2 {\n    font-size: 18;\n    font-weight: 500;\n    margin: 2;\n  }\n`\n\nconst Link = styled.a`\n  display: inline-block;\n  color: inherit;\n  transition: base;\n\n  &:hover {\n    text-decoration: none;\n    transform: translateY(-2px);\n  }\n`\n\nconst SponsorLink = styled.aBox`\n  display: inline-block;\n  font-weight: 500;\n  color: white;\n  text-shadow: 0 0 1px rgba(0, 0, 0, 0.4), 0 0 3px rgba(0, 0, 0, 0.2);\n  min-width: 300;\n  text-decoration: none !important;\n  padding: 2;\n  border-radius: 3;\n  transition: base;\n\n  &:hover {\n    color: white;\n    transform: scale(1.08);\n  }\n`\n\nfunction trackLink(event) {\n  if (window.ga) {\n    event.preventDefault()\n    const url = event.currentTarget.href\n    window.ga('send', 'event', 'outbound', 'click', url, {\n      transport: 'beacon',\n      hitCallback() {\n        document.location = url\n      },\n    })\n  }\n}\n\nfunction CopyFeedback(props) {\n  return (\n    <>\n      <ReakitDialogBackdrop as={InnerBackdrop} {...props} />\n      <ReakitDialog as={InnerDialog} {...props} aria-label=\"Thank you\">\n        <ThankBody>\n          <h2>\n            SVGR is made with ❤️ by{' '}\n            <Link\n              onClick={trackLink}\n              href=\"https://gregberge.com\"\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n            >\n              Greg Bergé\n            </Link>\n          </h2>\n          <p>\n            Glad it helps!\n            <br />A few ways to say thank you 👇\n          </p>\n          <x.div my={24}>\n            <SponsorLink\n              onClick={trackLink}\n              href=\"https://github.com/sponsors/gregberge\"\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n              bg=\"#EA4BAA\"\n            >\n              ❤️ Sponsor me on GitHub\n            </SponsorLink>\n          </x.div>\n          <x.div my={24}>\n            <SponsorLink\n              onClick={trackLink}\n              href=\"https://opencollective.com/svgr\"\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n              bg=\"#2A7EFF\"\n            >\n              💸 Donate on OpenCollective\n            </SponsorLink>\n          </x.div>\n          <x.div my={24}>\n            <SponsorLink\n              onClick={trackLink}\n              href=\"https://twitter.com/gregberge_\"\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n              bg=\"#1DA1F3\"\n            >\n              😉 Follow me on Twitter\n            </SponsorLink>\n          </x.div>\n        </ThankBody>\n      </ReakitDialog>\n    </>\n  )\n}\n\nconst Editor = lazy(() => import('./Editor'))\n\nconst ClientOnly = ({ children }) => {\n  const [visible, setVisible] = useState(false)\n  useEffect(() => {\n    setVisible(true)\n  }, [])\n  return visible ? children : null\n}\n\nconst Copy = 'Copy'\nconst Copied = 'Copied!'\n\nexport function Playground() {\n  const [input, setInput] = useState(defaultSvg)\n  const [output, setOutput] = useState('')\n  const [loading, setLoading] = useState(false)\n  const [state, setState] = useQuery(getInitialState)\n  const dialog = useDialogState({ visible: false })\n  const dialogDisplayedRef = useRef(false)\n\n  const transformIdRef = useRef(0)\n\n  useEffect(() => {\n    async function transform() {\n      if (input.trim() === '') {\n        setOutput('')\n        return\n      }\n\n      setLoading(true)\n\n      if (window.ga) {\n        window.ga('send', {\n          hitType: 'event',\n          eventCategory: 'Playground',\n          eventAction: 'transform',\n        })\n      }\n\n      try {\n        /* eslint-disable-next-line no-plusplus */\n        const transformId = ++transformIdRef.current\n        const output = await svgr(input, stateToSettings(state))\n        if (transformId === transformIdRef.current) {\n          setOutput(output)\n          setLoading(false)\n        }\n      } catch (error) {\n        // We do nothing and assume that provided code is not correct\n      }\n    }\n\n    transform()\n  }, [input, JSON.stringify(state)])\n\n  const handleButtonClick = (event) => {\n    navigator.clipboard.writeText(output)\n    !dialogDisplayedRef.current &&\n      setTimeout(() => {\n        dialog.show()\n        dialogDisplayedRef.current = true\n      }, 50)\n    const button = event.target\n    button.innerText = Copied\n    setTimeout(() => {\n      button.innerText = Copy\n    }, 2000)\n  }\n\n  return (\n    <>\n      <GlobalStyle />\n      <ClientOnly>\n        <Container>\n          <Settings\n            settings={settings}\n            initialValues={state}\n            onChange={setState}\n          />\n          <Suspense fallback={<Loading />}>\n            <Editors>\n              <EditorContainer>\n                <EditorTitleContainer>\n                  <EditorTitle>SVG input</EditorTitle>\n                </EditorTitleContainer>\n                <DropArea onChange={setInput}>\n                  <Editor\n                    name=\"input\"\n                    mode=\"xml\"\n                    onChange={setInput}\n                    value={input}\n                  />\n                </DropArea>\n              </EditorContainer>\n              <EditorContainer\n                data-loading={loading ? '' : undefined}\n                onKeyDown={(event) => {\n                  if (dialogDisplayedRef.current) return\n                  // Detect copy\n                  if ((event.metaKey || event.ctrlKey) && event.key === 'c') {\n                    setTimeout(() => {\n                      dialog.show()\n                      dialogDisplayedRef.current = true\n                    }, 50)\n                  }\n                }}\n              >\n                <EditorTitleContainer>\n                  <EditorTitle>JSX output</EditorTitle>\n                  <EditorTitleButton onClick={handleButtonClick}>\n                    {Copy}\n                  </EditorTitleButton>\n                </EditorTitleContainer>\n                <Editor name=\"output\" mode=\"jsx\" readOnly value={output} />\n              </EditorContainer>\n            </Editors>\n          </Suspense>\n          <CopyFeedback {...dialog} />\n          <FloatingAd>\n            <CarbonAd />\n          </FloatingAd>\n        </Container>\n      </ClientOnly>\n    </>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/Query.js",
    "content": "import * as React from 'react'\nimport qs from 'query-string'\nimport { createBrowserHistory } from 'history'\n\nfunction formatQuery(state, initialState) {\n  const lightState = Object.entries(state).reduce(\n    (lightState, [key, value]) => {\n      if (initialState[key] !== value) {\n        lightState[key] = value\n      }\n      return lightState\n    },\n    {},\n  )\n  const qsStr = qs.stringify(lightState, { arrayFormat: 'bracket' })\n  return qsStr ? `?${qsStr}` : ''\n}\n\nfunction parseQuery(query) {\n  return qs.parse(query, { arrayFormat: 'bracket', parseBooleans: true })\n}\n\nfunction getLocation() {\n  if (typeof window === 'undefined')\n    return { location: { search: '', pathname: '' } }\n  return { location: window.location }\n}\n\nlet browserHistory\n\nfunction useHistory() {\n  if (typeof window === 'undefined') return null\n  if (browserHistory) {\n    return browserHistory\n  }\n  browserHistory = createBrowserHistory()\n  return browserHistory\n}\n\nfunction useLocation() {\n  const history = useHistory()\n  const [location, setLocation] = React.useState(getLocation)\n  React.useEffect(\n    () => history.listen((location) => setLocation(location)),\n    [history],\n  )\n  return location\n}\n\nexport function useQuery(getInitialState = {}) {\n  const history = useHistory()\n  const [initialState] = React.useState(getInitialState)\n  const { location } = useLocation()\n  const locationRef = React.useRef(location)\n  React.useEffect(() => {\n    locationRef.current = location\n  })\n  const setState = React.useCallback(\n    (state) => {\n      const search = formatQuery({ ...initialState, ...state }, initialState)\n      if (locationRef.current.search !== search) {\n        history.push({\n          pathname: locationRef.current.pathname,\n          search,\n        })\n      }\n    },\n    [history, initialState],\n  )\n  const state = React.useMemo(\n    () => ({ ...initialState, ...parseQuery(location.search) }),\n    [location.search, initialState],\n  )\n  React.useEffect(() => {\n    setState(parseQuery(locationRef.current.search))\n  }, [history, setState])\n  return [state, setState]\n}\n"
  },
  {
    "path": "website/src/components/playground/Settings.js",
    "content": "import * as React from 'react'\nimport styled from '@xstyled/styled-components'\nimport { Form, FormSpy } from 'react-final-form'\nimport { SettingsFieldBoolean } from './SettingsFieldBoolean'\nimport { SettingsGroup } from './SettingsGroup'\nimport { SettingsFieldString } from './SettingsFieldString'\nimport { SettingsFieldEnum } from './SettingsFieldEnum'\nimport { SettingsFieldInteger } from './SettingsFieldInteger'\n\nconst Container = styled.div`\n  font-size: 14;\n  color: on-background-light;\n  user-select: none;\n  width: 200;\n  overflow: auto;\n  border-right: 1;\n  border-color: layout-border;\n`\n\nconst getGroupSettings = (group, settings) =>\n  settings.filter((setting) => setting.group === group)\n\nconst settingComponents = {\n  boolean: SettingsFieldBoolean,\n  string: SettingsFieldString,\n  enum: SettingsFieldEnum,\n  integer: SettingsFieldInteger,\n}\n\nconst renderSetting = (setting) => {\n  const SettingComponent = settingComponents[setting.type]\n  if (!SettingComponent) throw new Error(`Unknown setting type ${setting.type}`)\n  return <SettingComponent key={setting.name} setting={setting} />\n}\n\nconst noop = () => {}\n\nexport const Settings = ({ settings, initialValues, onChange }) => {\n  return (\n    <Form onSubmit={noop} initialValues={initialValues}>\n      {() => (\n        <>\n          <FormSpy\n            subscription={{ values: true }}\n            onChange={({ values }) => onChange(values)}\n          />\n          <Container>\n            <SettingsGroup title=\"Global\">\n              {getGroupSettings('global', settings).map(renderSetting)}\n            </SettingsGroup>\n            <SettingsGroup title=\"SVGO\">\n              {getGroupSettings('svgo', settings).map(renderSetting)}\n            </SettingsGroup>\n            <SettingsGroup title=\"Prettier\">\n              {getGroupSettings('prettier', settings).map(renderSetting)}\n            </SettingsGroup>\n          </Container>\n        </>\n      )}\n    </Form>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/SettingsFieldBoolean.js",
    "content": "import * as React from 'react'\nimport { CheckGroup } from './CheckGroup'\nimport { CheckboxControl } from './controls/CheckboxControl'\n\nexport function SettingsFieldBoolean({ setting }) {\n  return (\n    <CheckGroup>\n      <CheckboxControl id={setting.name} name={setting.name} />\n      <label htmlFor={setting.name}>{setting.label}</label>\n    </CheckGroup>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/SettingsFieldEnum.js",
    "content": "import * as React from 'react'\nimport { RadioControl } from './controls/RadioControl'\nimport { SmallLabel } from './SmallLabel'\nimport { CheckGroup } from './CheckGroup'\n\nexport function SettingsFieldEnum({ setting }) {\n  return (\n    <div>\n      <SmallLabel htmlFor={setting.name}>{setting.label}</SmallLabel>\n      {setting.values.map((value) => (\n        <CheckGroup key={value}>\n          <RadioControl\n            id={`${setting.name}-${value}`}\n            name={setting.name}\n            value={value}\n          />\n          <label htmlFor={`${setting.name}-${value}`}>{value}</label>\n        </CheckGroup>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/SettingsFieldInteger.js",
    "content": "import * as React from 'react'\nimport { InputControl } from './controls/InputControl'\nimport { SmallLabel } from './SmallLabel'\n\nexport function SettingsFieldInteger({ setting }) {\n  return (\n    <div>\n      <SmallLabel htmlFor={setting.name}>{setting.label}</SmallLabel>\n      <InputControl type=\"number\" id={setting.name} name={setting.name} />\n    </div>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/SettingsFieldString.js",
    "content": "import * as React from 'react'\nimport { TextareaControl } from './controls/TextareaControl'\nimport { SmallLabel } from './SmallLabel'\n\nexport function SettingsFieldString({ setting }) {\n  return (\n    <div>\n      <SmallLabel htmlFor={setting.name}>{setting.label}</SmallLabel>\n      <TextareaControl\n        id={setting.name}\n        placeholder={setting.placeholder}\n        name={setting.name}\n      />\n    </div>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/SettingsGroup.js",
    "content": "import * as React from 'react'\nimport styled, { up, css } from '@xstyled/styled-components'\nimport {\n  useDisclosureState,\n  DisclosureContent,\n  Disclosure,\n} from 'reakit/Disclosure'\nimport { IoChevronBack } from 'react-icons/io5'\n\nconst Marker = styled(IoChevronBack)`\n  width: 18;\n  height: 18;\n  transition: base;\n  transition-property: transform;\n  transform: rotate(90deg);\n\n  ${up(\n    'md',\n    css`\n      transform: rotate(0);\n    `,\n  )}\n`\n\nconst Button = styled.button`\n  font-size: 15;\n  height: 28;\n  font-weight: 500;\n  background-color: transparent;\n  border: none;\n  color: inherit;\n  cursor: pointer;\n  border: 0;\n  border-bottom: 1;\n  border-color: layout-border;\n  appearance: none;\n  margin: 0;\n  text-align: left;\n  display: grid;\n  grid-template-columns: 1fr min-content;\n  align-items: center;\n  width: 100%;\n\n  &[aria-expanded='true'] {\n    ${Marker} {\n      transform: rotate(-90deg);\n    }\n  }\n\n  &:focus,\n  &:hover {\n    background-color: light200;\n    outline: none;\n  }\n`\n\nconst Content = styled.div`\n  display: grid;\n  gap: 1;\n  padding: 2;\n  border-bottom: 1;\n  border-color: layout-border;\n`\n\nexport function SettingsGroup({ title, children }) {\n  const disclosure = useDisclosureState({ visible: true })\n  return (\n    <div>\n      <Disclosure {...disclosure}>\n        {(DisclosureProps) => (\n          <Button {...DisclosureProps}>\n            {title} <Marker />\n          </Button>\n        )}\n      </Disclosure>\n      <DisclosureContent as={Content} {...disclosure}>\n        {children}\n      </DisclosureContent>\n    </div>\n  )\n}\n"
  },
  {
    "path": "website/src/components/playground/SmallLabel.js",
    "content": "import styled from '@xstyled/styled-components'\n\nexport const SmallLabel = styled.labelBox`\n  text-transform: uppercase;\n  font-size: 11;\n  font-weight: bold;\n  display: block;\n  margin: 2 0;\n`\n"
  },
  {
    "path": "website/src/components/playground/config/settings.js",
    "content": "const parseObject = (value) =>\n  value.split(',').reduce((obj, assignment) => {\n    const [left, right] = assignment.split('=')\n    return {\n      ...obj,\n      [left.trim()]: right?.trim(),\n    }\n  }, {})\n\nconst parseJson = (value) => value && JSON.parse(value)\n\nconst initialSvgoConfig = JSON.stringify(\n  {\n    plugins: [\n      {\n        name: 'preset-default',\n        params: { overrides: { removeTitle: false } },\n      },\n    ],\n  },\n  null,\n  2,\n)\n\nconst initialPrettierConfig = JSON.stringify({ semi: false }, null, 2)\n\nexport const settings = [\n  {\n    label: 'Dimensions',\n    name: 'dimensions',\n    type: 'boolean',\n    group: 'global',\n    default: true,\n  },\n  {\n    label: 'Icon',\n    name: 'icon',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'React Native',\n    name: 'native',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'TypeScript',\n    name: 'typescript',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'Ref',\n    name: 'ref',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'Memo',\n    name: 'memo',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'Title prop',\n    name: 'titleProp',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'Desc prop',\n    name: 'descProp',\n    type: 'boolean',\n    group: 'global',\n    default: false,\n  },\n  {\n    label: 'Expand props',\n    name: 'expandProps',\n    type: 'enum',\n    values: ['start', 'end', 'none'],\n    group: 'global',\n    default: 'end',\n    transform: (value) => (value === 'none' ? false : value),\n  },\n  {\n    label: 'Replace attributes value',\n    name: 'replaceAttrValues',\n    placeholder: '#063855=currentColor',\n    type: 'string',\n    group: 'global',\n    transform: parseObject,\n    default: '',\n  },\n  {\n    label: 'SVG props',\n    name: 'svgProps',\n    placeholder: 'focusable=false',\n    type: 'string',\n    group: 'global',\n    transform: parseObject,\n    default: '',\n  },\n  {\n    label: 'Export Type',\n    name: 'exportType',\n    type: 'enum',\n    values: ['named', 'default'],\n    group: 'global',\n    default: 'default',\n  },\n  {\n    label: 'Named export',\n    name: 'namedExport',\n    placeholder: 'ReactComponent',\n    type: 'string',\n    group: 'global',\n    default: 'ReactComponent',\n  },\n  {\n    label: 'JSX runtime',\n    name: 'jsxRuntime',\n    type: 'enum',\n    values: ['classic', 'classic-preact', 'automatic', 'none'],\n    group: 'global',\n    transform: (value) => (value === 'none' ? 'classic' : value),\n    default: 'none',\n  },\n  {\n    label: 'Enable',\n    name: 'svgo',\n    type: 'boolean',\n    group: 'svgo',\n    default: true,\n  },\n  {\n    label: 'Config',\n    name: 'svgoConfig',\n    placeholder: initialSvgoConfig,\n    type: 'string',\n    group: 'svgo',\n    default: initialSvgoConfig,\n    transform: parseJson,\n  },\n  {\n    label: 'Enable',\n    name: 'prettier',\n    type: 'boolean',\n    group: 'prettier',\n    default: true,\n  },\n  {\n    label: 'Config',\n    name: 'prettierConfig',\n    placeholder: initialPrettierConfig,\n    type: 'string',\n    group: 'prettier',\n    default: initialPrettierConfig,\n    transform: parseJson,\n  },\n]\n\nexport const getInitialState = () =>\n  settings.reduce(\n    (state, setting) => ({\n      ...state,\n      [setting.name]: setting.default,\n    }),\n    {},\n  )\n\nexport function stateToSettings(state) {\n  return Object.entries(state).reduce((newState, [key, value]) => {\n    const { transform } = settings.find(({ name }) => name === key)\n    return { ...newState, [key]: transform ? transform(value) : value }\n  }, {})\n}\n"
  },
  {
    "path": "website/src/components/playground/controls/CheckboxControl.js",
    "content": "import * as React from 'react'\nimport { useField } from 'react-final-form'\n\nexport const CheckboxControl = ({ name, value, ...props }) => {\n  const field = useField(name, { type: 'checkbox', value })\n  return <input {...field.input} {...props} />\n}\n"
  },
  {
    "path": "website/src/components/playground/controls/InputControl.js",
    "content": "import * as React from 'react'\nimport { useField } from 'react-final-form'\n\nexport const InputControl = ({ name, ...props }) => {\n  const field = useField(name)\n  return <input {...field.input} {...props} />\n}\n"
  },
  {
    "path": "website/src/components/playground/controls/RadioControl.js",
    "content": "import * as React from 'react'\nimport { useField } from 'react-final-form'\n\nexport const RadioControl = ({ name, value, ...props }) => {\n  const field = useField(name, { type: 'radio', value })\n  return <input {...field.input} {...props} />\n}\n"
  },
  {
    "path": "website/src/components/playground/controls/TextareaControl.js",
    "content": "import * as React from 'react'\nimport styled from '@xstyled/styled-components'\nimport { useField } from 'react-final-form'\n\nconst Textarea = styled.textarea`\n  width: 100%;\n  font-size: 11;\n  border: 1;\n  border-color: layout-border;\n  border-radius: 3;\n`\n\nexport const TextareaControl = ({ name, ...props }) => {\n  const field = useField(name)\n  return <Textarea {...field.input} rows={4} {...props} />\n}\n"
  },
  {
    "path": "website/src/components/playground/defaultSVG.js",
    "content": "const defaultSvg = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"48px\" height=\"1px\" viewBox=\"0 0 48 1\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->\n    <title>Rectangle 5</title>\n    <desc>Created with Sketch.</desc>\n    <defs></defs>\n    <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <g id=\"19-Separator\" transform=\"translate(-129.000000, -156.000000)\" fill=\"#063855\">\n            <g id=\"Controls/Settings\" transform=\"translate(80.000000, 0.000000)\">\n                <g id=\"Content\" transform=\"translate(0.000000, 64.000000)\">\n                    <g id=\"Group\" transform=\"translate(24.000000, 56.000000)\">\n                        <g id=\"Group-2\">\n                            <rect id=\"Rectangle-5\" x=\"25\" y=\"36\" width=\"48\" height=\"1\"></rect>\n                        </g>\n                    </g>\n                </g>\n            </g>\n        </g>\n    </g>\n</svg>`\n\nexport default defaultSvg\n"
  },
  {
    "path": "website/src/components/playground/icons/ChevronLeft.js",
    "content": "import * as React from 'react'\n\nexport const ChevronLeft = (props) => (\n  <svg\n    viewBox=\"0 0 24 24\"\n    fill=\"none\"\n    stroke=\"currentColor\"\n    strokeWidth={2}\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    className=\"feather feather-chevron-left\"\n    width=\"1em\"\n    height=\"1em\"\n    {...props}\n  >\n    <path d=\"M15 18l-6-6 6-6\" />\n  </svg>\n)\n"
  },
  {
    "path": "website/src/components/playground/modules/svgr.js",
    "content": "import fetch from 'isomorphic-fetch'\n\n/* eslint-env browser */\nexport async function svgr(code, options = {}) {\n  const res = await fetch('https://api.react-svgr.com/api/svgr', {\n    headers: {\n      'content-type': 'application/json',\n    },\n    method: 'post',\n    body: JSON.stringify({ code, options }),\n  })\n  const json = await res.json()\n  if (json.error) throw new Error(json.error)\n  return json.output\n}\n"
  },
  {
    "path": "website/src/smooth-doc/theme.js",
    "content": "import { theme as baseTheme, primaryColor } from 'smooth-doc/src/theme'\n\nexport const theme = {\n  ...baseTheme,\n  colors: { ...baseTheme.colors, ...primaryColor('orange') },\n}\n"
  }
]