{"id":41893633,"url":"https://github.com/epeejs/babel-plugin-taro-page-hoc","last_synced_at":"2026-01-25T14:14:55.075Z","repository":{"id":64031331,"uuid":"571997319","full_name":"epeejs/babel-plugin-taro-page-hoc","owner":"epeejs","description":"编译时添加自定义 HOC 包裹 Taro 页面组件","archived":false,"fork":false,"pushed_at":"2023-02-06T03:23:59.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-18T09:13:29.408Z","etag":null,"topics":["babel-plugin","hoc","react","tarojs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/epeejs.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}},"created_at":"2022-11-29T10:41:33.000Z","updated_at":"2022-12-05T15:25:17.000Z","dependencies_parsed_at":"2023-02-19T04:00:27.562Z","dependency_job_id":null,"html_url":"https://github.com/epeejs/babel-plugin-taro-page-hoc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/epeejs/babel-plugin-taro-page-hoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epeejs%2Fbabel-plugin-taro-page-hoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epeejs%2Fbabel-plugin-taro-page-hoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epeejs%2Fbabel-plugin-taro-page-hoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epeejs%2Fbabel-plugin-taro-page-hoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epeejs","download_url":"https://codeload.github.com/epeejs/babel-plugin-taro-page-hoc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epeejs%2Fbabel-plugin-taro-page-hoc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["babel-plugin","hoc","react","tarojs"],"created_at":"2026-01-25T14:14:54.637Z","updated_at":"2026-01-25T14:14:55.059Z","avatar_url":"https://github.com/epeejs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-taro-page-hoc\n\n用于编译时给 Taro 页面包裹自定义高阶组件，实现页面渲染前置逻辑添加\n\n例如自动登录等异步操作，解决入口组件（app.tsx）不能阻止子元素（this.props.children）渲染问题\n\n```ts\n// 例如页面 HomePage\nimport Taro from '@tarojs/taro';\n\nconst HomePage: Taro.FC\u003cHomePageProps\u003e = () =\u003e {\n  return \u003cdiv\u003e\u003c/div\u003e;\n};\n\nexport default HomePage;\n\n// 应用插件配置\n// [\"babel-plugin-taro-page-hoc\", { \"hocSource\": \"src/hoc\" }]\n// 输出\n\n⬇️     ⬇️     ⬇️\nimport __hoc__ from 'src/hoc';\nexport default __hoc__(HomePage);\n```\n\n详细介绍文档 [如何解决 Taro 页面无法异步渲染问题](https://github.com/epeejs/daydayup/blob/main/docs/zjw/babel-plugin-taro-page-hoc.md)\n\n## 安装\n\n```sh\nyarn add -D babel-plugin-taro-page-hoc\n```\n\n## 使用\n\n.babelrc\n\n```json\n{\n  \"plugins\": [\n    [\n      \"babel-plugin-taro-page-hoc\",\n      {\n        \"hocSource\": \"./src/hoc\", // hoc 导入源，必填，为空时不执行转换\n        \"hocName\": \"__hoc__\" // 自定义 hoc 函数名，默认 __hoc__\n      }\n    ]\n  ]\n}\n```\n\n## 部分页面排除转换\n\n默认转换所有页面，如果部分页面不需要添加 hoc，可以通过在导出组件上添加注释 `@nohoc`\n\n```ts\n// @nohoc\nexport default HomePage;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepeejs%2Fbabel-plugin-taro-page-hoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepeejs%2Fbabel-plugin-taro-page-hoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepeejs%2Fbabel-plugin-taro-page-hoc/lists"}