edonyzpc / personal-assistant

A plugin which help you to automatically manage Obsidian.
Apache License 2.0
75 stars 2 forks source link

chore(deps): update dependency esbuild to v0.18.6 #110

Closed renovate[bot] closed 1 year ago

renovate[bot] commented 1 year ago

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
esbuild 0.18.2 -> 0.18.6 age adoption passing confidence

Release Notes

evanw/esbuild ### [`v0.18.6`](https://togithub.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#​0186) [Compare Source](https://togithub.com/evanw/esbuild/compare/v0.18.5...v0.18.6) - Fix tree-shaking of classes with decorators ([#​3164](https://togithub.com/evanw/esbuild/issues/3164)) This release fixes a bug where esbuild incorrectly allowed tree-shaking on classes with decorators. Each decorator is a function call, so classes with decorators must never be tree-shaken. This bug was a regression that was unintentionally introduced in version 0.18.2 by the change that enabled tree-shaking of lowered private fields. Previously decorators were always lowered, and esbuild always considered the automatically-generated decorator code to be a side effect. But this is no longer the case now that esbuild analyzes side effects using the AST before lowering takes place. This bug was fixed by considering any decorator a side effect. - Fix a minification bug involving function expressions ([#​3125](https://togithub.com/evanw/esbuild/issues/3125)) When minification is enabled, esbuild does limited inlining of `const` symbols at the top of a scope. This release fixes a bug where inlineable symbols were incorrectly removed assuming that they were inlined. They may not be inlined in cases where they were referenced by earlier constants in the body of a function expression. The declarations involved in these edge cases are now kept instead of being removed: ```js // Original code { const fn = () => foo const foo = 123 console.log(fn) } // Old output (with --minify-syntax) console.log((() => foo)()); // New output (with --minify-syntax) { const fn = () => foo, foo = 123; console.log(fn); } ``` ### [`v0.18.5`](https://togithub.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#​0185) [Compare Source](https://togithub.com/evanw/esbuild/compare/v0.18.4...v0.18.5) - Implement auto accessors ([#​3009](https://togithub.com/evanw/esbuild/issues/3009)) This release implements the new auto-accessor syntax from the upcoming [JavaScript decorators proposal](https://togithub.com/tc39/proposal-decorators). The auto-accessor syntax looks like this: ```js class Foo { accessor foo; static accessor bar; } new Foo().foo = Foo.bar; ``` This syntax is not yet a part of JavaScript but it was [added to TypeScript in version 4.9](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes). More information about this feature can be found in [microsoft/TypeScript#​49705](https://togithub.com/microsoft/TypeScript/pull/49705). Auto-accessors will be transformed if the target is set to something other than `esnext`: ```js // Output (with --target=esnext) class Foo { accessor foo; static accessor bar; } new Foo().foo = Foo.bar; // Output (with --target=es2022) class Foo { #foo; get foo() { return this.#foo; } set foo(_) { this.#foo = _; } static #bar; static get bar() { return this.#bar; } static set bar(_) { this.#bar = _; } } new Foo().foo = Foo.bar; // Output (with --target=es2021) var _foo, _bar; class Foo { constructor() { __privateAdd(this, _foo, void 0); } get foo() { return __privateGet(this, _foo); } set foo(_) { __privateSet(this, _foo, _); } static get bar() { return __privateGet(this, _bar); } static set bar(_) { __privateSet(this, _bar, _); } } _foo = new WeakMap(); _bar = new WeakMap(); __privateAdd(Foo, _bar, void 0); new Foo().foo = Foo.bar; ``` You can also now use auto-accessors with esbuild's TypeScript experimental decorator transformation, which should behave the same as decorating the underlying getter/setter pair. **Please keep in mind that this syntax is not yet part of JavaScript.** This release enables auto-accessors in `.js` files with the expectation that it will be a part of JavaScript soon. However, esbuild may change or remove this feature in the future if JavaScript ends up changing or removing this feature. Use this feature with caution for now. - Pass through JavaScript decorators ([#​104](https://togithub.com/evanw/esbuild/issues/104)) In this release, esbuild now parses decorators from the upcoming [JavaScript decorators proposal](https://togithub.com/tc39/proposal-decorators) and passes them through to the output unmodified (as long as the language target is set to `esnext`). Transforming JavaScript decorators to environments that don't support them has not been implemented yet. The only decorator transform that esbuild currently implements is still the TypeScript experimental decorator transform, which only works in `.ts` files and which requires `"experimentalDecorators": true` in your `tsconfig.json` file. - Static fields with assign semantics now use static blocks if possible Setting `useDefineForClassFields` to false in TypeScript requires rewriting class fields to assignment statements. Previously this was done by removing the field from the class body and adding an assignment statement after the class declaration. However, this also caused any private fields to also be lowered by necessity (in case a field initializer uses a private symbol, either directly or indirectly). This release changes this transform to use an inline static block if it's supported, which avoids needing to lower private fields in this scenario: ```js // Original code class Test { static #foo = 123 static bar = this.#foo } // Old output (with useDefineForClassFields=false) var _foo; const _Test = class _Test { }; _foo = new WeakMap(); __privateAdd(_Test, _foo, 123); _Test.bar = __privateGet(_Test, _foo); let Test = _Test; // New output (with useDefineForClassFields=false) class Test { static #foo = 123; static { this.bar = this.#foo; } } ``` - Fix TypeScript experimental decorators combined with `--mangle-props` ([#​3177](https://togithub.com/evanw/esbuild/issues/3177)) Previously using TypeScript experimental decorators combined with the `--mangle-props` setting could result in a crash, as the experimental decorator transform was not expecting a mangled property as a class member. This release fixes the crash so you can now combine both of these features together safely. ### [`v0.18.4`](https://togithub.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#​0184) [Compare Source](https://togithub.com/evanw/esbuild/compare/v0.18.3...v0.18.4) - Bundling no longer unnecessarily transforms class syntax ([#​1360](https://togithub.com/evanw/esbuild/issues/1360), [#​1328](https://togithub.com/evanw/esbuild/issues/1328), [#​1524](https://togithub.com/evanw/esbuild/issues/1524), [#​2416](https://togithub.com/evanw/esbuild/issues/2416)) When bundling, esbuild automatically converts top-level class statements to class expressions. Previously this conversion had the unfortunate side-effect of also transforming certain other class-related syntax features to avoid correctness issues when the references to the class name within the class body. This conversion has been reworked to avoid doing this: ```js // Original code export class Foo { static foo = () => Foo } // Old output (with --bundle) var _Foo = class { }; var Foo = _Foo; __publicField(Foo, "foo", () => _Foo); // New output (with --bundle) var Foo = class _Foo { static foo = () => _Foo; }; ``` This conversion process is very complicated and has many edge cases (including interactions with static fields, static blocks, private class properties, and TypeScript experimental decorators). It should already be pretty robust but a change like this may introduce new unintentional behavior. Please report any issues with this upgrade on the esbuild bug tracker. You may be wondering why esbuild needs to do this at all. One reason to do this is that esbuild's bundler sometimes needs to lazily-evaluate a module. For example, a module may end up being both the target of a dynamic `import()` call and a static `import` statement. Lazy module evaluation is done by wrapping the top-level module code in a closure. To avoid a performance hit for static `import` statements, esbuild stores top-level exported symbols outside of the closure and references them directly instead of indirectly. Another reason to do this is that multiple JavaScript VMs have had and continue to have performance issues with TDZ (i.e. "temporal dead zone") checks. These checks validate that a let, or const, or class symbol isn't used before it's initialized. Here are two issues with well-known VMs: - V8: https://bugs.chromium.org/p/v8/issues/detail?id=13723 (10% slowdown) - JavaScriptCore: https://bugs.webkit.org/show_bug.cgi?id=199866 (1,000% slowdown!) JavaScriptCore had a severe performance issue as their TDZ implementation had time complexity that was quadratic in the number of variables needing TDZ checks in the same scope (with the top-level scope typically being the worst offender). V8 has ongoing issues with TDZ checks being present throughout the code their JIT generates even when they have already been checked earlier in the same function or when the function in question has already been run (so the checks have already happened). Due to esbuild's parallel architecture, esbuild both a) needs to convert class statements into class expressions during parsing and b) doesn't yet know whether this module will need to be lazily-evaluated or not in the parser. So esbuild always does this conversion during bundling in case it's needed for correctness (and also to avoid potentially catastrophic performance issues due to bundling creating a large scope with many TDZ variables). - Enforce TDZ errors in computed class property keys ([#​2045](https://togithub.com/evanw/esbuild/issues/2045)) JavaScript allows class property keys to be generated at run-time using code, like this: ```js class Foo { static foo = 'foo' static [Foo.foo + '2'] = 2 } ``` Previously esbuild treated references to the containing class name within computed property keys as a reference to the partially-initialized class object. That meant code that attempted to reference properties of the class object (such as the code above) would get back `undefined` instead of throwing an error. This release rewrites references to the containing class name within computed property keys into code that always throws an error at run-time, which is how this JavaScript code is supposed to work. Code that does this will now also generate a warning. You should never write code like this, but it now should be more obvious when incorrect code like this is written. - Fix an issue with experimental decorators and static fields ([#​2629](https://togithub.com/evanw/esbuild/issues/2629)) This release also fixes a bug regarding TypeScript experimental decorators and static class fields which reference the enclosing class name in their initializer. This affected top-level classes when bundling was enabled. Previously code that does this could crash because the class name wasn't initialized yet. This case should now be handled correctly: ```ts // Original code class Foo { @​someDecorator static foo = 'foo' static bar = Foo.foo.length } // Old output const _Foo = class { static foo = "foo"; static bar = _Foo.foo.length; }; let Foo = _Foo; __decorateClass([ someDecorator ], Foo, "foo", 2); // New output const _Foo = class _Foo { static foo = "foo"; static bar = _Foo.foo.length; }; __decorateClass([ someDecorator ], _Foo, "foo", 2); let Foo = _Foo; ``` - Fix a minification regression with negative numeric properties ([#​3169](https://togithub.com/evanw/esbuild/issues/3169)) Version 0.18.0 introduced a regression where computed properties with negative numbers were incorrectly shortened into a non-computed property when minification was enabled. This regression has been fixed: ```js // Original code x = { [1]: 1, [-1]: -1, [NaN]: NaN, [Infinity]: Infinity, [-Infinity]: -Infinity, } // Old output (with --minify) x={1:1,-1:-1,NaN:NaN,1/0:1/0,-1/0:-1/0}; // New output (with --minify) x={1:1,[-1]:-1,NaN:NaN,[1/0]:1/0,[-1/0]:-1/0}; ``` ### [`v0.18.3`](https://togithub.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#​0183) [Compare Source](https://togithub.com/evanw/esbuild/compare/v0.18.2...v0.18.3) - Fix a panic due to empty static class blocks ([#​3161](https://togithub.com/evanw/esbuild/issues/3161)) This release fixes a bug where an internal invariant that was introduced in the previous release was sometimes violated, which then caused a panic. It happened when bundling code containing an empty static class block with both minification and bundling enabled.

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

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



This PR has been generated by Mend Renovate. View repository job log here.