github evanw/esbuild v0.13.6

latest releases: v0.21.3, v0.21.2, v0.21.1...
2 years ago
  • Emit decorators for declare class fields (#1675)

    In version 3.7, TypeScript introduced the declare keyword for class fields that avoids generating any code for that field:

    // TypeScript input
    class Foo {
      a: number
      declare b: number
    }
    
    // JavaScript output
    class Foo {
      a;
    }

    However, it turns out that TypeScript still emits decorators for these omitted fields. With this release, esbuild will now do this too:

    // TypeScript input
    class Foo {
      @decorator a: number;
      @decorator declare b: number;
    }
    
    // Old JavaScript output
    class Foo {
      a;
    }
    __decorateClass([
      decorator
    ], Foo.prototype, "a", 2);
    
    // New JavaScript output
    class Foo {
      a;
    }
    __decorateClass([
      decorator
    ], Foo.prototype, "a", 2);
    __decorateClass([
      decorator
    ], Foo.prototype, "b", 2);
  • Experimental support for esbuild on NetBSD (#1624)

    With this release, esbuild now has a published binary executable for NetBSD in the esbuild-netbsd-64 npm package, and esbuild's installer has been modified to attempt to use it when on NetBSD. Hopefully this makes installing esbuild via npm work on NetBSD. This change was contributed by @gdt.

    ⚠️ Note: NetBSD is not one of Node's supported platforms, so installing esbuild may or may not work on NetBSD depending on how Node has been patched. This is not a problem with esbuild. ⚠️

  • Disable the "esbuild was bundled" warning if ESBUILD_BINARY_PATH is provided (#1678)

    The ESBUILD_BINARY_PATH environment variable allows you to substitute an alternate binary executable for esbuild's JavaScript API. This is useful in certain cases such as when debugging esbuild. The JavaScript API has some code that throws an error if it detects that it was bundled before being run, since bundling prevents esbuild from being able to find the path to its binary executable. However, that error is unnecessary if ESBUILD_BINARY_PATH is present because an alternate path has been provided. This release disables the warning when ESBUILD_BINARY_PATH is present so that esbuild can be used when bundled as long as you also manually specify ESBUILD_BINARY_PATH.

    This change was contributed by @heypiotr.

  • Remove unused catch bindings when minifying (#1660)

    With this release, esbuild will now remove unused catch bindings when minifying:

    // Original code
    try {
      throw 0;
    } catch (e) {
    }
    
    // Old output (with --minify)
    try{throw 0}catch(t){}
    
    // New output (with --minify)
    try{throw 0}catch{}

    This takes advantage of the new optional catch binding syntax feature that was introduced in ES2019. This minification rule is only enabled when optional catch bindings are supported by the target environment. Specifically, it's not enabled when using --target=es2018 or older. Make sure to set esbuild's target setting correctly when minifying if the code will be running in an older JavaScript environment.

    This change was contributed by @sapphi-red.

Don't miss a new esbuild release

NewReleases is sending notifications on new releases.