@ttsc/strip
v0.11.0
Published
First-party ttsc plugin that removes configured calls and statements from emitted JavaScript.
Maintainers
Readme
@ttsc/strip

@ttsc/strip removes configured debug calls and debugger statements from TypeScript source AST before emit.
Setup
Install ttsc and TypeScript-Go, then the strip plugin:
npm install -D ttsc @typescript/native-preview
npm install -D @ttsc/stripRun your normal ttsc command:
npx ttscWith no extra config, @ttsc/strip removes console.log, console.debug, assert.*, and debugger.
Only the configured patterns are removed. @ttsc/strip is not a minifier, tree-shaker, or dead-code-elimination pass.
Configuration
Default behavior removes these statement patterns:
{
"calls": ["console.log", "console.debug", "assert.*"],
"statements": ["debugger"]
}Call patterns match statement-level calls such as console.log("debug") or assert.equal(left, right). A wildcard is supported at the end of a dotted call pattern, such as assert.*.
Add a direct plugin config only when the project needs a different strip list:
{
"compilerOptions": {
"plugins": [
{
"transform": "@ttsc/strip",
"calls": ["console.log", "console.debug", "assert.*"],
"statements": ["debugger"],
},
],
},
}Sponsors
Thanks for your support.
Your donation encourages ttsc development.
