@babel/plugin-proposal-class-properties
Advanced tools
Comparing version 7.0.0-beta.31 to 7.0.0-beta.32
@@ -8,6 +8,6 @@ "use strict"; | ||
var _template = _interopRequireDefault(require("@babel/template")); | ||
var _pluginSyntaxClassProperties = _interopRequireDefault(require("@babel/plugin-syntax-class-properties")); | ||
var _core = require("@babel/core"); | ||
var _templateObject = _taggedTemplateLiteralLoose(["\n Object.defineProperty(REF, KEY, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: VALUE\n });\n "], ["\n Object.defineProperty(REF, KEY, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: VALUE\n });\n "]), | ||
@@ -20,4 +20,3 @@ _templateObject2 = _taggedTemplateLiteralLoose(["MEMBER = VALUE"], ["MEMBER = VALUE"]); | ||
function _default(_ref, options) { | ||
var t = _ref.types; | ||
function _default(api, options) { | ||
var loose = options.loose; | ||
@@ -45,9 +44,9 @@ var findBareSupers = { | ||
var buildClassPropertySpec = function buildClassPropertySpec(ref, _ref2, scope) { | ||
var key = _ref2.key, | ||
value = _ref2.value, | ||
computed = _ref2.computed; | ||
return _template.default.statement(_templateObject)({ | ||
var buildClassPropertySpec = function buildClassPropertySpec(ref, _ref, scope) { | ||
var key = _ref.key, | ||
value = _ref.value, | ||
computed = _ref.computed; | ||
return _core.template.statement(_templateObject)({ | ||
REF: ref, | ||
KEY: t.isIdentifier(key) && !computed ? t.stringLiteral(key.name) : key, | ||
KEY: _core.types.isIdentifier(key) && !computed ? _core.types.stringLiteral(key.name) : key, | ||
VALUE: value || scope.buildUndefinedNode() | ||
@@ -57,8 +56,8 @@ }); | ||
var buildClassPropertyLoose = function buildClassPropertyLoose(ref, _ref3, scope) { | ||
var key = _ref3.key, | ||
value = _ref3.value, | ||
computed = _ref3.computed; | ||
return _template.default.statement(_templateObject2)({ | ||
MEMBER: t.memberExpression(ref, key, computed || t.isLiteral(key)), | ||
var buildClassPropertyLoose = function buildClassPropertyLoose(ref, _ref2, scope) { | ||
var key = _ref2.key, | ||
value = _ref2.value, | ||
computed = _ref2.computed; | ||
return _core.template.statement(_templateObject2)({ | ||
MEMBER: _core.types.memberExpression(ref, key, computed || _core.types.isLiteral(key)), | ||
VALUE: value || scope.buildUndefinedNode() | ||
@@ -80,14 +79,14 @@ }); | ||
for (var _iterator = body.get("body"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref4; | ||
var _ref3; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref4 = _iterator[_i++]; | ||
_ref3 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref4 = _i.value; | ||
_ref3 = _i.value; | ||
} | ||
var _path2 = _ref4; | ||
var _path2 = _ref3; | ||
@@ -127,4 +126,4 @@ if (_path2.node.computed) { | ||
var ident = path.scope.generateUidIdentifierBasedOnNode(computedNode.key); | ||
computedNodes.push(t.variableDeclaration("var", [t.variableDeclarator(ident, computedNode.key)])); | ||
computedNode.key = t.clone(ident); | ||
computedNodes.push(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(ident, computedNode.key)])); | ||
computedNode.key = _core.types.clone(ident); | ||
} | ||
@@ -141,3 +140,3 @@ } | ||
} else { | ||
instanceBody.push(buildClassProperty(t.thisExpression(), propNode, path.scope)); | ||
instanceBody.push(buildClassProperty(_core.types.thisExpression(), propNode, path.scope)); | ||
} | ||
@@ -150,7 +149,7 @@ } | ||
if (!constructor) { | ||
var newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], t.blockStatement([])); | ||
var newConstructor = _core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([])); | ||
if (isDerived) { | ||
newConstructor.params = [t.restElement(t.identifier("args"))]; | ||
newConstructor.body.body.push(t.returnStatement(t.callExpression(t.super(), [t.spreadElement(t.identifier("args"))]))); | ||
newConstructor.params = [_core.types.restElement(_core.types.identifier("args"))]; | ||
newConstructor.body.body.push(_core.types.returnStatement(_core.types.callExpression(_core.types.super(), [_core.types.spreadElement(_core.types.identifier("args"))]))); | ||
} | ||
@@ -178,4 +177,4 @@ | ||
var initialisePropsRef = path.scope.generateUidIdentifier("initialiseProps"); | ||
nodes.push(t.variableDeclaration("var", [t.variableDeclarator(initialisePropsRef, t.functionExpression(null, [], t.blockStatement(instanceBody)))])); | ||
instanceBody = [t.expressionStatement(t.callExpression(t.memberExpression(initialisePropsRef, t.identifier("call")), [t.thisExpression()]))]; | ||
nodes.push(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(initialisePropsRef, _core.types.functionExpression(null, [], _core.types.blockStatement(instanceBody)))])); | ||
instanceBody = [_core.types.expressionStatement(_core.types.callExpression(_core.types.memberExpression(initialisePropsRef, _core.types.identifier("call")), [_core.types.thisExpression()]))]; | ||
} | ||
@@ -208,3 +207,3 @@ | ||
}); | ||
path.replaceWith(t.assignmentExpression("=", ref, path.node)); | ||
path.replaceWith(_core.types.assignmentExpression("=", ref, path.node)); | ||
} else { | ||
@@ -211,0 +210,0 @@ if (!path.node.id) { |
{ | ||
"name": "@babel/plugin-proposal-class-properties", | ||
"version": "7.0.0-beta.31", | ||
"version": "7.0.0-beta.32", | ||
"description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", | ||
@@ -12,13 +12,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-class-properties", | ||
"dependencies": { | ||
"@babel/helper-function-name": "7.0.0-beta.31", | ||
"@babel/plugin-syntax-class-properties": "7.0.0-beta.31", | ||
"@babel/template": "7.0.0-beta.31" | ||
"@babel/helper-function-name": "7.0.0-beta.32", | ||
"@babel/plugin-syntax-class-properties": "7.0.0-beta.32" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "7.0.0-beta.31" | ||
"@babel/core": "7.0.0-beta.32" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.31", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.31" | ||
"@babel/core": "7.0.0-beta.32", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.32" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10969
3
172
+ Added@babel/code-frame@7.0.0-beta.32(transitive)
+ Added@babel/core@7.0.0-beta.32(transitive)
+ Added@babel/generator@7.0.0-beta.32(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.32(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.32(transitive)
+ Added@babel/helpers@7.0.0-beta.32(transitive)
+ Added@babel/plugin-syntax-class-properties@7.0.0-beta.32(transitive)
+ Added@babel/template@7.0.0-beta.32(transitive)
+ Added@babel/traverse@7.0.0-beta.32(transitive)
+ Added@babel/types@7.0.0-beta.32(transitive)
+ Addedbabylon@7.0.0-beta.32(transitive)
- Removed@babel/template@7.0.0-beta.31
- Removed@babel/code-frame@7.0.0-beta.31(transitive)
- Removed@babel/core@7.0.0-beta.31(transitive)
- Removed@babel/generator@7.0.0-beta.31(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.31(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.31(transitive)
- Removed@babel/helpers@7.0.0-beta.31(transitive)
- Removed@babel/plugin-syntax-class-properties@7.0.0-beta.31(transitive)
- Removed@babel/template@7.0.0-beta.31(transitive)
- Removed@babel/traverse@7.0.0-beta.31(transitive)
- Removed@babel/types@7.0.0-beta.31(transitive)
- Removedbabylon@7.0.0-beta.31(transitive)