{"id":13774952,"url":"https://github.com/phamann/rollup-plugin-hash","last_synced_at":"2025-03-16T15:33:11.592Z","repository":{"id":57158241,"uuid":"79488276","full_name":"phamann/rollup-plugin-hash","owner":"phamann","description":"Rollup plugin to compose bundle output filenames with unique hashes","archived":false,"fork":false,"pushed_at":"2020-03-16T16:16:18.000Z","size":35,"stargazers_count":47,"open_issues_count":8,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-14T14:22:22.576Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/phamann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-19T19:40:59.000Z","updated_at":"2024-02-09T11:10:02.000Z","dependencies_parsed_at":"2022-09-03T18:51:11.455Z","dependency_job_id":null,"html_url":"https://github.com/phamann/rollup-plugin-hash","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamann%2Frollup-plugin-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamann%2Frollup-plugin-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamann%2Frollup-plugin-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamann%2Frollup-plugin-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phamann","download_url":"https://codeload.github.com/phamann/rollup-plugin-hash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665591,"owners_count":16860286,"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-08-03T17:01:32.138Z","updated_at":"2024-10-27T10:51:41.279Z","avatar_url":"https://github.com/phamann.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Output"],"readme":"# rollup-plugin-hash [![Travis Build Status][travis-img]][travis]\n\n[travis-img]: https://travis-ci.org/phamann/rollup-plugin-hash.svg\n[travis]: https://travis-ci.org/phamann/rollup-plugin-hash\n[rollup]: https://github.com/rollup/rollup\n\n[Rollup] plugin to compose bundle output filenames with unique hashes, to facilitate long-term caching of your static resources.\n\nIt uses is simple placeholder pattern to substitue filename with bundle hash. I.e.\n```\nmain.[hash].js\n```\nbecomes:\n```\nmain.07d2bf0d12655d9f51c0637718da4889.js\n```\n\n## Install\n\nvia npm:\n```sh\nnpm install --save-dev rollup-plugin-hash\n```\n\nvia yarn:\n```sh\nyarn add --dev rollup-plugin-hash\n```\n\n## Usage\n\n```js\nimport { rollup } from 'rollup';\nimport hash from 'rollup-plugin-hash';\n\nrollup({\n    entry: 'main.js',\n    plugins: [\n        hash({ \n\t\t\tdest: 'main.[hash].js'\t\n\t\t})\n    ]\n});\n```\n\nMeanwhile, if dest filename is written the following way, only first 4 characters of hash will\nbe used in final filename: `main.[hash:4].js`. You could change this number to modify the\noutput result.\n\n## Options\n\n### dest\n\nType: `string`\nRequired: `true`\n\nThe template of your filename destination. Must include the placeholder `[hash]` to be replaced.\n\n### replace\n\nType: `boolean`\nDefault: `false`\nRequired: `false`\n\nWhether the hashed version should replace the main output file generated by Rollup. \nUseful in CI environments where you don't need any non-hashed assets.\n\n### algorithm\n\nType: `string`\nDefault: `sha1`\nRequired: `true`\n\nHashing algorithm used to generate hash. Can be one of `md5`, `sha1`, `sha256`, `sha512`\n\n### manifest\n\nType: `string`\nRequired: `false`\n\nFilename to write a manifest to. Will generate a JSON manifest mapping input filename to hashed output filename. \nUseful if you want to dynamically generate link to your hashed output server-side.\n\nExample manifest:\n```json\n{\n\t\"main.js\": \"main.56770a64be1a1132502b276c4132a76bb94d9e1b.js\"\n}\n```\n\n### manifestKey\n\nType: `string`\nDefault: `bundle.dest`\nRequired: `false`\n\nThe filename used as the input key in the generated manifest map. \nUseful in certain build setups where `path.resolve` is needed as `bundle.dest` but not in the manifest.\n\n### callback\n\nType: `function`\nRequired: `false`\n\nCallback which is called with the resulting hashed filename. This is useful if you are integrating with other build steps and want to store the filename locally to be used in subsequent configs etc.\n\n# License\n\nMIT ©\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphamann%2Frollup-plugin-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphamann%2Frollup-plugin-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphamann%2Frollup-plugin-hash/lists"}