{"id":15774500,"url":"https://github.com/passcod/vue-sfc-parser","last_synced_at":"2026-05-03T06:36:16.976Z","repository":{"id":139959890,"uuid":"368478246","full_name":"passcod/vue-sfc-parser","owner":"passcod","description":"A limited parser for Vue Single File Components","archived":false,"fork":false,"pushed_at":"2021-05-18T21:57:06.000Z","size":53,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-04T16:22:10.345Z","etag":null,"topics":["parser","single-file-component","vue"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/passcod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2021-05-18T09:47:40.000Z","updated_at":"2023-10-02T01:58:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"dadce65c-a711-4f1d-b607-f9b9c056334c","html_url":"https://github.com/passcod/vue-sfc-parser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/passcod/vue-sfc-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passcod%2Fvue-sfc-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passcod%2Fvue-sfc-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passcod%2Fvue-sfc-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passcod%2Fvue-sfc-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/passcod","download_url":"https://codeload.github.com/passcod/vue-sfc-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passcod%2Fvue-sfc-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32560854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T03:21:47.309Z","status":"ssl_error","status_checked_at":"2026-05-03T03:21:43.884Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["parser","single-file-component","vue"],"created_at":"2024-10-04T16:22:01.913Z","updated_at":"2026-05-03T06:36:16.960Z","avatar_url":"https://github.com/passcod.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI status](https://github.com/passcod/vue-sfc-parser/actions/workflows/check.yml/badge.svg)](https://github.com/passcod/vue-sfc-parser/actions/workflows/check.yml)\n[![Uses Caretaker Maintainership](https://flat.badgen.net/badge/Caretaker/Maintainership%20👥%20/purple)][caretaker]\n\nVue SFC Parser\n==============\n\n- [Dual-licensed][copyright] with Apache 2.0 and MIT.\n- Uses [Caretaker Maintainership][caretaker].\n- Zero dependencies, 2KB minified, \u003c1KB gzipped.\n\n[caretaker]: ./CARETAKERS.md\n[copyright]: ./COPYRIGHT\n\nParses a Vue-style Single File Component in a limited fashion for further\npost-processing, with no dependencies, suitable for use in a Service Worker\nor other such constrained environment.\n\nParses only the top-level tags and provides their content as strings. Does\nnot prescribe any set of top-level tags, it will just parse everything. Also\nsupports HTML comments. Has some support for attributes on top-level tags,\nsuch as for `\u003cstyle scoped\u003e` and `\u003cscript type=\"text/typescript\"\u003e`. Supports\nnested `\u003ctemplate\u003e` tags (it will leave interior ones as string content but it\ninternally keeps track for proper parsing).\n\nDoes not support the string `\u003c/script\u003e` inside a script tag, and similarly\nfor other tags. Just break it up e.g. `\"\u003c\" + \"/script\u003e\"` if you need to.\n\n\nInstall\n-------\n\n- Via npm: `npm i https://github.com/passcod/vue-sfc-parser`.\n- From the [latest release](https://github.com/passcod/vue-sfc-parser/releases).\n- Or copy the relevant file(s) from the [`dist/`](./dist) folder.\n\n\nUse\n---\n\n```js\n// either\nimport parseSfc from '/path/to/sfc-parser.mjs';\n// or\nimport parseSfc from '/path/to/sfc-parser.js';\n// or\nimport parseSfc from 'vue-sfc-parser';\n// or\nrequire('sfc-parser.umd.min.js', (parser) =\u003e { ... });\n// etc\n```\n\n```js\nconst file = `\n\u003ctemplate\u003e\n    \u003cdiv\u003eHello {{ name }}\u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nexport default {\n    data () {\n        return {\n            name: 'World',\n        };\n    },\n}\n\u003c/script\u003e\n\n\u003cstyle\u003e\ndiv {\n    font-weight: 500;\n    text-decoration: overline red 2px;\n}\n\u003c/style\u003e\n`;\n\n// throws on parse errors\nconst sfc = parseSfc(file);\n\nassertEq(sfc.length, 3);\nassertEq(sfc[0].tag, 'template');\nassert(sfc[2].content.contains('overline'));\n// or something more useful\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpasscod%2Fvue-sfc-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpasscod%2Fvue-sfc-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpasscod%2Fvue-sfc-parser/lists"}