Socket
Book a DemoInstallSign in
Socket

as-debug-transform

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

as-debug-transform

A debug decorator which erase function body for AssemblyScript

latest
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

as-debug-transform

CI

as-debug-transform

A simple conditional compilation library for testing or debugging.

Usage

install

npm install --save-dev as-debug-transform

Update your asconfig to include the transform:

{
  "options": {
    ... // other options here
    "transform": ["as-debug-transform"]
  }
}

Syntax

@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.
  • Set the env variable DEBUG_MODE to false or 0. Transform will always keep function bodies.
  • Set the env variable DEBUG_MODE to debug. Transform will keep function bodies when optimizeLevel < 2.

Note

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.

Keywords

assemblyscript

FAQs

Package last updated on 03 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.