A debug decorator which erase function body for AssemblyScript
npm install as-debug-transform!CI
> A simple conditional compilation library for testing or debugging.
``sh`
npm install --save-dev as-debug-transform
Update your asconfig to include the transform:
`json`
{
"options": {
... // other options here
"transform": ["as-debug-transform"]
}
}
@debugMode decorator is used to decorate functions/methods/static methods. Its usage is as simple as @inline/@global.
When a function is decorated, its body will be erased if you want to compile production code.
You can use it in the following ways:
- Not set the env variable DEBUG_MODE. Transform will always erase function bodies.DEBUG_MODE
- Set the env variable to false or 0. Transform will always keep function bodies.DEBUG_MODE
- Set the env variable to debug. Transform will keep function bodies when optimizeLevel < 2.
Now, debugMode only support MethodDeclaration and FunctionDeclaration`. Maybe support for classes/namespaces/fields and more features may be added in the future, but it is practical enough for now.