
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
babel-plugin-minprops
Advanced tools
Normally, a JavaScript minifier will not minify object properties, because they may be used elsewhere, in files other than the one in which they are defined. Minify allows you to write descriptive property names and safely minify them for production buil
Normally, a JavaScript minifier will not minify object properties, because they may be used elsewhere, in files other than the one in which they are defined. Minify allows you to write descriptive property names and safely minify them for production builds.
minprops
:foo.js
class Foo {
callTheFunctionWithTheArgsThatWerePassed(fn, ...args) {
return fn(...args);
}
}
module.exports = Foo;
index.js
const Foo = require('./foo');
Foo.callTheFunctionWithTheArgsThatWerePassed((num1, num2) => num1 + num2, 1, 2);
āāā MINIFY! āāā
foo.min.js
class a {
callTheFunctionWithTheArgsThatWerePassed(b, ...c) {
return b(...c);
}
}
module.exports = a;
index.min.js
const a = require('./foo');
a.callTheFunctionWithTheArgsThatWerePassed((b, c) => b + c, 1, 2);
minprops
:Use $__
to notate properties that are private to the package and can be safely renamed.
foo.js
class Foo {
$__callTheFunctionWithTheArgsThatWerePassed(fn, ...args) {
return fn(...args);
}
}
module.exports = Foo;
index.js
const Foo = require('./foo');
Foo.$__callTheFunctionWithTheArgsThatWerePassed((num1, num2) => num1 + num2, 1, 2);
āāā MINIFY! āāā
foo.min.js
class a {
a(b, ...c) {
return b(...c);
}
}
module.exports = a;
index.min.js
const a = require('./foo');
a.a((b, c) => b + c, 1, 2);
Options can be specified in a minprops
property in your package.json
{
...
"minprops": {
"exclude": [
"id"
],
"matchPrefix": "$__"
}
...
}
exclude
: List an array of properties to not minify to. Use this if your package has properties that are two characters or less.matchPrefix
: Use a custom prefix. Defaults to $__
.FAQs
Normally, a JavaScript minifier will not minify object properties, because they may be used elsewhere, in files other than the one in which they are defined. Minify allows you to write descriptive property names and safely minify them for production buil
The npm package babel-plugin-minprops receives a total of 1,368 weekly downloads. As such, babel-plugin-minprops popularity was classified as popular.
We found that babel-plugin-minprops demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.