From 00f94dc88a8a56ebc813f1f31e0ec84147a451e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 6 Jan 2022 18:30:25 +0100 Subject: [PATCH] Install static fields and private methods on the correct class --- packages/babel-helpers/src/helpers.ts | 6 + .../src/transformer-2021-12.ts | 157 ++++++++++++++---- .../initializers/output.js | 46 ++--- .../exec.js | 33 ++++ .../input.js | 15 ++ .../output.js | 32 ++++ .../replacement-static-this/exec.js | 19 +++ .../replacement-static-this/input.js | 10 ++ .../replacement-static-this/output.js | 22 +++ .../replacement/output.js | 22 +-- .../2021-12-classes/initializers/output.js | 45 +++-- .../input.js | 15 ++ .../output.js | 33 ++++ .../replacement-static-this/input.js | 10 ++ .../replacement-static-this/output.js | 24 +++ .../2021-12-classes/replacement/output.js | 19 ++- packages/babel-runtime-corejs2/package.json | 9 + packages/babel-runtime-corejs3/package.json | 9 + packages/babel-runtime/package.json | 9 + 19 files changed, 447 insertions(+), 88 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js diff --git a/packages/babel-helpers/src/helpers.ts b/packages/babel-helpers/src/helpers.ts index 80ee32905a..355aa8fd6e 100644 --- a/packages/babel-helpers/src/helpers.ts +++ b/packages/babel-helpers/src/helpers.ts @@ -2052,3 +2052,9 @@ if (!process.env.BABEL_8_BREAKING) { } `; } + +helpers.identity = helper("7.16.7")` + export default function _identity(x) { + return x; + } +`; diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts index 95872e23a9..7519ed5523 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts @@ -1,5 +1,5 @@ import type { NodePath } from "@babel/traverse"; -import { types as t } from "@babel/core"; +import { types as t, template } from "@babel/core"; import syntaxDecorators from "@babel/plugin-syntax-decorators"; import ReplaceSupers from "@babel/helper-replace-supers"; import * as charCodes from "charcodes"; @@ -447,6 +447,19 @@ function isClassDecoratableElementPath( ); } +function staticBlockToIIFE(block: t.StaticBlock) { + return t.callExpression( + t.arrowFunctionExpression([], t.blockStatement(block.body)), + [], + ); +} + +function maybeSequenceExpression(exprs: t.Expression[]) { + if (exprs.length === 0) return t.unaryExpression("void", t.numericLiteral(0)); + if (exprs.length === 1) return exprs[0]; + return t.sequenceExpression(exprs); +} + function transformClass( path: NodePath, state: any, @@ -836,38 +849,6 @@ function transformClass( locals.push(staticInitLocal); } - const staticBlock = t.staticBlock( - [ - t.expressionStatement( - t.assignmentExpression( - "=", - t.arrayPattern(locals), - t.callExpression(state.addHelper("applyDecs"), [ - t.thisExpression(), - elementDecorations, - classDecorations, - ]), - ), - ), - requiresStaticInit && - t.expressionStatement( - t.callExpression(t.cloneNode(staticInitLocal), [t.thisExpression()]), - ), - ].filter(v => v), - ); - - path.node.body.body.unshift(staticBlock as unknown as ClassElement); - - if (classInitLocal) { - path.node.body.body.push( - t.staticBlock([ - t.expressionStatement( - t.callExpression(t.cloneNode(classInitLocal), []), - ), - ]), - ); - } - if (decoratedPrivateMethods.size > 0) { path.traverse({ PrivateName(path) { @@ -902,6 +883,116 @@ function transformClass( }); } + let classInitInjected = false; + const classInitCall = + classInitLocal && t.callExpression(t.cloneNode(classInitLocal), []); + + const originalClass = path.node; + + if (classDecorators) { + const statics = []; + let staticBlocks: t.StaticBlock[] = []; + path.get("body.body").forEach(element => { + // Static blocks cannot be compiled to "instance blocks", but we can inline + // them as IIFEs in the next property. + if (element.isStaticBlock()) { + staticBlocks.push(element.node); + element.remove(); + return; + } + + const isProperty = + element.isClassProperty() || element.isClassPrivateProperty(); + + if ( + (isProperty || element.isClassPrivateMethod()) && + element.node.static + ) { + if (isProperty && staticBlocks.length > 0) { + const allValues: t.Expression[] = staticBlocks.map(staticBlockToIIFE); + if (element.node.value) allValues.push(element.node.value); + element.node.value = maybeSequenceExpression(allValues); + staticBlocks = []; + } + + element.node.static = false; + statics.push(element.node); + element.remove(); + } + }); + + if (statics.length > 0 || staticBlocks.length > 0) { + const staticsClass = template.expression.ast` + class extends ${state.addHelper("identity")} {} + ` as t.ClassExpression; + staticsClass.body.body = [ + t.staticBlock([t.toStatement(path.node, false)]), + ...statics, + ]; + + const constructorBody: t.Expression[] = []; + + const newExpr = t.newExpression(staticsClass, []); + + if (staticBlocks.length > 0) { + constructorBody.push(...staticBlocks.map(staticBlockToIIFE)); + } + if (classInitCall) { + classInitInjected = true; + constructorBody.push(classInitCall); + } + if (constructorBody.length > 0) { + constructorBody.unshift( + t.callExpression(t.super(), [t.cloneNode(classLocal)]), + ); + + staticsClass.body.body.push( + t.classMethod( + "constructor", + t.identifier("constructor"), + [], + t.blockStatement([ + t.expressionStatement(t.sequenceExpression(constructorBody)), + ]), + ), + ); + } else { + newExpr.arguments.push(t.cloneNode(classLocal)); + } + + path.replaceWith(newExpr); + } + } + if (!classInitInjected && classInitCall) { + path.node.body.body.push( + t.staticBlock([t.expressionStatement(classInitCall)]), + ); + } + + originalClass.body.body.unshift( + t.staticBlock( + [ + t.expressionStatement( + t.assignmentExpression( + "=", + t.arrayPattern(locals), + t.callExpression(state.addHelper("applyDecs"), [ + t.thisExpression(), + elementDecorations, + classDecorations, + ]), + ), + ), + requiresStaticInit && + t.expressionStatement( + t.callExpression(t.cloneNode(staticInitLocal), [ + t.thisExpression(), + ]), + ), + ].filter(Boolean), + ), + ); + // Recrawl the scope to make sure new identifiers are properly synced path.scope.crawl(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js index a197b92f57..3ed28458ca 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js @@ -1,33 +1,37 @@ -var _initClass, _initClass2; +var _initClass, _temp2, _initClass2, _temp4; let _Foo; -class Foo {} +new (_temp2 = class extends babelHelpers.identity { + constructor() { + var _temp; -(() => { - [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); -})(); + (_temp = super(_Foo), babelHelpers.defineProperty(this, "field", 123), _temp), _initClass(); + } -babelHelpers.defineProperty(Foo, "field", 123); +}, (() => { + class Foo {} -(() => { - _initClass(); -})(); + (() => { + [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); + })(); +})(), _temp2)(); let _Bar; -class Bar extends _Foo {} +new (_temp4 = class extends babelHelpers.identity { + constructor() { + var _temp3; -(() => { - [_Bar, _initClass2] = babelHelpers.applyDecs(Bar, [], [dec]); -})(); + (_temp3 = super(_Bar), babelHelpers.defineProperty(this, "field", ((() => { + this.otherField = 456; + })(), 123)), _temp3), _initClass2(); + } -(() => { - Bar.otherField = 456; -})(); +}, (() => { + class Bar extends _Foo {} -babelHelpers.defineProperty(Bar, "field", 123); - -(() => { - _initClass2(); -})(); + (() => { + [_Bar, _initClass2] = babelHelpers.applyDecs(Bar, [], [dec]); + })(); +})(), _temp4)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js new file mode 100644 index 0000000000..2f4e342e3e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js @@ -0,0 +1,33 @@ +let hasX, hasM, OriginalFoo; + +class Bar {} + +function dec(Foo) { + OriginalFoo = Foo; + return Bar; +} + +@dec +class Foo { + static #x; + static #m() {} + + static x; + static m() {} + + static { + hasX = o => #x in o; + hasM = o => #m in o; + } +} + +expect(hasX(Bar)).toBe(true); +expect(hasM(Bar)).toBe(true); +expect(hasX(OriginalFoo)).toBe(false); +expect(hasM(OriginalFoo)).toBe(false); + +expect(Bar.hasOwnProperty("x")).toBe(true); +expect(OriginalFoo.hasOwnProperty("x")).toBe(false); + +expect(Bar.hasOwnProperty("m")).toBe(false); +expect(OriginalFoo.hasOwnProperty("m")).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js new file mode 100644 index 0000000000..daf74ddd2d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js @@ -0,0 +1,15 @@ +let hasX, hasM; + +@dec +class Foo { + static #x; + static #m() {} + + static x; + static m() {} + + static { + hasX = o => #x in o; + hasM = o => #m in o; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js new file mode 100644 index 0000000000..f11cf07517 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -0,0 +1,32 @@ +var _initClass, _x, _m, _temp2; + +let hasX, hasM; + +let _Foo; + +new (_temp2 = (_x = /*#__PURE__*/new WeakMap(), _m = /*#__PURE__*/new WeakSet(), class extends babelHelpers.identity { + constructor() { + var _temp; + + (_temp = super(_Foo), babelHelpers.classPrivateMethodInitSpec(this, _m), babelHelpers.classPrivateFieldInitSpec(this, _x, { + writable: true, + value: void 0 + }), babelHelpers.defineProperty(this, "x", void 0), _temp), (() => { + hasX = o => _x.has(o); + + hasM = o => _m.has(o); + })(), _initClass(); + } + +}), (() => { + class Foo { + static m() {} + + } + + (() => { + [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); + })(); +})(), _temp2)(); + +function _m2() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/exec.js new file mode 100644 index 0000000000..6b55df43ed --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/exec.js @@ -0,0 +1,19 @@ + +class Bar {} + +let _this, _this2, _this3; + +@(() => Bar) +class Foo { + static { + _this = this; + } + static field = (_this2 = this); + static { + _this3 = this; + } +} + +expect(_this).toBe(Bar); +expect(_this2).toBe(Bar); +expect(_this3).toBe(Bar); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js new file mode 100644 index 0000000000..51bc09c856 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js @@ -0,0 +1,10 @@ +@dec +class Foo { + static { + this + } + static field = this; + static { + this + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js new file mode 100644 index 0000000000..fe77f96f5a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js @@ -0,0 +1,22 @@ +var _initClass, _temp2; + +let _Foo; + +new (_temp2 = class extends babelHelpers.identity { + constructor() { + var _temp; + + (_temp = super(_Foo), babelHelpers.defineProperty(this, "field", ((() => { + this; + })(), this)), _temp), (() => { + this; + })(), _initClass(); + } + +}, (() => { + class Foo {} + + (() => { + [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); + })(); +})(), _temp2)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js index 4a26f8ccd8..f302d19a6e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js @@ -1,17 +1,19 @@ -var _initClass; +var _initClass, _temp2; let _Foo; -class Foo {} +new (_temp2 = class extends babelHelpers.identity { + constructor() { + var _temp; -(() => { - [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); -})(); + (_temp = super(_Foo), babelHelpers.defineProperty(this, "foo", new _Foo()), _temp), _initClass(); + } -babelHelpers.defineProperty(Foo, "foo", new _Foo()); - -(() => { - _initClass(); -})(); +}, (() => { + class Foo {} + (() => { + [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); + })(); +})(), _temp2)(); const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js index c4b21cf992..982a63a72f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js @@ -2,29 +2,40 @@ var _initClass, _initClass2; let _Foo; -class Foo { +new class extends babelHelpers.identity { static { - [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); - } - static field = 123; - static { - _initClass(); + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + } } -} + field = 123; + + constructor() { + super(_Foo), _initClass(); + } + +}(); let _Bar; -class Bar extends _Foo { +new class extends babelHelpers.identity { static { - [_Bar, _initClass2] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - this.otherField = 456; - } - static field = 123; - static { - _initClass2(); + class Bar extends _Foo { + static { + [_Bar, _initClass2] = babelHelpers.applyDecs(this, [], [dec]); + } + } } -} + field = ((() => { + this.otherField = 456; + })(), 123); + + constructor() { + super(_Bar), _initClass2(); + } + +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js new file mode 100644 index 0000000000..daf74ddd2d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js @@ -0,0 +1,15 @@ +let hasX, hasM; + +@dec +class Foo { + static #x; + static #m() {} + + static x; + static m() {} + + static { + hasX = o => #x in o; + hasM = o => #m in o; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js new file mode 100644 index 0000000000..8f36ec0344 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js @@ -0,0 +1,33 @@ +var _initClass; + +let hasX, hasM; + +let _Foo; + +new class extends babelHelpers.identity { + static { + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + + static m() {} + + } + + } + #x; + + #m() {} + + x; + + constructor() { + super(_Foo), (() => { + hasX = o => #x in o; + + hasM = o => #m in o; + })(), _initClass(); + } + +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js new file mode 100644 index 0000000000..51bc09c856 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js @@ -0,0 +1,10 @@ +@dec +class Foo { + static { + this + } + static field = this; + static { + this + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js new file mode 100644 index 0000000000..5ca20ff8d6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js @@ -0,0 +1,24 @@ +var _initClass; + +let _Foo; + +new class extends babelHelpers.identity { + static { + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + } + + } + field = ((() => { + this; + })(), this); + + constructor() { + super(_Foo), (() => { + this; + })(), _initClass(); + } + +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js index 046ba5f9a7..42a115d10f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js @@ -2,15 +2,20 @@ var _initClass; let _Foo; -class Foo { +new class extends babelHelpers.identity { static { - [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); - } - static foo = new _Foo(); - static { - _initClass(); + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + } } -} + foo = new _Foo(); + constructor() { + super(_Foo), _initClass(); + } + +}(); const foo = new _Foo(); diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 89e1bfa3e5..98577387d2 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -846,6 +846,15 @@ "./helpers/classPrivateMethodSet.js" ], "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", + "./helpers/identity": [ + { + "node": "./helpers/identity.js", + "import": "./helpers/esm/identity.js", + "default": "./helpers/identity.js" + }, + "./helpers/identity.js" + ], + "./helpers/esm/identity": "./helpers/esm/identity.js", "./package": "./package.json", "./package.json": "./package.json", "./regenerator": "./regenerator/index.js", diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index a3dde6e659..37c07d3647 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -845,6 +845,15 @@ "./helpers/classPrivateMethodSet.js" ], "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", + "./helpers/identity": [ + { + "node": "./helpers/identity.js", + "import": "./helpers/esm/identity.js", + "default": "./helpers/identity.js" + }, + "./helpers/identity.js" + ], + "./helpers/esm/identity": "./helpers/esm/identity.js", "./package": "./package.json", "./package.json": "./package.json", "./regenerator": "./regenerator/index.js", diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index 0178026eca..9ac7ec6efc 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -845,6 +845,15 @@ "./helpers/classPrivateMethodSet.js" ], "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", + "./helpers/identity": [ + { + "node": "./helpers/identity.js", + "import": "./helpers/esm/identity.js", + "default": "./helpers/identity.js" + }, + "./helpers/identity.js" + ], + "./helpers/esm/identity": "./helpers/esm/identity.js", "./package": "./package.json", "./package.json": "./package.json", "./regenerator": "./regenerator/index.js",