Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-angularjs-annotate

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-angularjs-annotate - npm Package Compare versions

Comparing version 0.8.2 to 0.9.0

tests/.babelrc

4

CHANGES.md
# 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 @@

18

nginject.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc