babel-plugin-search-and-replace
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "babel-plugin-search-and-replace", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "lib/index.js", | ||
@@ -8,10 +8,11 @@ "repository": "https://github.com/the-smaug/babel-plugin-search-and-replace", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/core": "7.18.2", | ||
"@changesets/cli": "^2.22.0", | ||
"jest": "28.1.0" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"tdd": "jest --watch" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.6.4", | ||
"jest": "24.9.0" | ||
} | ||
} | ||
} |
# babel-plugin-search-and-replace | ||
## What it does ? | ||
## What it does | ||
It replace string you choosed during babel runtime | ||
It replaces specified string literals | ||
## How to use it ? | ||
## Install | ||
- `yarn add babel-plugin-search-and-replace -DE` or `npm i babel-plugin-search-and-replace --save-dev --exact` | ||
- `yarn add babel-plugin-search-and-replace` | ||
- `npm i babel-plugin-search-and-replace` | ||
- `pnpm add babel-plugin-search-and-replace` | ||
- Add the following lines in your .babelrc | ||
## How to use it | ||
Add the following lines in your .babelrc. | ||
```json | ||
@@ -36,2 +40,30 @@ { | ||
If the `search` key is a string it will search exactly this string. | ||
For example with this config | ||
```json | ||
"rules": [{ | ||
"search": "foo", | ||
"replace": "baz", | ||
}] | ||
``` | ||
`str1` will be replaced but not str 2 | ||
``` | ||
const str1 = "foo" | ||
const str2 = "foo don't match" | ||
``` | ||
If you want `str2` to be replaced, use the regex syntax | ||
```json | ||
"rules": [{ | ||
"search": /foo/, | ||
"replace": "baz", | ||
}] | ||
``` | ||
## Babel < 7 | ||
For Babel < 7 use babel-plugin-search-and-replace@0.3.0 (does not support template strings) | ||
@@ -58,7 +90,1 @@ | ||
``` | ||
- Enjoy | ||
- And, that's all | ||
- Really that's all ;) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
114276
5
89
0
3