SWC plugins Contrast Node agent
npm install @contrast/agent-swc-pluginswc plugins for the Node agent's swc rewriter.
See: https://swc.rs/docs/plugin/ecmascript/getting-started
https://www.rust-lang.org/tools/install
https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
```
rustup target add wasm32-wasip1
cargo test runs the rust unit tests for all plugins.npm test runs the JavaScript unit tests
To build release-ready targets, either run npm run build orcargo build --release --target wasm32-wasip1.
These plugins are designed to be used programmatically from @swc/core.
`js
const { transformSync } = require('@swc/core');
const {
defaultRewriter,
defaultUnwriter,
// this is not being built or released until a need arises
//noPropagationRewriter
} = require('@contrast/agent-swc-plugin');
const result = transformSync(src, {
env: {
targets: {
node: '18', // specify your (lowest) node version
},
},
jsc: {
experimental: {
plugins: [[defaultRewriter], { assess: true, inject: true }]],
},
},
});
`
Run npm version to bump the version. Push the changes
and tag to the repo.
When the version bump is merged to main, invoke the release workflow usinggh` CLI program.
either the GitHub UI or the