babel-plugin-angularjs-annotate
Advanced tools
Comparing version 0.8.2 to 0.9.0
# babel-plugin-angularjs-annotate changelog | ||
## 0.9.0 2018-05-20 | ||
* New Feature: Support directive definition in variable (#36, Thanks @noppa!) | ||
* New Feature: Support `@ngInject` in a multiline comment (#32 & #37, Thanks @sbrunner and @kamilbrk!) | ||
## 0.8.2 2017-09-26 | ||
@@ -4,0 +8,0 @@ * bugfix: Fix issue w/ `$inject` hoisting and nested injected blocks (#29) |
@@ -76,5 +76,26 @@ // ng-annotate-main.js | ||
return limit("directive", | ||
(t.isReturnStatement(node) && node.argument && t.isObjectExpression(node.argument) && matchProp("controller", (path.get && path.get("argument.properties") || node.argument.properties))) || | ||
(t.isArrowFunctionExpression(node) && node.body && t.isObjectExpression(node.body) && matchProp("controller", (path.get && path.get("body.properties") || node.body.properties)))); | ||
var returnPath; | ||
if (t.isReturnStatement(node) && node.argument) { | ||
if (t.isObjectExpression(node.argument)) { | ||
returnPath = matchProp("controller", (path.get && path.get("argument.properties") || node.argument.properties)); | ||
} else if (path.get && t.isIdentifier(path.get("argument"))) { | ||
var binding = path.scope.getBinding(node.argument.name); | ||
var bound = binding && binding.path; | ||
if (bound && t.isVariableDeclarator(bound)) { | ||
var init = bound.get("init"); | ||
if (init && t.isObjectExpression(init)) { | ||
returnPath = matchProp("controller", init.get("properties")); | ||
} | ||
} | ||
} | ||
} | ||
if (!returnPath) { | ||
returnPath = | ||
t.isArrowFunctionExpression(node) | ||
&& node.body | ||
&& t.isObjectExpression(node.body) | ||
&& matchProp("controller", (path.get && path.get("body.properties") || node.body.properties)); | ||
} | ||
return limit("directive", returnPath); | ||
} | ||
@@ -81,0 +102,0 @@ |
@@ -127,11 +127,13 @@ // nginject.js | ||
for(var i=0; i<node.leadingComments.length; i++){ | ||
let value = node.leadingComments[i].value | ||
.replace(/^[\s\*]*/, '') | ||
.replace(/[\s\*]*$/, '') | ||
.trim(); | ||
for(const line of node.leadingComments[i].value.split("\n")) { | ||
let value = line | ||
.replace(/^[\s\*]*/, '') | ||
.replace(/[\s\*]*$/, '') | ||
.trim(); | ||
if(value === "@ngInject"){ | ||
return true; | ||
} else if (value === "@ngNoInject") { | ||
return false; | ||
if(value === "@ngInject"){ | ||
return true; | ||
} else if (value === "@ngNoInject") { | ||
return false; | ||
} | ||
} | ||
@@ -138,0 +140,0 @@ } |
{ | ||
"name": "babel-plugin-angularjs-annotate", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "Babel plugin to add angularjs dependency injection annotations", | ||
@@ -16,4 +16,4 @@ "main": "babel-ng-annotate.js", | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-core": "^6.26.3", | ||
"babel-preset-env": "^1.7.0", | ||
"babelify": "^7.3.0", | ||
@@ -25,4 +25,4 @@ "browserify": "^13.1.0", | ||
"tap-xunit": "^1.7.0", | ||
"tape": "^4.8.0", | ||
"watchify": "^3.9.0" | ||
"tape": "^4.9.0", | ||
"watchify": "^3.11.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "keywords": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
1370146
43
36062
10
10