{"id":13739498,"url":"https://github.com/hustcc/babel-plugin-version","last_synced_at":"2026-03-10T17:07:00.338Z","repository":{"id":66093470,"uuid":"157795969","full_name":"hustcc/babel-plugin-version","owner":"hustcc","description":":label: babel plugin replace define identifier `__VERSION__` to pkg.version!","archived":false,"fork":false,"pushed_at":"2019-01-19T03:14:51.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T17:23:18.631Z","etag":null,"topics":["babel","babel-plugin","version"],"latest_commit_sha":null,"homepage":"","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/hustcc.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}},"created_at":"2018-11-16T01:36:11.000Z","updated_at":"2022-11-20T22:28:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"c4f6bfe2-924b-4658-99a7-62161c4c74ec","html_url":"https://github.com/hustcc/babel-plugin-version","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hustcc/babel-plugin-version","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fbabel-plugin-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fbabel-plugin-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fbabel-plugin-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fbabel-plugin-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hustcc","download_url":"https://codeload.github.com/hustcc/babel-plugin-version/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fbabel-plugin-version/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30343900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["babel","babel-plugin","version"],"created_at":"2024-08-03T04:00:34.551Z","updated_at":"2026-03-10T17:07:00.310Z","avatar_url":"https://github.com/hustcc.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["General Plugins"],"readme":"# babel-plugin-version\n\nA babel plugin replace define Identifier / StringLiteral to pkg.version!\n\n[![npm](https://img.shields.io/npm/v/babel-plugin-version.svg)](https://www.npmjs.com/package/babel-plugin-version)\n[![npm](https://img.shields.io/npm/dm/babel-plugin-version.svg)](https://www.npmjs.com/package/babel-plugin-version)\n\n\n## Install\n\n\n\u003e npm i --save-dev babel-plugin-version\n\n\n\n## Usage\n\n\nAdd it into `.babelrc`.\n\n```json\n{\n  \"plugins\": [\n    \"version\"\n  ]\n}\n```\n\n\n\n## Result\n\n\n - Input\n\n```js\nconst a = { a: __VERSION__ };\n\nconst b = a === __VERSION__;\n\nconst c = [__VERSION__];\n\nconst d =__VERSION__ = 1;\n\nconst e = \"__VERSION__\";\n```\n\n - Output\n\n```js\nconst a = { a: \"0.1.0\" };\n\nconst b = a === \"0.1.0\";\n\nconst c = [\"0.1.0\"];\n\nconst d = __VERSION__ = 1;\n\nconst e = \"0.1.0\";\n```\n\n\n\n## Configure\n\n\nYou can customize the default `__VERSION__` define.\n\n```json\n{\n  \"plugins\": [\n    [\"version\", {\n      \"define\": \"__PKG_VERSION__\",\n      \"identifier\": false,\n      \"stringLiteral\": true \n     }]\n  ]\n}\n```\n\n - **define**, `string`. Default `__VERSION__`. Define the keyword string which will be transformed.\n - **identifier**, `boolean`. Default `true`. Whether transform identifier which's name is equal `define` string.\n - **stringLiteral**, `boolean`. Default `true`. Whether transform string variable which is equal `define` string.\n\n\n\n## Test\n\n\n```\nnpm i\n\nnpm t\n```\n\nThen see the files in `lib` dir.\n\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Fbabel-plugin-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhustcc%2Fbabel-plugin-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Fbabel-plugin-version/lists"}