0.2.4 • Published 9 months ago

swc-remove-invalid-content-plugin v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

swc-remove-invalid-content-plugin

Node.js Package

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

pnpm i -D swc-remove-invalid-content-plugin

Configuration

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 doc

Copyright (c) 2024-present, Idler.zhu

0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.0

11 months ago