Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinidlerz/swc-remove-invalid-content-plugin
A SWC plugin for remove invalid content
https://github.com/justinidlerz/swc-remove-invalid-content-plugin
Last synced: 2 months ago
JSON representation
A SWC plugin for remove invalid content
- Host: GitHub
- URL: https://github.com/justinidlerz/swc-remove-invalid-content-plugin
- Owner: Justinidlerz
- License: mit
- Created: 2024-08-16T02:35:41.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-23T13:24:44.000Z (3 months ago)
- Last Synced: 2024-10-24T15:18:13.581Z (3 months ago)
- Language: Rust
- Size: 89.8 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swc-remove-invalid-content-plugin
[![Node.js Package](https://github.com/Justinidlerz/swc-remove-invalid-content-plugin/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/Justinidlerz/swc-remove-invalid-content-plugin/actions/workflows/npm-publish.yml)
This is only for swc javascript API plugin.
It can help you to remove invalid content via regexp rules from string literal of your code.For more remove expected, you can see `tests/index.spec.ts`.
## Usage
### Installation
```shell
pnpm i -D swc-remove-invalid-content-plugin
```### Configuration
```ts
const plugin = [
'swc-remove-invalid-content-plugin',
{
matches: ['[\u4E00-\u9FFF]', 'baidu.com|google.com'],
replace_with: '*', // Optional
},
];const swcOptions = {
jsc: {
experimental: {
plugins: [plugin],
},
},
};
```#### Options
- matches (required): Array of regexp string for replace.
- replace_with (optional): String for replace. Default is `''`,
it will replace the length same as the matched string when pass.## License
For a detailed explanation on how things work, checkout the [swc](https://swc.rs/docs/configuration/bundling) doc
Copyright (c) 2024-present, Idler.zhu