{"id":19916847,"url":"https://github.com/rubylouvre/jsx-parser","last_synced_at":"2025-08-18T07:11:56.755Z","repository":{"id":44994358,"uuid":"83381282","full_name":"RubyLouvre/jsx-parser","owner":"RubyLouvre","description":"a lightweight jsx parser","archived":false,"fork":false,"pushed_at":"2023-06-10T07:45:06.000Z","size":280,"stargazers_count":99,"open_issues_count":4,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-16T01:24:13.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RubyLouvre.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2017-02-28T02:43:05.000Z","updated_at":"2025-04-13T11:49:32.000Z","dependencies_parsed_at":"2024-06-18T21:19:34.485Z","dependency_job_id":"c5783fb7-96c6-4f29-9cde-7dfc1effceec","html_url":"https://github.com/RubyLouvre/jsx-parser","commit_stats":{"total_commits":50,"total_committers":4,"mean_commits":12.5,"dds":"0.45999999999999996","last_synced_commit":"c15f0688edf3e4c5ef832b6fc4dd816f867037c6"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/RubyLouvre/jsx-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyLouvre%2Fjsx-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyLouvre%2Fjsx-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyLouvre%2Fjsx-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyLouvre%2Fjsx-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubyLouvre","download_url":"https://codeload.github.com/RubyLouvre/jsx-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyLouvre%2Fjsx-parser/sbom","scorecard":{"id":122964,"data":{"date":"2025-08-11","repo":{"name":"github.com/RubyLouvre/jsx-parser","commit":"c15f0688edf3e4c5ef832b6fc4dd816f867037c6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T02:56:00.974Z","repository_id":44994358,"created_at":"2025-08-16T02:56:00.974Z","updated_at":"2025-08-16T02:56:00.974Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270957473,"owners_count":24675158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-12T21:47:48.550Z","updated_at":"2025-08-18T07:11:56.731Z","avatar_url":"https://github.com/RubyLouvre.png","language":"JavaScript","readme":"# jsx-parser\n\n## a lightweight jsx parser\n\nnpm\n\n```\nnpm install jsx-parser\n```\n\nhow to require\n\n```\nimport JSXParser form 'index'\n```\n\nor \n```html\n\u003cscript src=\"index.umd\"\u003e\u003c/script\u003e\n```\n\n\nhow to use\n\n\n```javascript\n\nvar str = '\u003cdiv {...[\u003cdiv/\u003e]} /\u003e'\nconsole.log(JSON.stringify(JSXParser(str), null, \" \"))\n```\noutput\n```json\n{\n \"type\": \"div\",\n \"props\": {\n  \"spreadAttribute\": {\n   \"type\": \"#jsx\",\n   \"nodeValue\": [\n    {\n     \"type\": \"#jsx\",\n     \"nodeValue\": \"[\"\n    },\n    {\n     \"type\": \"div\",\n     \"props\": {},\n     \"children\": [],\n     \"isVoidTag\": true\n    },\n    {\n     \"type\": \"#jsx\",\n     \"nodeValue\": \"]\"\n    }\n   ]\n  }\n },\n \"children\": [],\n \"isVoidTag\": true\n}\n```\n\n\n```javascript\n\nvar str = `\u003cdiv id={ 2222 } kkk={\u003cdiv class={aaa}/\u003e} className=\"{111}\" \u003exxx{[1,2,3].map(el=\u003e \u003cdiv\u003e{el}\u003c/div\u003e)}yyy\n\u003cspan\u003e{xxx}--{yyy}\u003c/span\u003e\u003c/div\u003e`\nconsole.log(JSON.stringify(JSXParser(str), null, \" \"))\n```\n\n```json\n{\n \"type\": \"div\",\n \"props\": {\n  \"id\": {\n   \"type\": \"#jsx\",\n   \"nodeValue\": \" 2222 \"\n  },\n  \"kkk\": {\n   \"type\": \"#jsx\",\n   \"nodeValue\": [\n    {\n     \"type\": \"div\",\n     \"props\": {\n      \"class\": {\n       \"type\": \"#jsx\",\n       \"nodeValue\": \"aaa\"\n      }\n     },\n     \"children\": [],\n     \"isVoidTag\": true\n    }\n   ]\n  },\n  \"className\": \"{111}\"\n },\n \"children\": [\n  {\n   \"type\": \"#text\",\n   \"nodeValue\": \"xxx\"\n  },\n  {\n   \"type\": \"#jsx\",\n   \"nodeValue\": [\n    {\n     \"type\": \"#jsx\",\n     \"nodeValue\": \"[1,2,3].map(el=\u003e \"\n    },\n    {\n     \"type\": \"div\",\n     \"props\": {},\n     \"children\": [\n      {\n       \"type\": \"#jsx\",\n       \"nodeValue\": \"el\"\n      }\n     ]\n    },\n    {\n     \"type\": \"#jsx\",\n     \"nodeValue\": \")\"\n    }\n   ]\n  },\n  {\n   \"type\": \"#text\",\n   \"nodeValue\": \"yyy\\n\"\n  },\n  {\n   \"type\": \"span\",\n   \"props\": {},\n   \"children\": [\n    {\n     \"type\": \"#jsx\",\n     \"nodeValue\": \"xxx\"\n    },\n    {\n     \"type\": \"#text\",\n     \"nodeValue\": \"--\"\n    },\n    {\n     \"type\": \"#jsx\",\n     \"nodeValue\": \"yyy\"\n    }\n   ]\n  }\n ]\n}\n```\n generative rule：\n 1. tagName --\u003e type\n 2. attributes --\u003e  props\n 3. voidTag that like  `\u003cbr \u003e` `\u003chr/\u003e`  or closing tag that like `\u003celement /\u003e`  has **isVoidTag = true** property\n 4.  `{...obj}` will add **spreadAttribute** property to props object\n 5. text node type is \"#text\"\n 6. `{}` will generate **#jsx** node , that has object nodeValue or array nodeValue\n\n\nYou also can be used directly **evalJSX**, that already contains jsx-parser\n\n```javascript\nevalJSX.globalNs  = 'React' // or `anu`  https://github.com/RubyLouvre/anu or `preact`\nvar Parent = React.createClass({\n        getChildContext: function() {\n            return {\n                papa: 'papa'\n            };\n        },\n\n        render: function() {\n            return evalJSX(`\n    \u003cdiv class=\"parent\"\u003e{this.props.children}\u003c/div\u003e`, {\n                this: this\n            });\n        }\n    });\n```\n\n example\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n    \u003cmeta charset=\"utf-8\" /\u003e\n    \u003ctitle\u003eJSX Parser\u003c/title\u003e\n    \u003cscript src=\"https://cdn.bootcss.com/react/15.5.4/react.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://cdn.bootcss.com/react/15.5.4/react-dom.js\"\u003e\u003c/script\u003e\n    \u003cscript src='./index.umd.js'\u003e\n        jsx - parser\n    \u003c/script\u003e\n    \u003cscript src='./evalJSX.js'\u003e\u003c/script\u003e\n\n    \u003cscript\u003e\n        evalJSX.globalNs = 'React'\n        class A extends React.Component {\n            constructor(props) {\n                super(props)\n                this.state = {\n                    aaa: 111\n                }\n            }\n            render() {\n                return evalJSX(`\u003cdiv className={\"hello\"}\u003e{this.state.aaa}\u003c/div\u003e`, {\n                    this: this\n                })\n            }\n        }\n        window.onload = function() {\n            ReactDOM.render(React.createElement(A), document.getElementById('example'))\n        }\n    \u003c/script\u003e\n\u003c/head\u003e\n\n\u003cbody\u003e\n\n    \u003cdiv id=\"example\"\u003e\u003c/div\u003e\n\n\u003c/body\u003e\n\n\n\u003c/html\u003e\n\n```\n\n![image](https://cloud.githubusercontent.com/assets/190846/25368295/0aad292c-29ae-11e7-9d6f-b1375810d30e.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubylouvre%2Fjsx-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubylouvre%2Fjsx-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubylouvre%2Fjsx-parser/lists"}