babel-plugin-transform-decorators
Advanced tools
Comparing version 6.6.5 to 6.8.0
119
lib/index.js
@@ -1,26 +0,18 @@ | ||
"use strict"; | ||
/*istanbul ignore next*/"use strict"; | ||
var _getIterator = require("babel-runtime/core-js/get-iterator")["default"]; | ||
var _Object$create = require("babel-runtime/core-js/object/create")["default"]; | ||
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"]; | ||
exports.__esModule = true; | ||
var _babelTemplate = require("babel-template"); | ||
var _create = require("babel-runtime/core-js/object/create"); | ||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate); | ||
var _create2 = _interopRequireDefault(_create); | ||
var _babelHelperExplodeClass = require("babel-helper-explode-class"); | ||
var _getIterator2 = require("babel-runtime/core-js/get-iterator"); | ||
var _babelHelperExplodeClass2 = _interopRequireDefault(_babelHelperExplodeClass); | ||
var _getIterator3 = _interopRequireDefault(_getIterator2); | ||
var buildClassDecorator = _babelTemplate2["default"]("\n CLASS_REF = DECORATOR(CLASS_REF) || CLASS_REF;\n"); | ||
exports.default = function ( /*istanbul ignore next*/_ref) { | ||
/*istanbul ignore next*/var t = _ref.types; | ||
exports["default"] = function (_ref3) { | ||
var t = _ref3.types; | ||
function cleanDecorators(decorators) { | ||
return decorators.reverse().map(function (dec) { | ||
return decorators.reverse().map(function (dec) /*istanbul ignore next*/{ | ||
return dec.expression; | ||
@@ -40,15 +32,16 @@ }); | ||
for (var _iterator = classDecorators, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { | ||
var _ref; | ||
for ( /*istanbul ignore next*/var _iterator = classDecorators, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { | ||
/*istanbul ignore next*/ | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
_ref2 = _i.value; | ||
} | ||
var decorator = _ref; | ||
var decorator = _ref2; | ||
@@ -62,17 +55,18 @@ nodes.push(buildClassDecorator({ | ||
var map = _Object$create(null); | ||
var map = /*istanbul ignore next*/(0, _create2.default)(null); | ||
for (var _iterator2 = path.get("body.body"), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) { | ||
var _ref2; | ||
for ( /*istanbul ignore next*/var _iterator2 = path.get("body.body"), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { | ||
/*istanbul ignore next*/ | ||
var _ref3; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
_ref3 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
_ref3 = _i2.value; | ||
} | ||
var method = _ref2; | ||
var method = _ref3; | ||
@@ -82,5 +76,5 @@ var decorators = method.node.decorators; | ||
var alias = t.toKeyAlias(method.node); | ||
map[alias] = map[alias] || []; | ||
map[alias].push(method.node); | ||
var _alias = t.toKeyAlias(method.node); | ||
map[_alias] = map[_alias] || []; | ||
map[_alias].push(method.node); | ||
@@ -103,5 +97,17 @@ method.remove(); | ||
var _arr = path.node.body.body; | ||
for (var _i3 = 0; _i3 < _arr.length; _i3++) { | ||
var method = _arr[_i3]; | ||
for ( /*istanbul ignore next*/var _iterator3 = path.node.body.body, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { | ||
/*istanbul ignore next*/ | ||
var _ref4; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref4 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref4 = _i3.value; | ||
} | ||
var method = _ref4; | ||
if (method.decorators) { | ||
@@ -112,6 +118,17 @@ return true; | ||
} else if (path.isObjectExpression()) { | ||
var _arr2 = path.node.properties; | ||
for ( /*istanbul ignore next*/var _iterator4 = path.node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { | ||
/*istanbul ignore next*/ | ||
var _ref5; | ||
for (var _i4 = 0; _i4 < _arr2.length; _i4++) { | ||
var prop = _arr2[_i4]; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref5 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref5 = _i4.value; | ||
} | ||
var prop = _ref5; | ||
if (prop.decorators) { | ||
@@ -133,3 +150,3 @@ return true; | ||
visitor: { | ||
visitor: { /*istanbul ignore next*/ | ||
ClassExpression: function ClassExpression(path) { | ||
@@ -139,3 +156,3 @@ if (!hasDecorators(path)) return; | ||
_babelHelperExplodeClass2["default"](path); | ||
/*istanbul ignore next*/(0, _babelHelperExplodeClass2.default)(path); | ||
@@ -153,7 +170,6 @@ var ref = path.scope.generateDeclaredUidIdentifier("ref"); | ||
}, | ||
ClassDeclaration: function ClassDeclaration(path) { | ||
/*istanbul ignore next*/ClassDeclaration: function ClassDeclaration(path) { | ||
if (!hasDecorators(path)) return; | ||
doError(path); | ||
_babelHelperExplodeClass2["default"](path); | ||
/*istanbul ignore next*/(0, _babelHelperExplodeClass2.default)(path); | ||
@@ -163,3 +179,3 @@ var ref = path.node.id; | ||
nodes = nodes.concat(transformClass(path, ref, this).map(function (expr) { | ||
nodes = nodes.concat(transformClass(path, ref, this).map(function (expr) /*istanbul ignore next*/{ | ||
return t.expressionStatement(expr); | ||
@@ -171,4 +187,3 @@ })); | ||
}, | ||
ObjectExpression: function ObjectExpression(path) { | ||
/*istanbul ignore next*/ObjectExpression: function ObjectExpression(path) { | ||
if (!hasDecorators(path)) return; | ||
@@ -181,2 +196,16 @@ doError(path); | ||
module.exports = exports["default"]; | ||
var /*istanbul ignore next*/_babelTemplate = require("babel-template"); | ||
/*istanbul ignore next*/ | ||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate); | ||
var /*istanbul ignore next*/_babelHelperExplodeClass = require("babel-helper-explode-class"); | ||
/*istanbul ignore next*/ | ||
var _babelHelperExplodeClass2 = _interopRequireDefault(_babelHelperExplodeClass); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var buildClassDecorator = /*istanbul ignore next*/(0, _babelTemplate2.default)( /*istanbul ignore next*/"\n CLASS_REF = DECORATOR(CLASS_REF) || CLASS_REF;\n"); | ||
/*istanbul ignore next*/module.exports = exports["default"]; |
{ | ||
"name": "babel-plugin-transform-decorators", | ||
"version": "6.6.5", | ||
"version": "6.8.0", | ||
"description": "Compile class and object decorators to ES5", | ||
@@ -12,12 +12,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-decorators", | ||
"dependencies": { | ||
"babel-types": "^6.6.5", | ||
"babel-helper-define-map": "^6.6.5", | ||
"babel-plugin-syntax-decorators": "^6.3.13", | ||
"babel-helper-explode-class": "^6.6.5", | ||
"babel-template": "^6.6.5", | ||
"babel-runtime": "^5.0.0" | ||
"babel-types": "^6.8.0", | ||
"babel-helper-define-map": "^6.8.0", | ||
"babel-plugin-syntax-decorators": "^6.8.0", | ||
"babel-helper-explode-class": "^6.8.0", | ||
"babel-template": "^6.8.0", | ||
"babel-runtime": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "^6.3.13" | ||
"babel-helper-plugin-test-runner": "^6.8.0" | ||
} | ||
} |
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
7001
147
- Removedbabel-runtime@5.8.38(transitive)
- Removedcore-js@1.2.7(transitive)
Updatedbabel-runtime@^6.0.0
Updatedbabel-template@^6.8.0
Updatedbabel-types@^6.8.0