{"id":29190870,"url":"https://github.com/jean-smaug/babel-plugin-search-and-replace","last_synced_at":"2026-03-06T02:12:55.050Z","repository":{"id":26486678,"uuid":"109182075","full_name":"jean-smaug/babel-plugin-search-and-replace","owner":"jean-smaug","description":"A small babel plugin to search strings and replace them","archived":false,"fork":false,"pushed_at":"2023-10-18T04:09:58.000Z","size":346,"stargazers_count":28,"open_issues_count":3,"forks_count":6,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-28T08:28:47.190Z","etag":null,"topics":["babel","babel-plugin","search-and-replace"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/babel-plugin-search-and-replace","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/jean-smaug.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":"2017-11-01T20:44:46.000Z","updated_at":"2025-04-01T23:27:52.000Z","dependencies_parsed_at":"2024-06-18T15:21:09.459Z","dependency_job_id":"0d536785-b21d-4953-8985-9ef7d92435ec","html_url":"https://github.com/jean-smaug/babel-plugin-search-and-replace","commit_stats":{"total_commits":40,"total_committers":6,"mean_commits":6.666666666666667,"dds":0.475,"last_synced_commit":"9b8222b18717242760fe2b374598d325ae307387"},"previous_names":["the-smaug/babel-plugin-search-and-replace"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jean-smaug/babel-plugin-search-and-replace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-smaug%2Fbabel-plugin-search-and-replace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-smaug%2Fbabel-plugin-search-and-replace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-smaug%2Fbabel-plugin-search-and-replace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-smaug%2Fbabel-plugin-search-and-replace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jean-smaug","download_url":"https://codeload.github.com/jean-smaug/babel-plugin-search-and-replace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-smaug%2Fbabel-plugin-search-and-replace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30159031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"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","babel-plugin","search-and-replace"],"created_at":"2025-07-02T00:12:11.258Z","updated_at":"2026-03-06T02:12:55.018Z","avatar_url":"https://github.com/jean-smaug.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-search-and-replace\n\n## What it does\n\nIt replaces specified string literals\n\n## Install\n\n- `yarn add babel-plugin-search-and-replace`\n- `npm i babel-plugin-search-and-replace`\n- `pnpm add babel-plugin-search-and-replace`\n\n## How to use it\n\nAdd the following lines in your .babelrc.\n\n```json\n{\n  \"plugins\": [\n    [\n      \"search-and-replace\",\n      {\n        \"rules\": [\n          {\n            \"search\": \"searchedString\",\n            \"searchTemplateStrings\": true,\n            \"replace\": \"replacement\"\n          },\n          {\n            \"search\": /myRegex/,\n            \"replace\": \"replacement\"\n          }\n        ]\n      }\n    ]\n  ]\n}\n```\n\nIf the `search` key is a string it will search exactly this string.\nFor example with this config\n\n```json\n\"rules\": [{\n  \"search\": \"foo\",\n  \"replace\": \"baz\",\n}]\n```\n\n`str1` will be replaced but not str 2\n\n```\nconst str1 = \"foo\"\nconst str2 = \"foo don't match\"\n```\n\nIf you want `str2` to be replaced, use the regex syntax\n\n```json\n\"rules\": [{\n  \"search\": /foo/,\n  \"replace\": \"baz\",\n}]\n```\n\n## Babel \u003c 7\n\nFor Babel \u003c 7 use babel-plugin-search-and-replace@0.3.0 (does not support template strings)\n\n```json\n{\n  \"plugins\": [\n    [\n      \"search-and-replace\",\n      [\n        {\n          \"search\": \"searchedString\",\n          \"replace\": \"replacement\"\n        },\n        {\n          \"search\": /myRegex/,\n          \"replace\": \"replacement\"\n        }\n      ]\n    ]\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjean-smaug%2Fbabel-plugin-search-and-replace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjean-smaug%2Fbabel-plugin-search-and-replace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjean-smaug%2Fbabel-plugin-search-and-replace/lists"}