{"id":15580889,"url":"https://github.com/sevinf/heiss","last_synced_at":"2025-04-24T02:48:29.431Z","repository":{"id":39676177,"uuid":"145237312","full_name":"SevInf/heiss","owner":"SevInf","description":"Hot module reloading prototype with native (almost) ES6 modules","archived":false,"fork":false,"pushed_at":"2022-05-27T19:05:00.000Z","size":719,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T02:48:15.933Z","etag":null,"topics":["es2015","es6","hmr","hot-module-replacement","modules"],"latest_commit_sha":null,"homepage":null,"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/SevInf.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}},"created_at":"2018-08-18T16:57:14.000Z","updated_at":"2024-08-08T12:38:54.000Z","dependencies_parsed_at":"2022-07-22T21:17:28.822Z","dependency_job_id":null,"html_url":"https://github.com/SevInf/heiss","commit_stats":null,"previous_names":["sevinf/hmr-native"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SevInf%2Fheiss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SevInf%2Fheiss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SevInf%2Fheiss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SevInf%2Fheiss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SevInf","download_url":"https://codeload.github.com/SevInf/heiss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250552036,"owners_count":21449161,"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","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":["es2015","es6","hmr","hot-module-replacement","modules"],"created_at":"2024-10-02T19:40:35.251Z","updated_at":"2025-04-24T02:48:29.418Z","avatar_url":"https://github.com/SevInf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# heiss\n\nStatic server, which implements hot module replacement for native ES2015\nmodules.\n\n[How it works](https://medium.com/@SevInf/hot-reloading-native-es2015-modules-dc54cd8cca01).\n\n**Warning**: This is an early prototype. It serves more as a playground for\nvarious ideas then as a finished stable tool.\n\n## Limitations\n\nDue to the nature of implementation, it is not possible to hot reload modules in\nthe following cases:\n\n- export names or their count have changed.\n- module, that exports mutable variable bindings (`let` or `const`).\n\n## Requirements\n\nServer part requires node.js 8 or greater.\n\nFor the client to work properly, you'll need the browser which natively\nsupports:\n\n- [ES2015 modules](https://caniuse.com/#feat=es6-module)\n- [Dynamic import](https://caniuse.com/#feat=es6-module-dynamic-import)\n- `import.meta`\n\n## Command-line\n\n```\nheiss \u003crootDirectory\u003e\n```\n\nStarts a static server, serving the files from `\u003crootDirectory\u003e`. Hot reloading\nwill be available for every `.js` or `.mjs` file (see limitations sections\nabove).\n\nYou can change hostname or port of the server with `--host` and `--port`\narguments respectively.\n\n## HMR API\n\nAPI is served as `/@hmr/api` module. The main function you'll need is `hot`. It\naccepts current module url as a parameter and returns object with the following\nmethods:\n\n- `accept(dependencies: string[], updateCallback)` — called when any of the\n  specified dependencies change. `dependencies` can be either absolute or\n  relative URLs. Inside the `updateCallback` all imports will be already updated\n  to their new values, there is no need to re-import anything:\n\n  ```js\n  import { init } from './init.mjs';\n  import { hot } from '/@hmr/api';\n\n  init();\n\n  hot(import.meta.url).accept(['./init.mjs'], () =\u003e {\n    init();\n  });\n  ```\n\n- `selfAccept()` — marks current-module as self-accepting. In this case, current\n  module will be automatically re-evaluted when it or any of its dependecies\n  change:\n\n  ```js\n  import { init } from './init.mjs';\n  import { hot } from '/@hmr/api';\n\n  init();\n\n  hot(import.meta.url).selfAccept();\n  ```\n\n- `dispose(callback)` — called when current module is about to unload. Can be\n  used for cleaning up any side-effects:\n\n  ```js\n  import { addWidgetToDocument, removeWidgetFromDocument } from './widget.mjs';\n  import { hot } from '/@hmr/api';\n\n  addWidgetToDocument();\n\n  hot(import.meta.url).dispose(() =\u003e removeWidgetFromDocument());\n  ```\n\n## Example in the repo\n\n```\nnpm install\nnpm start\n```\n\nAfter that, open http://localhost:8080 in any supported browser support and edit\n'example/text.mjs'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevinf%2Fheiss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsevinf%2Fheiss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevinf%2Fheiss/lists"}