ChangeLog: v1.3.81


Bugfixes

for codegen of yield

The fix was quite trivial.

for explicit resource management

Previously, the transforms for explicit resource management proposal were not applied.

for block scoping

The fix was quite trivial.

for jsc.paths

SWC now does not create an absolute path on Windows. Previously, if the JavaScript package passed a non-UNC absolute path as jsc.baseUrl, SWC used absolute paths in the output.

for miniifer

The code change is ridiculous, but it fixed a bug.

New features

Support for import attributes

You can enable this for EcmaScript by setting jsc.parser.importAttributes to true , and for TypeScript this is unconditionally enabled.

Performance improvements

memchr update

SWC will now use SIMD on arm64, including Apple Silicon for memchr.

Experiments

New experimental option

disableBuiltinTransformsForInternalTesting

I added jsc.experimental.disableBuiltinTransformsForInternalTesting to allow applying only Wasm plugins to input files.

       const { code } = await swc.transform(
            `
        const hello: Type = () => {
            console.log('hello');
        };
        `,
            {
                jsc: {
                    parser: {
                        syntax: "typescript",
                    },
                    experimental: {
                        disableBuiltinTransformsForInternalTesting: true,
                    },
                },
                minify: false,
            }
        );

swc-info

You can run npx swc-info@latest -y to provide the necessary information to the team while reporting an issue.

    Operating System:
        Platform: darwin
        Arch: arm64
        Machine Type: arm64
        Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000
        CPU: (10 cores)
            Models: Apple M1 Max

    Binaries:
        Node: 18.16.0
        npm: 9.5.1
        Yarn: 1.22.19
        pnpm: 8.3.1

    Relevant Packages:
        @swc/core: 1.3.18
        @swc/helpers: 0.4.11
        @swc/types: N/A
        typescript: 4.8.4

    SWC Config:
        output: N/A
        .swcrc path: N/A

    Next.js info:
        output: N/A