{"id":18262869,"url":"https://github.com/midwayjs/module-hook","last_synced_at":"2025-04-04T20:30:57.523Z","repository":{"id":28071868,"uuid":"111528784","full_name":"midwayjs/module-hook","owner":"midwayjs","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-04T05:49:02.000Z","size":32,"stargazers_count":9,"open_issues_count":3,"forks_count":3,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-04-24T14:29:36.423Z","etag":null,"topics":[],"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/midwayjs.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}},"created_at":"2017-11-21T09:40:14.000Z","updated_at":"2022-11-09T05:44:06.000Z","dependencies_parsed_at":"2022-07-27T12:15:16.918Z","dependency_job_id":null,"html_url":"https://github.com/midwayjs/module-hook","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmodule-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmodule-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmodule-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmodule-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midwayjs","download_url":"https://codeload.github.com/midwayjs/module-hook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247246197,"owners_count":20907751,"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":[],"created_at":"2024-11-05T11:09:05.801Z","updated_at":"2025-04-04T20:30:54.653Z","avatar_url":"https://github.com/midwayjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# module-hook\n\n在指定名称及版本的模块被加载前执行指定的操作，方便对模块进行修改或源码替换。\n\n## Installation\n\n```bash\n$ npm install module-hook --save\n```\n\n## Usage\n\n```javascript\nimport { hook } from 'module-hook';\n\nhook('debug', '^3.x', (loadModule, replaceSource, version) =\u003e {\n  // loadModule: 加载模块下的文件\n  // replaceSource(file, replacer): 覆盖指定文件源码\n  //   replacer(source): replacer 可以是文件地址或者函数，函数参数如上所述\n  // version: 当前加载的模块版本\n});\n```\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidwayjs%2Fmodule-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidwayjs%2Fmodule-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidwayjs%2Fmodule-hook/lists"}