Changelog: swc v1.1.32

Performance#

24x faster for a large file (#697)#

swc now handles large source maps correctly, and

$ time swc large.js -o dist.js -s > /dev/null
swc large.js -o dist.js -s > /dev/null 16.19s user 0.24s system 100% cpu 16.295 total

becomes

$ time swc large.js -o dist.js -s > /dev/null
swc large.js -o dist.js -s > /dev/null 2.49s user 0.28s system 110% cpu 2.497 total

Bugfixes#

this in for loop (#698)#

swc can handle this in a for loop with closure. An example is at below.

module.exports = function(values) {
var vars = [];
var elem = null,
name,
val;
for (var i = 0; i < this.elements.length; i++) {
elem = this.elements[i];
name = elem.name;
if (!name) continue;
val = values[name];
if (val == null) val = "";
switch (elem.type) {
case "submit":
break;
case "radio":
case "checkbox":
elem.checked = val.some(function(str) {
return str.toString() == elem.value;
});
break;
case "select-multiple":
elem.fill(val);
break;
case "textarea":
elem.innerText = val;
break;
case "hidden":
break;
default:
if (elem.fill) {
elem.fill(val);
} else {
elem.value = val;
}
break;
}
}
return vars;
};

function renaming (#699)#

Previously, swc failed to handle code like the code below because of a bug in resolver pass.

function foo() {
return () => {
function Bar() {}
Bar.qux = "";
return Bar;
};
}
foo()();

It is now fixed.