Changelog: swc v1.1.35

Span regressions#

[email protected] made many changes to the parser, and it also introduced some regressions of span.

Start of arrow in conditional expression (#712)#

The span of the code like

referrer ? false : ([, specifier]): string => specifier;

is now fixed.

Decorators on class (#711)#

Example code:

@decorator<string>()
class Test {}

Tagged template literals (#714)#

Example code:

f<T>``;

Bugfixes#

Ambient context (#715)#

Example code:

declare namespace __event {
export class EventInit {
constructor({
bubbles,
cancelable,
composed
}?: {
bubbles?: boolean | undefined;
cancelable?: boolean | undefined;
composed?: boolean | undefined;
});
}
}

async in start of conditional expression (#717)#

Previously, swc had a bug which make swc reject codes like the below.

function functionFlags(async: boolean) {
return async ? 1 : 0;
}

This is fixed, and async can be the start of a conditional expression.

New features#

"inline" source maps#

Previously, swc/cli handled this, and providing 'inline' to swc/core had no effect. From now, swc/core handles it so code like

let output = swc.transformSync("let x = 3;", {
sourceMaps: "inline",
jsc: {
parser: {
syntax: "ecmascript"
},
transform: {}
}
});
console.log(output.code);

works as expected.