Package Exports
- @playform/eliminate
- @playform/eliminate/Target/Class/Eliminate.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@playform/eliminate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Eliminate ↘️
Eliminate is a utility that analyzes your TypeScript code to identify
variables that are defined but only used once and are not exported. It then
eliminates these variable definitions and replaces their usage with their
initializers, optimizing your code for better readability and performance.
| Before | After |
|---|---|
let a = 5; let b = 10; let c = a + b; console.log(c); |
console.log(5 + 10); |
Features 📦
TypeScriptsupport with type-checking- Variable Usage Analysis: Analyzes the code to count how many times each variable is used.
- Export Detection: Ensures exported variables are not removed.
- Code Transformation: Removes unnecessary variable declarations and replaces their usage with initializers.
- Complex Scenarios Handling: Handles destructuring, default parameters, nested scopes, and type annotations.
Installation 🚀
Install the package as a development dependency:
npm install -D -E @playform/eliminate🛠️ Usage
Command Line
Run the build tool from the command line:
npx @playform/eliminate Configuration.tsSee an example configuration file in: Configuration.ts
CLI Options
Usage: Eliminate Eliminate
Arguments:
Eliminate ↘️ Eliminate configuration file
Options:
-V, --version Output the version number
-h, --help Display help informationNPM Scripts
Add Eliminate to your package.json scripts:
{
"scripts": {
"Eliminate": "Eliminate Configuration.ts"
}
}Contributing 🤝
Contributions are welcome! Please see CONTRIBUTING.md for
guidelines and feel free to submit a Pull Request.
Changelog
See CHANGELOG.md for a history of changes to this component.