Registry / devops / esmangle-pass-remove-wasted-blocks

esmangle-pass-remove-wasted-blocks

JSON →
library0.0.2jsnpmunverified

A pass for the esmangle ECMAScript code mangler/minifier that removes wasted (empty/unnecessary) blocks from JavaScript ASTs. Version 0.0.2 is the latest and only release, with no further updates since 2012. This package is a utility component of the esmangle ecosystem, focused on a single optimization pass. It is a legacy package with no release cadence and is superseded by more modern minification tools. Its key differentiator is its specific, minimal scope compared to full-featured minifiers.

npm install esmangle-pass-remove-wasted-blocks
INSTALL
IMPORT
SIG · ESMANGLE-PASS-REMO
E
esmangle-pass-remove-wasted-blocks
devopsjavascriptv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

removeWastedBlocks
import { removeWastedBlocks } from 'esmangle-pass-remove-wasted-blocks'
const removeWastedBlocks = require('esmangle-pass-remove-wasted-blocks')
The package exports a named function. CommonJS require without destructuring fails.
default export
const removeWastedBlocks = require('esmangle-pass-remove-wasted-blocks').removeWastedBlocks
const removeWastedBlocks = require('esmangle-pass-remove-wasted-blocks')
No default export; must use named export.
TypeScript types
import { removeWastedBlocks } from 'esmangle-pass-remove-wasted-blocks'
Package has no built-in TypeScript types; use @types/esmangle-pass-remove-wasted-blocks if available.

Parses JavaScript code, removes wasteful block statements from the AST, and outputs minified code.

const esprima = require('esprima'); const escodegen = require('escodegen'); const removeWastedBlocks = require('esmangle-pass-remove-wasted-blocks').removeWastedBlocks; const code = 'function foo() { var x = 1; { var y = 2; } return x + y; }'; const ast = esprima.parse(code); removeWastedBlocks(ast); const result = escodegen.generate(ast); console.log(result);
Debug
Known issues
gotchaMust require the named export, not the module itself, since there is no default export.
fix
Use require('esmangle-pass-remove-wasted-blocks').removeWastedBlocks
affects: *
deprecatedPackage is unmaintained and superseded by tools like terser.
fix
Consider using terser or other modern minifiers.
affects: *
breakingRequires esprima and escodegen for parsing and code generation; not a standalone minifier.
fix
Ensure esprima and escodegen are installed and used correctly.
affects: *
gotchaOnly removes blocks; does not perform full minification (e.g., variable renaming, whitespace removal).
fix
Combine with other esmangle passes or use a full minifier.
affects: *
Errors
Common errors & fixes
TypeError: removeWastedBlocks is not a function
Importing the module without destructuring the named export.
fix
Use: const removeWastedBlocks = require('esmangle-pass-remove-wasted-blocks').removeWastedBlocks;
Cannot find module 'esmangle-pass-remove-wasted-blocks'
Package not installed.
fix
Run npm install esmangle-pass-remove-wasted-blocks.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
esmanglerequiredesmangle is the core mangler/minifier that uses this pass.
Agent activity
2 hits · last 30 days
node
2
Resources
esmangle-pass-remove-wasted-blocks — npm install esmangle-pass-remove-wasted-blocks · libregistry