Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 24, 2023
1 parent 6404a5e commit 1c5569d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/swc-magic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @swc/plugin-swc-magic

## Usage

.swcrc:

```json
{
"jsc": {
"experimental": {
"plugins": ["@swc/plugin-swc-magic"]
}
}
}
```

```js
import { markAsPure } from "@swc/magic";

markAsPure(() => console.log("This will be removed by the SWC minifier"));
```
5 changes: 5 additions & 0 deletions packages/swc-magic/transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ mod import_analyzer;

#[derive(Debug, Clone, Deserialize)]
pub struct Config {
#[serde(default = "default_import_path")]
pub import_path: Atom,
}

fn default_import_path() -> Atom {
Atom::from("@swc/magic")
}

impl Config {}

pub fn swc_magic<C>(_unreolved_mark: Mark, config: Config, comments: C) -> impl VisitMut
Expand Down

0 comments on commit 1c5569d

Please sign in to comment.