{"id":41019632,"url":"https://github.com/hhvm/xhp-js","last_synced_at":"2026-01-22T09:31:45.297Z","repository":{"id":30188518,"uuid":"33739246","full_name":"hhvm/xhp-js","owner":"hhvm","description":"Easily create JS controllers for XHP elements, and XHP wrappers for React elements","archived":false,"fork":false,"pushed_at":"2021-11-18T20:57:17.000Z","size":190,"stargazers_count":56,"open_issues_count":2,"forks_count":7,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-05-22T17:49:58.987Z","etag":null,"topics":["hack","hacklang","javascript","react","xhp"],"latest_commit_sha":null,"homepage":null,"language":"Hack","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/hhvm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-10T16:40:35.000Z","updated_at":"2025-02-06T13:41:42.000Z","dependencies_parsed_at":"2022-08-28T18:44:02.734Z","dependency_job_id":null,"html_url":"https://github.com/hhvm/xhp-js","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hhvm/xhp-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhvm%2Fxhp-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhvm%2Fxhp-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhvm%2Fxhp-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhvm%2Fxhp-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhvm","download_url":"https://codeload.github.com/hhvm/xhp-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhvm%2Fxhp-js/sbom","scorecard":{"id":463886,"data":{"date":"2025-08-11","repo":{"name":"github.com/hhvm/xhp-js","commit":"c1ca41c8ded14431d3a6d283c8c17be74da24f61"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"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":"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":"Code-Review","score":1,"reason":"Found 4/30 approved changesets -- score normalized to 1","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":"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":"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT 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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T11:55:08.583Z","repository_id":30188518,"created_at":"2025-08-19T11:55:08.583Z","updated_at":"2025-08-19T11:55:08.583Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28660770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":["hack","hacklang","javascript","react","xhp"],"created_at":"2026-01-22T09:31:45.073Z","updated_at":"2026-01-22T09:31:45.292Z","avatar_url":"https://github.com/hhvm.png","language":"Hack","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XHP-JS\n\nXHP-JS is a combination of Hack and Javascript libraries allowing you to easily\ncall Javascript functions or create Javascript classes that from XHP\ncomponents, and to pass these classes or references to the DOM nodes to other\nJavascript code.\n\nFor convenience, an interface to construct React components is also included.\n\nA short overview is available at https://code.facebook.com/posts/858739974205250\n\n## Examples\n\nA full example is available at https://github.com/hhvm/xhp-js-example\n\n### Calling a Javascript function\n\n```Hack\nxhp class JsCallExample extends HTML\\element {\n  use XHPHTMLHelpers;\n  use XHPJSCall;\n\n  \u003c\u003c__Override\u003e\u003e\n  protected function renderAsync(): Awaitable\u003cx\\node\u003e {\n    $this-\u003ejsCall(\n      'ModuleName',\n      'functionName',\n      'First argument',\n      // This passes the DOM node corresponding to the \u003cdiv /\u003e below\n      $this-\u003etoJSElementRef(),\n      'Third argument',\n    );\n\n    return \u003cdiv id={$this-\u003egetID()} /\u003e;\n  }\n}\n\n$xhp = \u003chtml\u003e\u003chead /\u003e\u003cbody\u003e\n  \u003cx_js_scope\u003e\u003cJsCallExample /\u003e\u003cx_js_scope\u003e\n\u003c/body\u003e\u003c/html\u003e;\necho await $xhp-\u003etoStringAsync();\n```\n\n### Creating a Javascript Object\n\n```Hack\nxhp class JSInstanceExample extends HTML\\element {\n  use XHPHTMLHelpers;\n  use XHPJSCall;\n\n  \u003c\u003c__Override\u003e\u003e\n  protected function renderAsync(): Awaitable\u003cx\\node\u003e {\n    $this-\u003econstructJSInstance(\n      'ClassName',\n      $this-\u003etoJSElementRef(),\n      // can pass through other arguments too\n    );\n\n    $this-\u003ejsCall(\n      'MyModule',\n      'myFunction',\n      // This passes the JS object created above\n      $this-\u003etoJSInstanceRef(),\n    );\n\n    return \u003cdiv id={$this-\u003egetID()} /\u003e;\n  }\n}\n\n\n$xhp = \u003chtml\u003e\u003chead /\u003e\u003cbody\u003e\n  \u003cx_js_scope\u003e\u003cJSInstanceExample /\u003e\u003cx_js_scope\u003e\n\u003c/body\u003e\u003c/html\u003e;\n```\n\n### Creating a React component\n\n*This functionality was based on an extremely old React version. The example has been removed.*\n\n## Writing your JavaScript\n\nWe recommend writing your modules as CommonJS modules, and using Browserify.\n\nAlternatively, you can create them as members of the window object.\n\nXHP-JS looks for modules as members of the window object, and falls back to\nattempting to call 'require(\"ModuleName\")' - this requires a require() function\nto be defined in the global scope.\n\nFor example:\n\n```Hack\n$this-\u003ejsCall('MyModule', 'myMethod', 'argument');\n```\n\nThis Hack code can be thought of as creating the following Javascript:\n\n```Javascript\nvar module = window.MyModule ? window.MyModule : require('MyModule');\nmodule.myMethod('argument');\n```\n\nIn turn, your JavaScript may look like:\n\n```Javascript\nvar MyModule = {\n  myMethod: function() {\n    // ...\n  }\n};\n\nmodule.exports = MyModule; // if using CommonJS + Browserify\nwindow.MyModule = MyModule; // if not\n```\n\n## Installation\n\nWe recommend installing XHP-JS with Composer (for the Hack code) and npm +\nBrowserify for the Javascript code. Alternatively, you can include xhpjs.js or\nxhpjs.min.js directly to declare an XHPJS object in the global scope.\n\nSee https://github.com/hhvm/xhp-js-example for a full example.\n\n## License\nXHP-JS is [MIT-licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhvm%2Fxhp-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhvm%2Fxhp-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhvm%2Fxhp-js/lists"}