Implemented a fix to initializers+class-properties
This commit is contained in:
parent
8e5f2dc929
commit
c8c6ff7c4c
3
Makefile
3
Makefile
@ -191,6 +191,9 @@ new-version:
|
|||||||
git pull --rebase
|
git pull --rebase
|
||||||
yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
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
|
# NOTE: Run make new-version first
|
||||||
publish: prepublish
|
publish: prepublish
|
||||||
yarn lerna publish from-git
|
yarn lerna publish from-git
|
||||||
|
|||||||
@ -4,10 +4,17 @@
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<span style="color:darkred">
|
||||||
|
<b><i>WARNING</i> This is a fork of babel to test a fix for initializer-variables with class-properties (proposals-stuff)</b>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
The compiler for writing next generation JavaScript.
|
The compiler for writing next generation JavaScript.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.npmjs.com/package/@babel/core"><img alt="v7 npm Downloads" src="https://img.shields.io/npm/dm/@babel/core.svg?maxAge=43200&label=v7%20downloads"></a>
|
<a href="https://www.npmjs.com/package/@babel/core"><img alt="v7 npm Downloads" src="https://img.shields.io/npm/dm/@babel/core.svg?maxAge=43200&label=v7%20downloads"></a>
|
||||||
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
|
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
|
||||||
|
|||||||
@ -1053,15 +1053,19 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")`
|
|||||||
* Add a helper to call as a replacement for class property definition.
|
* Add a helper to call as a replacement for class property definition.
|
||||||
*/
|
*/
|
||||||
helpers.initializerDefineProperty = helper("7.0.0-beta.0")`
|
helpers.initializerDefineProperty = helper("7.0.0-beta.0")`
|
||||||
export default function _initializerDefineProperty(target, property, descriptor, context){
|
export default function _initializerDefineProperty(target, property, descriptor, context) {
|
||||||
if (!descriptor) return;
|
if (!descriptor) return;
|
||||||
|
|
||||||
Object.defineProperty(target, property, {
|
if(descriptor.initializer){
|
||||||
enumerable: descriptor.enumerable,
|
if(descriptor.set){
|
||||||
configurable: descriptor.configurable,
|
descriptor.set.call(context, descriptor.initializer.call(context));
|
||||||
writable: descriptor.writable,
|
}else{
|
||||||
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0,
|
descriptor.value = descriptor.initializer.call(context);
|
||||||
});
|
}
|
||||||
|
delete descriptor.initializer;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(target, property, descriptor);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user