{"id":15390525,"url":"https://github.com/kossnocorp/hoc-loader","last_synced_at":"2025-07-16T04:36:37.237Z","repository":{"id":57264747,"uuid":"95915722","full_name":"kossnocorp/hoc-loader","owner":"kossnocorp","description":"Webpack loader that wraps component modules into given HoC","archived":false,"fork":false,"pushed_at":"2018-09-26T10:19:42.000Z","size":2,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-17T01:50:32.365Z","etag":null,"topics":["hoc","preact","react","webpack","webpack-loader"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/kossnocorp.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":"2017-06-30T18:55:20.000Z","updated_at":"2021-01-22T05:45:26.000Z","dependencies_parsed_at":"2022-08-25T02:52:17.706Z","dependency_job_id":null,"html_url":"https://github.com/kossnocorp/hoc-loader","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kossnocorp/hoc-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Fhoc-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Fhoc-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Fhoc-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Fhoc-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kossnocorp","download_url":"https://codeload.github.com/kossnocorp/hoc-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Fhoc-loader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265481916,"owners_count":23773973,"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":["hoc","preact","react","webpack","webpack-loader"],"created_at":"2024-10-01T15:06:28.278Z","updated_at":"2025-07-16T04:36:37.208Z","avatar_url":"https://github.com/kossnocorp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hoc-loader\n\n\u003e **⚠️ Warning**: This loader is tested only with a single loader ([desvg-loader])\nand a simple use case in mind.\n\n**hoc-loader** is a webpack loader that allows to wrap the result of\nthe previous loader in the chain into a high-order component.\n\n## Installation\n\n```bash\nnpm i hoc-loader --save-dev\n# or\nyarn add --dev hoc-loader\n```\n\n## Configuration\n\n```javascript\n// ...\n{\n  test: /\\.svg$/,\n  use: [\n    {\n      loader: 'hoc', // 👈 Add loader\n      options: {\n        // 👇 The path to the HoC file. It must be absolute to the FS root\n        // or relative to the instrumented file.\n        path: '/path/to/Icon/index.jsx',\n\n        // 👇 Depending on how HoC file is built, (e.g. if you use Babel\n        // along with ES Modules) you may need to enable this option,\n        // so the HoC file will be required as `require('path/to/hoc').default`.\n        //\n        // `false` by default\n        useDefault: true,\n\n        // 👇 The name of the export var used by the previous loader.\n        // It depends on the loader, e.g. css-loader exports CSS Modules\n        // into `exports.locals`, while svg-loader uses `module.exports`.\n        //\n        // `module.exports` by default\n        exportVar: 'exports.locals'\n      }\n    },\n    'desvg/react',\n    'svg'\n  ],\n\n  // or if you prefer classic:\n\n  loader: `hoc?useDefault\u0026path=/path/to/Icon/index.jsx!desvg/react\u0026exportVar!svg`\n},\n// ...\n```\n\n## Example\n\nSee a HoC example (in combination with [desvg]):\n\n```js\nimport React from 'react'\nimport { Wrapper } from './style.css'\n\nexport default function (Svg) {\n  return function Icon ({ width = '2rem' }) {\n    return (\n      \u003cdiv style={{ width }}\u003e\n        \u003cSvg fill='currentColor' /\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n```\n\n## License\n\n[MIT © Sasha Koss](https://kossnocorp.mit-license.org/)\n\n[desvg-loader]: https://github.com/kossnocorp/desvg-loader\n[desvg]: https://github.com/kossnocorp/desvg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkossnocorp%2Fhoc-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkossnocorp%2Fhoc-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkossnocorp%2Fhoc-loader/lists"}