@contrast/agent-swc-plugin
Config
[
"@contrast/agent-swc-plugin",
{
"assess": true, // default: false
"inject": true // default: false
}
]
assess
When true, enables all transforms. When false, only eval
call expressions are
rewritten, as these are the only transforms required by Protect.
inject
When true, prepends the script or module with ContrastMethods
injections, i.e.
const foo = 'bar';
becomes:
var Function = global.ContrastMethods?.Function ?? Function;
var Number = global.ContrastMethods?.Number ?? Number;
var Object = global.ContrastMethods?.Object ?? Object;
var String = global.ContrastMethods?.String ?? String;
const foo = 'bar';