diff --git a/Makefile b/Makefile index 2c077a3fbd..bb66157542 100644 --- a/Makefile +++ b/Makefile @@ -191,6 +191,9 @@ new-version: git pull --rebase yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" +publish-cerxes: + yarn lerna publish from-package --registry npm.cerxes.net --no-git-tag-version --no-push --no-git-reset --allow-branch initializer-fix --no-verify-access + # NOTE: Run make new-version first publish: prepublish yarn lerna publish from-git diff --git a/README.md b/README.md index 190b936221..8a294d1f3f 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,17 @@

+

+ + WARNING This is a fork of babel to test a fix for initializer-variables with class-properties (proposals-stuff) + +

+

The compiler for writing next generation JavaScript.

+

v7 npm Downloads v6 npm Downloads diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index d235cf3285..b03a1553f4 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -1053,16 +1053,20 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")` * Add a helper to call as a replacement for class property definition. */ helpers.initializerDefineProperty = helper("7.0.0-beta.0")` - export default function _initializerDefineProperty(target, property, descriptor, context){ - if (!descriptor) return; - - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0, - }); - } + export default function _initializerDefineProperty(target, property, descriptor, context) { + if (!descriptor) return; + + if(descriptor.initializer){ + if(descriptor.set){ + descriptor.set.call(context, descriptor.initializer.call(context)); + }else{ + descriptor.value = descriptor.initializer.call(context); + } + delete descriptor.initializer; + } + + Object.defineProperty(target, property, descriptor); + } `; /**