Skip to content

chore(deps): update dependency esbuild to v0.14.21

HTML-validate requested to merge renovate/esbuild-0.x into master

This MR contains the following updates:

Package Type Update Change
esbuild devDependencies patch 0.14.18 -> 0.14.21

Release Notes

evanw/esbuild

v0.14.21

Compare Source

  • Handle an additional browser map edge case (#​2001, #​2002)

    There is a community convention around the browser field in package.json that allows remapping import paths within a package when the package is bundled for use within a browser. There isn't a rigorous definition of how it's supposed to work and every bundler implements it differently. The approach esbuild uses is to try to be "maximally compatible" in that if at least one bundler exhibits a particular behavior regarding the browser map that allows a mapping to work, then esbuild also attempts to make that work.

    I have a collection of test cases for this going here: https://github.com/evanw/package-json-browser-tests. However, I was missing test coverage for the edge case where a package path import in a subdirectory of the package could potentially match a remapping. The "maximally compatible" approach means replicating bugs in Browserify's implementation of the feature where package paths are mistaken for relative paths and are still remapped. Here's a specific example of an edge case that's now handled:

    • entry.js:

      require('pkg/sub')
    • node_modules/pkg/package.json:

      {
        "browser": {
          "./sub": "./sub/foo.js",
          "./sub/sub": "./sub/bar.js"
        }
      }
    • node_modules/pkg/sub/foo.js:

      require('sub')
    • node_modules/pkg/sub/bar.js:

      console.log('works')

    The import path sub in require('sub') is mistaken for a relative path by Browserify due to a bug in Browserify, so Browserify treats it as if it were ./sub instead. This is a Browserify-specific behavior and currently doesn't happen in any other bundler (except for esbuild, which attempts to replicate Browserify's bug).

    Previously esbuild was incorrectly resolving ./sub relative to the top-level package directory instead of to the subdirectory in this case, which meant ./sub was incorrectly matching "./sub": "./sub/foo.js" instead of "./sub/sub": "./sub/bar.js". This has been fixed so esbuild can now emulate Browserify's bug correctly in this edge case.

  • Support for esbuild with Linux on RISC-V 64bit (#​2000)

    With this release, esbuild now has a published binary executable for the RISC-V 64bit architecture in the esbuild-linux-riscv64 npm package. This change was contributed by @​piggynl.

v0.14.20

Compare Source

  • Fix property mangling and keyword properties (#​1998)

    Previously enabling property mangling with --mangle-props= failed to add a space before property names after a keyword. This bug has been fixed:

    // Original code
    class Foo {
      static foo = {
        get bar() {}
      }
    }
    
    // Old output (with --minify --mangle-props=.)
    class Foo{statics={gett(){}}}
    
    // New output (with --minify --mangle-props=.)
    class Foo{static s={get t(){}}}

v0.14.19

Compare Source

  • Special-case const inlining at the top of a scope (#​1317, #​1981)

    The minifier now inlines const variables (even across modules during bundling) if a certain set of specific requirements are met:

    • All const variables to be inlined are at the top of their scope
    • That scope doesn't contain any import or export statements with paths
    • All constants to be inlined are null, undefined, true, false, an integer, or a short real number
    • Any expression outside of a small list of allowed ones stops constant identification

    Practically speaking this basically means that you can trigger this optimization by just putting the constants you want inlined into a separate file (e.g. constants.js) and bundling everything together.

    These specific conditions are present to avoid esbuild unintentionally causing any behavior changes by inlining constants when the variable reference could potentially be evaluated before being declared. It's possible to identify more cases where constants can be inlined but doing so may require complex call graph analysis so it has not been implemented. Although these specific heuristics may change over time, this general approach to constant inlining should continue to work going forward.

    Here's an example:

    // Original code
    const bold = 1 << 0;
    const italic = 1 << 1;
    const underline = 1 << 2;
    const font = bold | italic | underline;
    console.log(font);
    
    // Old output (with --minify --bundle)
    (()=>{var o=1<<0,n=1<<1,c=1<<2,t=o|n|c;console.log(t);})();
    
    // New output (with --minify --bundle)
    (()=>{console.log(7);})();

Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled due to failing status checks.

Rebasing: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.


  • If you want to rebase/retry this MR, click this checkbox.

This MR has been generated by Renovate Bot.

Edited by HTML-validate

Merge request reports