Releases: MithrilJS/mopt
Use babel API correctly
More optimizations!
New patterns optimized since 2.0.0
- Optimize
m("div", [].join(...))
- Optimize
m("div", "string".replace(...))
and otherString.prototype
methods that return a string - Optimize
m("div", JSON.stringify(...))
- Optimize conditional expressions (predicate ? consequent : alternate) if the consequent/alternate are valid children types.
m("div", fooga ? "wooga" : "booga")
- Optimize
m("div", m.trust("<div></div>"))
- Optimize
m("div", m.component(component))
(New in 2.2.0)
Rollup plugin!
Features
The only new feature in v2.0.0
is the addition of a rollup plugin to simplify usage w/ that bundler.
rollup.rollup({
entry : "./entry.js",
plugins : [
require("mithril-objectify/rollup")()
]
})
.then(function(bundle) {
return bundle.write({
dest : "./out/source.js"
});
})
Breaking Changes
Exports have changed. To access the browserify transform now requires:
require("mithril-objectify/browserify");
The JS API is now available as the default export:
require("mithril-objectify");
All other usage remains the same, and documentation in the README has been updated.
v1.1.1 - Because testing is hard
mithril-objectify
now understands the following signature:
m(".foo", [ 1, 2, 3 ].map(function(val) { return m("p", val); }));
Which is another step towards optimizing every little thing that is safe to statically optimize! Right now it's limited to the subset of Array.prototype
methods that return an array, so concat
, filter
, map
, reverse
, slice
, sort
, splice
will all be optimized. Let me know if I missed one!
npm i mithril-objectify
will get you the latest release!
v1.1.1
is a patched version of v1.1.0
, which actually included all the above array fun but also included Issue #6, so v.1.1.1
is the clearly superior version!