{"id":15963002,"url":"https://github.com/lovetingyuan/babel-plugin-transform-constant-string","last_synced_at":"2026-05-15T21:34:33.965Z","repository":{"id":96753176,"uuid":"100849528","full_name":"lovetingyuan/babel-plugin-transform-constant-string","owner":"lovetingyuan","description":"transform string constant variable","archived":false,"fork":false,"pushed_at":"2017-08-25T05:16:09.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-09T04:51:59.119Z","etag":null,"topics":["babel","constant","javascript","plugin","string","syntactic-sugar"],"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/lovetingyuan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-08-20T08:53:32.000Z","updated_at":"2017-09-22T02:17:43.000Z","dependencies_parsed_at":"2023-04-01T05:34:10.733Z","dependency_job_id":null,"html_url":"https://github.com/lovetingyuan/babel-plugin-transform-constant-string","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.33333333333333337","last_synced_commit":"5dee7f5a36a3223fb8de60220f02f24810e0e4ed"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lovetingyuan/babel-plugin-transform-constant-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovetingyuan%2Fbabel-plugin-transform-constant-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovetingyuan%2Fbabel-plugin-transform-constant-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovetingyuan%2Fbabel-plugin-transform-constant-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovetingyuan%2Fbabel-plugin-transform-constant-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovetingyuan","download_url":"https://codeload.github.com/lovetingyuan/babel-plugin-transform-constant-string/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovetingyuan%2Fbabel-plugin-transform-constant-string/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267298756,"owners_count":24065889,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","constant","javascript","plugin","string","syntactic-sugar"],"created_at":"2024-10-07T16:22:15.389Z","updated_at":"2026-05-15T21:34:33.908Z","avatar_url":"https://github.com/lovetingyuan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-transform-constant-string\n\ntransform constant string variable\n\n## Example\n\n**In**\n\n```js\nCONSPORT(HELLO_WORLD)\n\nfunction foo() {\n  const bar = 'foo-bar'\n  CONST(THIS_IS_A_CONSTANT_STRING_VALUE)\n  console.log('other code...');\n  CONST(\n    A_FOO,\n    B_BAR,\n    C_FOO_BAR\n  )\n  return bar\n}\n```\n\n**Out**\n\n```js\n\"use strict\";\nexport const HELLO_WORLD = 'HELLO_WORLD';\n\nfunction foo() {\n  const bar = 'foo-bar';\n  const THIS_IS_A_CONSTANT_STRING_VALUE = 'THIS_IS_A_CONSTANT_STRING_VALUE';\n  console.log('other code...');\n  const A_FOO = 'A_FOO';\n  const B_BAR = 'B_BAR';\n  const C_FOO_BAR = 'C_FOO_BAR';\n  return bar;\n}\n// output code\n```\n\n## Installation\n\n```sh\n$ npm install babel-plugin-transform-constant-string\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json5\n{\n  \"plugins\": [\"transform-constant-string\", {\n    \"callName\": \"CONST\" // string, which callee to be transformed, default is \"CONST\",\n    \"exportCallName\": \"CONSPORT\" // string, which will add `export` for the variable, default is \"CONSPORT\"\n  }]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins transform-constant-string script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"transform-constant-string\"]\n});\n```\n\n### license\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovetingyuan%2Fbabel-plugin-transform-constant-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovetingyuan%2Fbabel-plugin-transform-constant-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovetingyuan%2Fbabel-plugin-transform-constant-string/lists"}