Changelog: swc v1.2.55

Bugfixes#

Type definition of FunctionDeclaration (#1602)#

Fixed by @wavesheep

optimizer: Fix for do-while loops (#1518)#

Previously the optimizer of swc errornously removed some loops.

Fixed by @wbinnssmith.

Codegen of null character (#1619)#

swc now emits \x00 instead of \00 for null charcters.

preset-env: Import order of core-js modules (#1605)#

Now swc uses indexed sets for managing imports.

  in jsx entities (#1446)#

Previously swc blindly treated   in jsx entities as a whitespace (because it is) and it resulted in   being removed. This is now fixed and it works as expected.

Type definition of options (#1621)#

Fixed by @Brooooooklyn.

HasDecorators.decorators: optional (#1603)#

Now Parameter allows decorators property to be skipped.

Super in sequence expressions (#1617)#

Previously swc miscompiled code like

class A extends B {
foo() {
super.foo(), bar();
}
}

TypeScript dynamic imports (#1614)#

There was a bug which occurs if the dynamic import is only import of a module.

Affected code looks like

(async () => {
const example = await import("./example");
console.log(example.foo);
})();

TypeScript common js exports (#1593)#

swc now supports

export Foo = 'example';

optimizer: Preserve x instanceof Object (#1630)#

Previously swc mis-optimized

let x = undefined;
if (x instanceof Object) {
console.log(x.obj);
}

Fixed by @mischnic.

react: Pass ordering (#1639)#

Fixed by @mischnic.

resolver: Fix setter properties (#)#

Preivously the scope analyzer of swc had a bug related to setter property. But this bug is not expected to affect any real world code because it only affects setter properties.

Type definition of JSXOpeningElement (#1608)#

Fixed by @vemoo.

Method with keyword names (#1651)#

This bug would affect code which uses a keyword as a method name.

Performance improvements#

bundler: Skip works (#1599)#

Previously swc did analysis for all modules, even if it does not have any imports. It's not necessary and it's now removed.

bundler: Rework (#1601)#

swc had a faulty design, which made the bundler slow. These legacy codes are removed, and swc becomes much faster.

bundler: Detection of circular imports (#1610)#

With the release, swc does not perform graph operations. It makes bundling modules with lots of ciruclar graph much faster.