{"id":13607890,"url":"https://github.com/sullay/vite-manifest-parser","last_synced_at":"2025-06-24T10:12:35.742Z","repository":{"id":216093484,"uuid":"740446638","full_name":"sullay/vite-manifest-parser","owner":"sullay","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-12T02:17:51.000Z","size":8,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T15:14:39.279Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sullay.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-08T11:12:52.000Z","updated_at":"2024-11-18T15:46:22.000Z","dependencies_parsed_at":"2024-01-08T13:35:23.976Z","dependency_job_id":"fa72d77a-cf80-4706-ae03-5730e1db0a56","html_url":"https://github.com/sullay/vite-manifest-parser","commit_stats":null,"previous_names":["sullay/vite-manifest-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sullay/vite-manifest-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sullay%2Fvite-manifest-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sullay%2Fvite-manifest-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sullay%2Fvite-manifest-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sullay%2Fvite-manifest-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sullay","download_url":"https://codeload.github.com/sullay/vite-manifest-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sullay%2Fvite-manifest-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261504892,"owners_count":23168921,"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-01T19:01:22.547Z","updated_at":"2025-06-24T10:12:35.698Z","avatar_url":"https://github.com/sullay.png","language":"TypeScript","funding_links":[],"categories":["Integrations with Backends"],"sub_categories":["Node.js"],"readme":"# Vite Manifest Parser\n\nThis library provides a simple way to parse a `manifest.json` file generated by Vite and render corresponding HTML code blocks for easy backend integration. It is particularly useful for projects where the frontend is managed by Vite and the backend requires integration of the generated assets.\n\n## Features\n\n- Parses `manifest.json` to generate HTML script and link tags.\n- Supports both development and production environments.\n- Handles legacy browser scripts and polyfill loading.\n\n## Installation\n\nTo install `vite-manifest-parser`, run the following command:\n\n```bash\nnpm install vite-manifest-parser --save\n```\n\n## Usage\n\nTo use the parser, you need to import the `parser` function from the package and call it with the appropriate parameters.\n\n```typescript\nimport { parser } from 'vite-manifest-parser';\n\nconst input = 'src/app/main.ts'; // Your entry file\nconst outDir = '/absolute/path/to/dist'; // Your build directory\nconst publicPath = '/public/dist/'; // Public path to your assets\nconst isDev = process.env.NODE_ENV !== 'production'; // Determine the environment\n\nconst { preload, css, js } = await parser({ input, outDir, publicPath, isDev });\n\n```\n\nFor template usage, such as rendering with EJS templates.\n``` html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003evite-manifest-parser\u003c/title\u003e\n    \u003c%-preload%\u003e\n    \u003c%-css%\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"app\"\u003e\u003c/div\u003e\n    \u003c%-js%\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n## API\n`parser(options)`\n- `options.input` - The entry file, which is the relative path in the client project (the key value in the manifest.json).\n- `options.outDir` - The build directory, please use an absolute path.\n- `options.publicPath` - The resource path, such as /public/dist/ or https://static.example.com/. The default value is '/'.\n- `options.isDev` - Indicates whether it is a development environment. If true, it will not parse manifest.json and will use Vite's development server.\n\n## Development\nTo contribute to the library or run it locally for development, you will need to clone the repository and install its dependencies.\n\n``` bash\ngit clone https://github.com/your-username/vite-manifest-parser.git\ncd vite-manifest-parser\npnpm install\n```\n\nMake sure to write tests for new features or bug fixes and run the tests to ensure everything is working correctly.\n\n``` bash\nnpm test\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsullay%2Fvite-manifest-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsullay%2Fvite-manifest-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsullay%2Fvite-manifest-parser/lists"}