{"id":23503445,"url":"https://github.com/rblsb/khahotreload","last_synced_at":"2025-09-07T06:11:05.904Z","repository":{"id":50773195,"uuid":"223619901","full_name":"RblSb/KhaHotReload","owner":"RblSb","description":"Hot reload for Kha/Haxe js targets","archived":false,"fork":false,"pushed_at":"2024-06-18T01:39:46.000Z","size":104,"stargazers_count":44,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T21:51:27.505Z","etag":null,"topics":["haxe","hot-reload","javascript","kha"],"latest_commit_sha":null,"homepage":null,"language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RblSb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-11-23T16:31:15.000Z","updated_at":"2025-01-31T01:35:28.000Z","dependencies_parsed_at":"2025-04-15T21:50:54.663Z","dependency_job_id":null,"html_url":"https://github.com/RblSb/KhaHotReload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RblSb/KhaHotReload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RblSb%2FKhaHotReload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RblSb%2FKhaHotReload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RblSb%2FKhaHotReload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RblSb%2FKhaHotReload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RblSb","download_url":"https://codeload.github.com/RblSb/KhaHotReload/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RblSb%2FKhaHotReload/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274002342,"owners_count":25205421,"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-09-07T02:00:09.463Z","response_time":67,"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":["haxe","hot-reload","javascript","kha"],"created_at":"2024-12-25T08:29:46.348Z","updated_at":"2025-09-07T06:11:05.895Z","avatar_url":"https://github.com/RblSb.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"## KhaHotReload\r\n\r\n![gif demo](https://i.imgur.com/dlB0x9Q.gif)\r\n\r\nCode patching without project rebuilding. Supported targets:\r\n- html5\r\n- debug-html5 (Electron)\r\n- krom? (not tested)\r\n\r\nYou can download this sample and test with VSCode (select and run `HTML5-watch`), or use CLI:\r\n```shell\r\nnode Kha/make html5 --server \u0026\r\nnode Kha/make html5 --watch\r\n```\r\n\r\n### Setup for personal project\r\n- Copy `Libraries/hotml` folder to your project folder.\r\n- Add `#if hotml new hotml.client.Client(); #end` at start of `Main.main()`.\r\n- Add this block to `khafile.js` (before `resolve(project);`):\r\n```js\r\nif (process.argv.includes(\"--watch\")) { // run only in watch mode\r\n\tproject.targetOptions.html5.unsafeEval = true; // allow eval in electron\r\n\tlet libPath = project.addLibrary('hotml'); // client code for code-patching\r\n\tproject.addDefine('js_classic'); // to support constructors patching, optional\r\n\t// start websocket server that will send type diffs to client\r\n\tconst path = require('path');\r\n\tif (!libPath) libPath = path.resolve('./Libraries/hotml');\r\n\tconst Server = require(`${libPath}/bin/server.js`).hotml.server.Main;\r\n\t// path to target build folder and main js file.\r\n\tconst server = new Server(`${path.resolve('.')}/build/${platform}`, 'kha.js');\r\n\tcallbacks.postHaxeRecompilation = () =\u003e {\r\n\t\tserver.reload(); // parse js file every compilation\r\n\t}\r\n\t// for assets reloading\r\n\tcallbacks.postAssetReexporting = (path) =\u003e {\r\n\t\tserver.reloadAsset(path);\r\n\t}\r\n}\r\n```\r\n\r\nDone. For VSCode you also need to copy `.vscode/` launch option and tasks.\r\n\r\n### Debug hot-reload server\r\n`Libraries/hotml` is separated VSCode project with personal build task for server side.\r\n`Parser.hx` has some static vars for detected types tracing.\r\n\r\n### Usage for other frameworks / pure Haxe projects\r\n\r\nThis khamake plugin does not depend on Kha ecosystem, except for khamake's file watcher and `postHaxeRecompilation` callback, so you can use it as NodeJS app with any other build system. The only requirements is watch mode for js target and such callback.\r\n\r\n### Thanks\r\n\r\nTo [Robert Konrad](https://github.com/RobDangerous) with initial idea and implementation in [Krom](https://github.com/Kode/Krom) and [KodeGarden](https://github.com/Kode/KodeGarden).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frblsb%2Fkhahotreload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frblsb%2Fkhahotreload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frblsb%2Fkhahotreload/lists"}