Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce helper size for decorator 2023-11 #16263

Merged

Conversation

liuxingbaoyu
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
  1. Removed multiple decorated checks for method/accessor with the same name. (This check is large and only used in extreme exception scenarios, the new behavior is consistent with ts)
  2. Removed the try/catch in the helper, now the decorator completion check will only be performed if there is no throw.
  3. Removed some function parameters in helpers, which can directly access variables in the parent scope.

Comment on lines -496 to -497
// skip computed property names
if (!Array.isArray(decInfo)) continue;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is useful, there are no tests related to it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah decInfo is always an array. It's probably a leftover from an old version.

@liuxingbaoyu liuxingbaoyu added Spec: Decorators PR: Output optimization 🔬 A type of pull request used for our changelog categories labels Feb 5, 2024
@@ -197,6 +197,11 @@ export default /* @no-mangle */ function applyDecs2311(
instanceBrand: Function,
parentClass: any,
) {
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might at some point consider passing this as a parameter to applyDecs2023 (with the || Symbol.for("Symbol.metadata") fallback inside the helper), so that it can be polyfilled when using core-js-pure. Similarly to how we pass Promise when compiling async functions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
It seems to have been polyfilled now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, right :) I was thinking about the case with polyfill + @babel/runtime, but now all our polyfill injection methods will use the already polyfilled runtime package.

@@ -334,100 +334,98 @@ export default /* @no-mangle */ function applyDecs2311(
}.bind(null, decoratorFinishedRef),
};

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be observable in this test case (I'm not sure):

let addInitializer;
function foo(ctx) {
  addInitializer = ctx.addInitializer;
  throw {};
}
try {
  class A { @dec foo = 2; }
} catch {}

expect(() => addInitializer(() => {})).toThrow();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this can be observed.
But when the decorator throws an error, it seems that this check is no longer important.
What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we should make sure to match the spec :)

https://ci.tc39.es/preview/tc39/ecma262/sha/59003ed603d09485b957a0f579b46697f49a96a6/#sec-applydecoratorstoelementdefinition

It looks like if calling the decorator throws then decoratorFinishedRef is not set to true, because the ? in step of 5.j is an early return in case of error. So removing the try/catch is indeed correct.

However, we should move the decoratorFinishedRef.v assignment to right after the newValue = dec.call( call, so that if one of the following validation steps throws then we still have it set to true.

Then, please add a test for when the decorator throws (addInitializer should still be callable) and for when one of the subsequent checks throws (addInitializer should not be callable anymore) :)

@@ -334,100 +334,98 @@ export default /* @no-mangle */ function applyDecs2311(
}.bind(null, decoratorFinishedRef),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to .bind here, we can just capture it from the outer scope right? Since decoratorFinishedRef. And then we could even just replace decoratorFinishedRef with a plain boolean.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces another observable change.
The addInitializer saved by the user in @dec1 can be used in @dec2, which is the current behavior of ts.
I'm fine with both behaviors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, than let's keep the current behavior. decorationState is per-decorator in https://ci.tc39.es/preview/tc39/ecma262/sha/59003ed603d09485b957a0f579b46697f49a96a6/#sec-applydecoratorstoelementdefinition, so the addInitializer should not be valid accross multiple decs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened microsoft/TypeScript#57300 for TS.

Comment on lines -522 to -523
"Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " +
name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens now when we decorate a public method/accessor with the same name of one that has been already decorated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there would be a seemingly incorrect ctx like #16263 (comment),
At the same time, the decorator's operation on the first property may be reflected on the second property? Because the second property overrides the first property. I'm not sure, just guessing. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should still keep this check, which informs users that we don't support such cases, even though they are allowed in the spec.

Another example is

function dec(value) {
  console.log(value.constructor.name)
}


class Foo {
  @dec a() {};
  @dec async a() {};
}

It should log Function and AsyncFunction. Currently we will throw that error, otherwise it will log AsyncFunction twice (in this PR), which is incorrect. In practise such code is likely a developer error, like copying a method twice, we are throwing for good reasons.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this check accounts for 10% of the helper's size. (also after gzip)

}).toThrow("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: 0")
}

expect(elements[0]()).toEqual(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct that this returns 2 and not 1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems so. I'm not sure if the spec supports such usage. ts behaves the same as after this PR.
The size of this check is ~10% of the helper's. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pzuraq Do you have a couple examples of what is the expected behavior when decorating class fields & methods that have the same name?

  • two prototype methods
  • static method and prototype method
  • instance field and prototype method
  • two instance fields

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decorators apply to each individual element independently, and then the element is applied to the class definition in the same order and with the same timing and semantics as if they were not decorated. So:

two prototype methods

  1. Decorators are applied to the first method
  2. First method is assigned to the class prototype
  3. Decorators are applied to the second method
  4. Second method is assigned to the class prototype, overwriting the first method

static method and prototype method

  1. Decorators are applied to the static method
  2. Static method is assigned to the class
  3. Decorators are applied to the prototype method
  4. Prototype method is assigned to the class prototype

instance field and prototype method

  1. Decorators are applied to the prototype method
  2. Prototype method is assigned to the class prototype
  3. Decorators are applied to the instance field
  4. On initialization, the instance field is [Define]d on the instance, shadowing the prototype method

two instance fields

  1. Decorators are applied to instance field 1
  2. Decorators are applied to instavce field 2
  3. Instance field 1 is initialized and defined on the instance
  4. Instance field 2 is initialized and defined on the instance, overwriting instance field 1

In every case, the decoration phase is not altered at all by the existence of another element with the same name. There is no side-channeled information, etc.

When they are the same static, the only case that doesn't end up with the element being overwritten/shadowed is getter and setter with the same name, which will coalesce into a normal getter setter pair.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@liuxingbaoyu At least for the "two methods" case we are not implementing the proposal properly -- let's keep the error, but we can shorten the message for example to "Decorating two elements with the same name (" + name + ") is not supported yet"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the size of this, but I'll keep it in this PR.
I refactored this check, but it still accounts for ~7% of the entire helper, also after gzip.
But luckily we reduced some other sizes inspired by #16261.

Comment on lines -496 to -497
// skip computed property names
if (!Array.isArray(decInfo)) continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah decInfo is always an array. It's probably a leftover from an old version.

} else {
ret.push(
kind === PROP_KIND.METHOD
? desc[key]
: _bindPropCall.call.bind(desc[key]),
: runInitializers.call.bind(desc[key]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: runInitializers.call.bind(desc[key]),
: Function.call.bind(desc[key]),

Here it doesn't actually matter that we are using runInitializers, because we are replacing .call's function with desc[key] anyway. Let's just use Function.call.bind to avoid potential confusion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will add some extra size, can we add some comments instead? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

var defineProperty = Object.defineProperty;
var metadata: any;
var hasClassDecs = classDecs.length;
var _: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave a comment here that _ is an accumulator, which will be frequently reassigned and serve only as a temporary variable.

Comment on lines -522 to -523
"Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " +
name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should still keep this check, which informs users that we don't support such cases, even though they are allowed in the spec.

Another example is

function dec(value) {
  console.log(value.constructor.name)
}


class Foo {
  @dec a() {};
  @dec async a() {};
}

It should log Function and AsyncFunction. Currently we will throw that error, otherwise it will log AsyncFunction twice (in this PR), which is incorrect. In practise such code is likely a developer error, like copying a method twice, we are throwing for good reasons.

@liuxingbaoyu liuxingbaoyu changed the title Remove some checks in decorator 2023-11 Reduce helper size for decorator 2023-11 Feb 7, 2024
var isSetter = kind === PROP_KIND.SETTER;
var isMethod = kind === PROP_KIND.METHOD;

function markExistingNonField(hasSetter?: 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this test?

class {
  @dec method() {}
  @dec set method(_) {}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nicolo-ribaudo nicolo-ribaudo merged commit dcfa8e4 into babel:feat-7.24.0/decorators Feb 7, 2024
48 checks passed
JLHwung pushed a commit that referenced this pull request Feb 14, 2024
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
nicolo-ribaudo added a commit that referenced this pull request Feb 26, 2024
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
nicolo-ribaudo added a commit that referenced this pull request Feb 27, 2024
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
nicolo-ribaudo added a commit that referenced this pull request Feb 27, 2024
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
liuxingbaoyu added a commit to liuxingbaoyu/babel that referenced this pull request Mar 5, 2024
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Apr 15, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@babel/traverse](https://babel.dev/docs/en/next/babel-traverse) ([source](https://github.com/babel/babel)) | resolutions | minor | [`7.23.9` -> `7.24.1`](https://renovatebot.com/diffs/npm/@babel%2ftraverse/7.23.9/7.24.1) |

---

### Release Notes

<details>
<summary>babel/babel (@&#8203;babel/traverse)</summary>

### [`v7.24.1`](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7241-2024-03-19)

[Compare Source](babel/babel@v7.24.0...v7.24.1)

##### 🐛 Bug Fix

-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16350](babel/babel#16350) Fix decorated class computed keys ordering ([@&#8203;JLHwung](https://github.com/JLHwung))
    -   [#&#8203;16344](babel/babel#16344) Fix decorated class static field private access ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-plugin-proposal-decorators`, `babel-plugin-proposal-json-modules`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`
    -   [#&#8203;16329](babel/babel#16329) Respect `moduleName` for `@babel/runtime/regenerator` imports ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16331](babel/babel#16331) Fix decorator memoiser binding kind ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-helper-create-class-features-plugin`, `babel-helper-replace-supers`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16325](babel/babel#16325) Fix decorator evaluation private environment ([@&#8203;JLHwung](https://github.com/JLHwung))

##### 📝 Documentation

-   [#&#8203;16319](babel/babel#16319) Update SECURITY.md ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🏠 Internal

-   `babel-code-frame`, `babel-highlight`
    -   [#&#8203;16359](babel/babel#16359) Replace `chalk` with `picocolors` ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-fixtures`, `babel-helpers`, `babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-unicode-sets-regex`, `babel-preset-env`, `babel-preset-flow`
    -   [#&#8203;16352](babel/babel#16352) Run Babel transform tests on old node if possible ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-class-static-block`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-runtime-corejs3`, `babel-runtime`, `babel-standalone`
    -   [#&#8203;16323](babel/babel#16323) Allow separate helpers to be excluded in Babel 8 ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-module-imports`, `babel-plugin-proposal-import-wasm-source`, `babel-plugin-proposal-json-modules`, `babel-plugin-proposal-record-and-tuple`, `babel-plugin-transform-react-jsx-development`, `babel-plugin-transform-react-jsx`
    -   [#&#8203;16349](babel/babel#16349) Support merging imports in import injector ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression`, `babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining`, `babel-plugin-bugfix-v8-static-class-fields-redefine-readonly`, `babel-plugin-external-helpers`, `babel-plugin-proposal-async-do-expressions`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-destructuring-private`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-duplicate-named-capturing-groups-regex`, `babel-plugin-proposal-explicit-resource-management`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-function-bind`, `babel-plugin-proposal-function-sent`, `babel-plugin-proposal-import-attributes-to-assertions`, `babel-plugin-proposal-import-defer`, `babel-plugin-proposal-import-wasm-source`, `babel-plugin-proposal-json-modules`, `babel-plugin-proposal-optional-chaining-assign`, `babel-plugin-proposal-partial-application`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-proposal-record-and-tuple`, `babel-plugin-proposal-regexp-modifiers`, `babel-plugin-proposal-throw-expressions`, `babel-plugin-syntax-async-do-expressions`, `babel-plugin-syntax-decimal`, `babel-plugin-syntax-decorators`, `babel-plugin-syntax-destructuring-private`, `babel-plugin-syntax-do-expressions`, `babel-plugin-syntax-explicit-resource-management`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-flow`, `babel-plugin-syntax-function-bind`, `babel-plugin-syntax-function-sent`, `babel-plugin-syntax-import-assertions`, `babel-plugin-syntax-import-attributes`, `babel-plugin-syntax-import-defer`, `babel-plugin-syntax-import-reflection`, `babel-plugin-syntax-import-source`, `babel-plugin-syntax-jsx`, `babel-plugin-syntax-module-blocks`, `babel-plugin-syntax-optional-chaining-assign`, `babel-plugin-syntax-partial-application`, `babel-plugin-syntax-pipeline-operator`, `babel-plugin-syntax-record-and-tuple`, `babel-plugin-syntax-throw-expressions`, `babel-plugin-syntax-typescript`, `babel-plugin-transform-arrow-functions`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-block-scoped-functions`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-class-static-block`, `babel-plugin-transform-classes`, `babel-plugin-transform-computed-properties`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-duplicate-keys`, `babel-plugin-transform-dynamic-import`, `babel-plugin-transform-exponentiation-operator`, `babel-plugin-transform-export-namespace-from`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-for-of`, `babel-plugin-transform-function-name`, `babel-plugin-transform-instanceof`, `babel-plugin-transform-jscript`, `babel-plugin-transform-json-strings`, `babel-plugin-transform-literals`, `babel-plugin-transform-logical-assignment-operators`, `babel-plugin-transform-member-expression-literals`, `babel-plugin-transform-modules-amd`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-modules-umd`, `babel-plugin-transform-new-target`, `babel-plugin-transform-nullish-coalescing-operator`, `babel-plugin-transform-numeric-separator`, `babel-plugin-transform-object-assign`, `babel-plugin-transform-object-rest-spread`, `babel-plugin-transform-object-set-prototype-of-to-assign`, `babel-plugin-transform-object-super`, `babel-plugin-transform-optional-catch-binding`, `babel-plugin-transform-optional-chaining`, `babel-plugin-transform-parameters`, `babel-plugin-transform-private-methods`, `babel-plugin-transform-private-property-in-object`, `babel-plugin-transform-property-literals`, `babel-plugin-transform-property-mutators`, `babel-plugin-transform-proto-to-assign`, `babel-plugin-transform-react-constant-elements`, `babel-plugin-transform-react-display-name`, `babel-plugin-transform-react-inline-elements`, `babel-plugin-transform-react-jsx-compat`, `babel-plugin-transform-react-jsx-self`, `babel-plugin-transform-react-jsx-source`, `babel-plugin-transform-react-pure-annotations`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-reserved-words`, `babel-plugin-transform-runtime`, `babel-plugin-transform-shorthand-properties`, `babel-plugin-transform-spread`, `babel-plugin-transform-sticky-regex`, `babel-plugin-transform-strict-mode`, `babel-plugin-transform-template-literals`, `babel-plugin-transform-typeof-symbol`, `babel-plugin-transform-typescript`, `babel-plugin-transform-unicode-escapes`, `babel-plugin-transform-unicode-property-regex`, `babel-plugin-transform-unicode-regex`, `babel-plugin-transform-unicode-sets-regex`, `babel-preset-env`, `babel-preset-flow`, `babel-preset-react`, `babel-preset-typescript`
    -   [#&#8203;16332](babel/babel#16332) Test Babel 7 plugins compatibility with Babel 8 core ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-compat-data`, `babel-plugin-transform-object-rest-spread`, `babel-preset-env`
    -   [#&#8203;16318](babel/babel#16318) \[babel 8] Fix `@babel/compat-data` package.json ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🔬 Output optimization

-   `babel-helper-replace-supers`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`, `babel-plugin-transform-runtime`
    -   [#&#8203;16345](babel/babel#16345) Optimize the use of `assertThisInitialized` after `super()` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-plugin-transform-class-properties`, `babel-plugin-transform-classes`
    -   [#&#8203;16343](babel/babel#16343) Use simpler `assertThisInitialized` more often ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-plugin-proposal-decorators`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-object-rest-spread`, `babel-traverse`
    -   [#&#8203;16342](babel/babel#16342) Consider well-known and registered symbols as literals ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-core`, `babel-plugin-external-helpers`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-function-bind`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-parameters`, `babel-plugin-transform-private-property-in-object`, `babel-plugin-transform-react-jsx`, `babel-plugin-transform-runtime`, `babel-plugin-transform-spread`, `babel-plugin-transform-typescript`, `babel-preset-env`
    -   [#&#8203;16326](babel/babel#16326) Reduce the use of class names ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

### [`v7.24.0`](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7240-2024-02-28)

[Compare Source](babel/babel@v7.23.9...v7.24.0)

##### 🚀 New Feature

-   `babel-standalone`
    -   [#&#8203;11696](babel/babel#11696) Export babel tooling packages in `@babel/standalone` ([@&#8203;ajihyf](https://github.com/ajihyf))
-   `babel-core`, `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16267](babel/babel#16267) Implement `noUninitializedPrivateFieldAccess` assumption ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-syntax-decorators`, `babel-plugin-transform-class-properties`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`
    -   [#&#8203;16242](babel/babel#16242) Support decorator 2023-11 normative updates ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-preset-flow`
    -   [#&#8203;16309](babel/babel#16309) \[babel 7] Allow setting `ignoreExtensions` in Flow preset ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#&#8203;16284](babel/babel#16284) Add `experimental_useHermesParser` option in `preset-flow` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-import-to-platform-api`, `babel-plugin-proposal-import-wasm-source`, `babel-plugin-proposal-json-modules`, `babel-standalone`
    -   [#&#8203;16172](babel/babel#16172) Add transform support for JSON modules imports ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-plugin-transform-runtime`
    -   [#&#8203;16241](babel/babel#16241) Add back `moduleName` option to `@babel/plugin-transform-runtime` ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-parser`, `babel-types`
    -   [#&#8203;16277](babel/babel#16277) Allow import attributes for `TSImportType` ([@&#8203;sosukesuzuki](https://github.com/sosukesuzuki))

##### 🐛 Bug Fix

-   `babel-plugin-proposal-do-expressions`, `babel-traverse`
    -   [#&#8203;16305](babel/babel#16305) fix: avoid `popContext` on unvisited node paths ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-transform-private-methods`, `babel-plugin-transform-private-property-in-object`
    -   [#&#8203;16312](babel/babel#16312) Fix class private properties when `privateFieldsAsSymbols` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-transform-private-methods`
    -   [#&#8203;16307](babel/babel#16307) Fix the support of `arguments` in private `get/set` method ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16287](babel/babel#16287) Reduce decorator static property size ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16281](babel/babel#16281) Fix evaluation order of decorators with cached receiver ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#&#8203;16279](babel/babel#16279) Fix decorator this memoization ([@&#8203;JLHwung](https://github.com/JLHwung))
    -   [#&#8203;16266](babel/babel#16266) Preserve `static` on decorated private `accessor` ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#&#8203;16258](babel/babel#16258) fix: handle decorated async private method and generator ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-private-methods`, `babel-plugin-transform-private-property-in-object`, `babel-plugin-transform-typescript`, `babel-preset-env`
    -   [#&#8203;16275](babel/babel#16275) Fix class private properties when `privateFieldsAsProperties` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helpers`
    -   [#&#8203;16268](babel/babel#16268) Do not consider `arguments` in a helper as a global reference ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helpers`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16270](babel/babel#16270) Handle symbol key class elements decoration ([@&#8203;JLHwung](https://github.com/JLHwung))
    -   [#&#8203;16265](babel/babel#16265) Do not define `access.get` for public setter decorators ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 💅 Polish

-   `babel-core`, `babel-helper-create-class-features-plugin`, `babel-preset-env`
    -   [#&#8203;12428](babel/babel#12428) Suggest using `BABEL_SHOW_CONFIG_FOR` for config problems ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🏠 Internal

-   `babel-helper-transform-fixture-test-runner`
    -   [#&#8203;16278](babel/babel#16278) Continue writing `output.js` when `exec.js` throws ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

##### 🔬 Output optimization

-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16306](babel/babel#16306) Avoid intermediate functions for private accessors with decs ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16294](babel/babel#16294) More aggressively inline decorators in the static block ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-transform-private-methods`
    -   [#&#8203;16283](babel/babel#16283) Do not use `classPrivateMethodGet` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16287](babel/babel#16287) Reduce decorator static property size ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16280](babel/babel#16280) Reduce element decorator temp variables ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-helpers`, `babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-destructuring-private`, `babel-plugin-proposal-optional-chaining-assign`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-class-static-block`, `babel-plugin-transform-private-methods`, `babel-plugin-transform-private-property-in-object`, `babel-preset-env`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`
    -   [#&#8203;16261](babel/babel#16261) Do not use descriptors for private class elements ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helpers`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16263](babel/babel#16263) Reduce helper size for decorator 2023-11 ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

</details>

---

### 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.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/156
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 10, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Output optimization 🔬 A type of pull request used for our changelog categories Spec: Decorators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants