{"id":17242799,"url":"https://github.com/imcuttle/hot-module-require","last_synced_at":"2025-10-20T05:28:18.917Z","repository":{"id":32436752,"uuid":"133625710","full_name":"imcuttle/hot-module-require","owner":"imcuttle","description":"Hot modules require like HMR(webpack)","archived":false,"fork":false,"pushed_at":"2023-02-17T09:42:29.000Z","size":2470,"stargazers_count":12,"open_issues_count":20,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T02:34:01.481Z","etag":null,"topics":["hot-module-replacement","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/imcuttle.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":"2018-05-16T07:14:31.000Z","updated_at":"2024-12-26T14:11:13.000Z","dependencies_parsed_at":"2024-06-19T06:16:31.402Z","dependency_job_id":"242f7ec1-fa8f-4c92-b935-f7c60ad58577","html_url":"https://github.com/imcuttle/hot-module-require","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":"0.19148936170212771","last_synced_commit":"3a9ecd862ea18abdff6577ab0c390631ed5951d4"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fhot-module-require","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fhot-module-require/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fhot-module-require/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fhot-module-require/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imcuttle","download_url":"https://codeload.github.com/imcuttle/hot-module-require/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248814737,"owners_count":21165817,"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":["hot-module-replacement","nodejs"],"created_at":"2024-10-15T06:14:05.926Z","updated_at":"2025-10-20T05:28:18.824Z","avatar_url":"https://github.com/imcuttle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hot-module-require\n\n\u003c!--[![build status](https://img.shields.io/travis/imcuttle/hot-module-require/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/hot-module-require)--\u003e\n\n\u003c!--[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/hot-module-require.svg?style=flat-square)](https://codecov.io/github/imcuttle/hot-module-require?branch=master)--\u003e\n\n[![NPM version](https://img.shields.io/npm/v/hot-module-require.svg?style=flat-square)](https://www.npmjs.com/package/hot-module-require)\n[![NPM Downloads](https://img.shields.io/npm/dm/hot-module-require.svg?style=flat-square\u0026maxAge=43200)](https://www.npmjs.com/package/hot-module-require)\n\nDetect module's update recursively on nodejs.\n\n## Usage\n\n```javascript\n// module.js\nmodule.exports = require('./foo') + require('./bar')\n```\n\n```javascript\nconst makeHotRequire = require('hot-module-require')\nconst hotRequire = makeHotRequire(__dirname)\n\nlet mExports = require('./module')\n\nhotRequire.accept(['./module'], (oldModule, path) =\u003e {\n  // Do something here \n  // when './module' module or submodules('./foo', './bar'') be detected changed.\n  let newExports = require('./module') \n})\n\n\n// Or use it like follows\nconst hotModuleGetter = hotRequire('./module')\nhotModuleGetter() // Returns the already updated `require('./module')``\n\nhotModuleGetter.remove() // Calls `remove` for interrupting detect updated \n```\n\n## [Express Example](./example/express-hot/index.js)\n\n```bash\nnpm run example\n```\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### makeHotRequireFunction\n\n[index.js:52-373](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L52-L373 \"Source code on GitHub\")\n\n-   **See: More options see [detect-dep](https://github.com/imcuttle/detect-dep)**\n\nmake a hot require instance\n\n#### Parameters\n\n-   `dirname`   (optional, default `''`)\n-   `presetOpts`  {{}} (optional, default `{}`)\n    -   `presetOpts.recursive`  {boolean} Analysis file recursively (optional, default `true`)\n\nReturns **[HotRequire](#hotrequire)** \n\n### HotRequire\n\n[index.js:173-184](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L173-L184 \"Source code on GitHub\")\n\n### resolve\n\n[index.js:256-256](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L256-L256 \"Source code on GitHub\")\n\nResolve file name\n\n#### Parameters\n\n-   `name`  {string}\n\n### watcher\n\n[index.js:263-263](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L263-L263 \"Source code on GitHub\")\n\n-   **See: [chokidar](https://npmjs.com/chokidar)**\n\nfile Watcher\n\n### emitter\n\n[index.js:269-269](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L269-L269 \"Source code on GitHub\")\n\nThe event emitter\n\n### dependent\n\n[index.js:276-276](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L276-L276 \"Source code on GitHub\")\n\nThe map about dependent relations\n\nType: [Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)\n\n### dependence\n\n[index.js:283-283](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L283-L283 \"Source code on GitHub\")\n\nThe map about dependence relations\n\nType: [Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)\n\n### getDependenceTree\n\n[index.js:293-293](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L293-L293 \"Source code on GitHub\")\n\n-   **See: \u003chttps://github.com/imcuttle/detect-dep#tree\u003e**\n\nGet dependence tree of which file\n\n#### Parameters\n\n-   `modulePath`  {string}\n-   `opts`  \n\nReturns **{}** \n\n### addDependencies\n\n[index.js:303-303](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L303-L303 \"Source code on GitHub\")\n\nAdd Dependencies\n\n#### Parameters\n\n-   `modulePath`  {string}\n-   `deps`  {string\\[]}\n\n### removeDependencies\n\n[index.js:311-311](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L311-L311 \"Source code on GitHub\")\n\nRemove Dependencies\n\n#### Parameters\n\n-   `modulePath`  {string}\n-   `deps`  {string\\[]}\n\n### accept\n\n[index.js:320-331](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L320-L331 \"Source code on GitHub\")\n\nWatch file with callback and make dependence(dependent) relations\n\n#### Parameters\n\n-   `deps`  {string\\[]}\n-   `callback`  {function}\n\n### refuse\n\n[index.js:339-361](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L339-L361 \"Source code on GitHub\")\n\nWatch file with callback and make dependence(dependent) relations\n\n#### Parameters\n\n-   `deps`  {string\\[]}\n-   `callback`  {function}\n\n### close\n\n[index.js:368-370](https://github.com/imcuttle/hot-module-require/blob/2e3792c30be25d7ebbf83177f08d3506b4749575/index.js#L368-L370 \"Source code on GitHub\")\n\nClose file watcher\n\nReturns **any** void\n\n## Related\n\n-   [detect-dep](https://github.com/imcuttle/detect-dep) - Detect file's dependencies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Fhot-module-require","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimcuttle%2Fhot-module-require","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Fhot-module-require/lists"}