{"id":15412547,"url":"https://github.com/elmassimo/vite-plugin-manifest-sri","last_synced_at":"2025-04-15T21:17:27.014Z","repository":{"id":57393130,"uuid":"449417778","full_name":"ElMassimo/vite-plugin-manifest-sri","owner":"ElMassimo","description":"Subresource Integrity for Vite.js manifest files","archived":false,"fork":false,"pushed_at":"2023-11-30T15:51:38.000Z","size":105,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T21:17:13.282Z","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/ElMassimo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2022-01-18T19:23:03.000Z","updated_at":"2025-03-11T03:27:38.000Z","dependencies_parsed_at":"2024-02-24T23:32:39.569Z","dependency_job_id":null,"html_url":"https://github.com/ElMassimo/vite-plugin-manifest-sri","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"cc48346e294ac76d9a58ba370c84790cb84885f7"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-manifest-sri","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-manifest-sri/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-manifest-sri/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-manifest-sri/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElMassimo","download_url":"https://codeload.github.com/ElMassimo/vite-plugin-manifest-sri/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153953,"owners_count":21221330,"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-10-01T16:53:41.659Z","updated_at":"2025-04-15T21:17:26.990Z","avatar_url":"https://github.com/ElMassimo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2 align='center'\u003e\n  \u003csamp\u003evite-plugin-manifest-sri\u003c/samp\u003e\n\u003c/h2\u003e\n\n\u003cp align='center'\u003eSubresource Integrity for Vite.js Manifests\u003c/p\u003e\n\n\u003cp align='center'\u003e\n  \u003ca href='https://www.npmjs.com/package/vite-plugin-manifest-sri'\u003e\n    \u003cimg src='https://img.shields.io/npm/v/vite-plugin-manifest-sri?color=222\u0026style=flat-square'\u003e\n  \u003c/a\u003e\n  \u003ca href='https://github.com/ElMassimo/vite-plugin-manifest-sri/blob/main/LICENSE.txt'\u003e\n    \u003cimg src='https://img.shields.io/badge/license-MIT-blue.svg'\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n[Vite]: https://vitejs.dev/\n[Vite Ruby]: https://github.com/ElMassimo/vite_ruby\n[SRI]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity\n[manifest]: https://vitejs.dev/guide/backend-integration.html#backend-integration\n\n[rollup-plugin-sri]: https://github.com/JonasKruckenberg/rollup-plugin-sri\n[vite-plugin-sri]: https://github.com/small-tech/vite-plugin-sri\n[manifest]: https://vitejs.dev/guide/backend-integration.html\n[rendering]: https://vite-ruby.netlify.app/overview.html#in-production\n\n## Why? 🤔\n\n[Vite] does [not provide support](https://github.com/vitejs/vite/issues/2377) for [subresource integrity][sri].\n\nBoth \u003ckbd\u003e[vite-plugin-sri]\u003c/kbd\u003e and \u003ckbd\u003e[rollup-plugin-sri]\u003c/kbd\u003e are good\noptions to automatically add an [`integrity`][sri] hash to script and link tags. However, these rely on transforming an HTML file, which is typically not the case when using a backend integration such as [Vite Ruby].\n\nThis plugin extends [`manifest.json`][manifest] to include an [`integrity`][sri] field which can be used when [rendering] tags.\n\n## Installation 💿\n\nInstall the package as a development dependency:\n\n```bash\nnpm i -D vite-plugin-manifest-sri # pnpm i -D vite-plugin-manifest-sri\n```\n\n## Usage 🚀\n\nAdd it to your plugins in `vite.config.ts`:\n\n```ts\nimport { defineConfig } from 'vite'\nimport manifestSRI from 'vite-plugin-manifest-sri'\n\nexport default defineConfig({\n  plugins: [\n    manifestSRI(),\n  ],\n})\n```\n\nNote that the [`build.manifest`](https://vitejs.dev/config/#build-manifest) option\nmust be enabled in order to generate a `manifest.json` file ([Vite Ruby] enables it by default).\n\n### With [Vite Ruby] 💎\n\nExperimental support is [available](https://github.com/ElMassimo/vite_ruby/issues/176#issuecomment-1015920689), you can try it now by explicitly adding `4.0.0.alpha1` to your `Gemfile`:\n\n```ruby\ngem 'vite_rails', '~\u003e 4.0.0.alpha1'\n```\n\n## Configuration ⚙️\n\nThe following options can be provided:\n\n- \u003ckbd\u003ealgorithms\u003c/kbd\u003e\n  \n  Hashing algorithms to use when calculate the integrity hash for each asset.\n\n  __Default:__ `['sha384']`\n\n  ``` js\n  manifestSRI({ algorithms: ['sha384', 'sha512'] }),\n  ``` \n\n## Acknowledgements\n\nThe following plugins might be useful for Vite apps based around an `index.html` file:\n\n- [`rollup-plugin-sri`](https://github.com/JonasKruckenberg/rollup-plugin-sri)\n- [`vite-plugin-sri`](https://github.com/small-tech/vite-plugin-sri)\n\n## License\n\nThis library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmassimo%2Fvite-plugin-manifest-sri","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felmassimo%2Fvite-plugin-manifest-sri","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmassimo%2Fvite-plugin-manifest-sri/lists"}