{"id":17683351,"url":"https://github.com/k-yle/jsx-to-xml","last_synced_at":"2026-02-16T14:32:33.054Z","repository":{"id":258976632,"uuid":"876068932","full_name":"k-yle/jsx-to-xml","owner":"k-yle","description":"Tiny package to stringify a JSX tree into XML/HTML","archived":false,"fork":false,"pushed_at":"2025-01-22T07:41:07.000Z","size":107,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-05T16:42:25.642Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.im/jsx-to-xml","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k-yle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-21T10:51:43.000Z","updated_at":"2024-11-28T15:40:29.000Z","dependencies_parsed_at":"2025-04-20T15:01:19.215Z","dependency_job_id":null,"html_url":"https://github.com/k-yle/jsx-to-xml","commit_stats":null,"previous_names":["k-yle/jsx-to-xml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/k-yle/jsx-to-xml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Fjsx-to-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Fjsx-to-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Fjsx-to-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Fjsx-to-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k-yle","download_url":"https://codeload.github.com/k-yle/jsx-to-xml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Fjsx-to-xml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29510174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T09:45:12.045Z","updated_at":"2026-02-16T14:32:33.039Z","avatar_url":"https://github.com/k-yle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsx-to-xml\n\n[![Build Status](https://github.com/k-yle/jsx-to-xml/workflows/CI/badge.svg)](https://github.com/k-yle/jsx-to-xml/actions)\n[![npm version](https://badge.fury.io/js/jsx-to-xml.svg)](https://npm.im/jsx-to-xml)\n[![npm](https://img.shields.io/npm/dt/jsx-to-xml.svg)](https://npm.im/jsx-to-xml)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/jsx-to-xml)\n\nTiny package to stringify a JSX tree into XML/HTML. 0.6kB and no dependencies.\n\n## Example\n\n```jsx\nconst feedTitle = 'My RSS Feed';\n\nconst Item = ({ name }) =\u003e \u003c\u003eHi {name}\u003c/\u003e;\n\nconst xml = (\n  \u003crss version={2}\u003e\n    \u003ctitle\u003e{feedTitle}\u003c/title\u003e\n    \u003cItem name=\"bob\" /\u003e\n  \u003c/rss\u003e\n);\n\nconsole.log(xml);\n// prints: '\u003crss version=\"2\"\u003e\u003ctitle\u003eMy RSS Feed\u003c/title\u003eHi bob\u003c/rss\u003e'\n```\n\n## Install\n\n```sh\nnpm install -S jsx-to-xml\n```\n\n## Setup\n\nIf you want to use this library to transform every `.jsx`/`.tsx` file in your repository, then you can add the following to your [tsconfig.json](./tsconfig.json) file:\n\n```diff\n{\n  \"compilerOptions\": {\n+   \"jsx\": \"react-jsx\",\n  }\n}\n```\n\nAlternatively, you can apply this library to specific `.jsx`/`.tsx` files only, by adding the following comment to the top of the file:\n\n```diff\n+ /* @jsxImportSource jsx-to-xml */\n```\n\n## Special Cases\n\n- You can use [JSX fragments](https://react.dev/reference/react/Fragment), they will not appear in the output\n- You can import `Comment` and use `\u003cComment\u003e…\u003c/Comment\u003e`, which will get converted into `\u003c!--…--\u003e`\n- You can import `CData` and use `\u003cCData\u003e…\u003c/CData\u003e`, which will get converted into `\u003c![CDATA[…]]\u003e`\n\n## Type Safety\n\nTo create TypeScript definitons for every component that you use, create a new file (for example `global.def.ts`), and include the following content:\n\n```ts\n/** @internal */\ndeclare global {\n  namespace JSX {\n    interface IntrinsicElements {\n      // list your components and their propsx here:\n      example: { a?: string; b?: number; c?: boolean };\n      rect: { width: number; height: number };\n    }\n  }\n}\n\nexport {};\n```\n\nThe example above defines two components: `\u003cexample /\u003e` and `\u003crect /\u003e`, with a mix of optional and required props.\n\nIf you're creating a library, you should normally include `/** @internal */` above the `declare global { … }` block, and enable [`stripInternal`](https://typescriptlang.org/tsconfig/#stripInternal) in [tsconfig.json](./tsconfig.json), so that these global types are not available to anyone consuming your library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-yle%2Fjsx-to-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk-yle%2Fjsx-to-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-yle%2Fjsx-to-xml/lists"}