{"id":15195309,"url":"https://github.com/runmaxde/vite-plugin-singlefile-escaped","last_synced_at":"2026-03-04T18:03:15.000Z","repository":{"id":222270371,"uuid":"756749432","full_name":"runmaxde/vite-plugin-singlefile-escaped","owner":"runmaxde","description":"Escape the output of vite-plugin-singlefile and optionally wrap it with custom strings","archived":false,"fork":false,"pushed_at":"2024-04-02T07:19:21.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-28T09:16:23.795Z","etag":null,"topics":["react","vite","vite-plugin","vitejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vite-plugin-singlefile-escaped","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/runmaxde.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-02-13T08:33:11.000Z","updated_at":"2025-08-26T10:00:59.000Z","dependencies_parsed_at":"2024-04-02T07:48:14.939Z","dependency_job_id":null,"html_url":"https://github.com/runmaxde/vite-plugin-singlefile-escaped","commit_stats":null,"previous_names":["runmaxde/vite-plugin-singlefile-escaped"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/runmaxde/vite-plugin-singlefile-escaped","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runmaxde%2Fvite-plugin-singlefile-escaped","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runmaxde%2Fvite-plugin-singlefile-escaped/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runmaxde%2Fvite-plugin-singlefile-escaped/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runmaxde%2Fvite-plugin-singlefile-escaped/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runmaxde","download_url":"https://codeload.github.com/runmaxde/vite-plugin-singlefile-escaped/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runmaxde%2Fvite-plugin-singlefile-escaped/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30088341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"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":["react","vite","vite-plugin","vitejs"],"created_at":"2024-09-27T23:21:23.464Z","updated_at":"2026-03-04T18:03:14.960Z","avatar_url":"https://github.com/runmaxde.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/runmaxde/vite-plugin-singlefile-escaped/assets/41482988/9a8a6682-621d-42c6-98e2-91e001fdfb14\" height=\"128\" /\u003e\n  \u003ch1\u003eSingleFile Escaped 📦🧣  \u003cimg alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dy/vite-plugin-singlefile-escaped\"\u003e\u003c/h1\u003e\n  \u003ch3\u003e\u003ca href=\"https://vitejs.dev/guide/using-plugins\"\u003eVite Plugin\u003c/a\u003e to export code as escaped text after bundling (\u003ca href=\"https://www.npmjs.com/package/vite-plugin-singlefile\"\u003esinglefile\u003c/a\u003e)\u003c/h3\u003e\n  \u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\u003c/div\u003e\n\n\n# vite-plugin-singlefile-escaped\n\nThis Vite plugin allows you to escape the output of `vite-plugin-singlefile` and optionally wrap it with custom strings before and after. It uses `jsesc` to escape the content, making it safe for embedding in specific environments or as part of a larger string.\n\n## Installation\n\n```bash\nnpm install vite-plugin-singlefile-escaped --save-dev\n```\n\nor if you prefer using Yarn:\n\n```bash\nyarn add vite-plugin-singlefile-escaped --dev\n```\n\n## Usage\n\nTo use `vite-plugin-singlefile-escaped` in your Vite project, import it into your `vite.config.js` or `vite.config.ts` and add it to the `plugins` array. You also need to have `vite-plugin-singlefile` installed and configured, as this plugin works on its output.\n\n```js\n// vite.config.js\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\nimport viteSingleFileEscaped from \"vite-plugin-singlefile-escaped\";\n\nexport default {\n  plugins: [\n    viteSingleFile(),\n    viteSingleFileEscaped()\n  ],\n};\n```\n\n## Configuration\n\n`viteSingleFileEscaped` accepts two optional parameters to customize the wrapping of the escaped content and an optional posibility of a configuration for more precise escaping\n\n```js\nfunction viteSingleFileEscaped(wrapBefore: string, wrapAfter: string, config: object): void\n```\n\n- wrapBefore: A string to prepend before the escaped content.\n- wrapAfter: A string to append after the escaped content.\n- config: A destructured object that allows to add special configurations [Jsesc Docs](https://www.npmjs.com/package/jsesc)\n\nIf not provided, these parameters default to an empty string, meaning no wrapping will be applied beyond escaping the content.\nExample\n\nHere is an example configuration that escapes the entire output of your single-file bundle and wraps it in a JavaScript log function:\n\n```js\n// vite.config.js\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\nimport viteSingleFileEscaped from \"vite-plugin-singlefile-escaped\";\n\nexport default {\n  plugins: [\n    viteSingleFile(),\n    viteSingleFileEscaped('console.log(\"', \");\", { quotes: \"double\" }),\n  ],\n};\n```\n\n```js\n// dist/index.html\nconsole.log(\"\u003cESCAPED_CODE_PLACEHOLDER\u003e\");\n```\n\nThis setup escapes the single-file output and wraps it with `console.log(\"` at the beginning and `\");` at the end, making it ready to be logged directly to the console as part of a larger script or debugging tool.\n\n## License\n\nThis plugin is open-sourced software licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunmaxde%2Fvite-plugin-singlefile-escaped","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunmaxde%2Fvite-plugin-singlefile-escaped","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunmaxde%2Fvite-plugin-singlefile-escaped/lists"}