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

ng-annotate

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-annotate - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

ng-annotate/build/es5/lut.js
// lut.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// ng-annotate-main.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -859,3 +859,2 @@ "use strict";

var nodeAfterExtends = null;
var __extends = null;
onode.$parent.body.forEach(function(bnode, idx) {

@@ -884,10 +883,11 @@ if (bnode === onode) {

assert(foundSuspectInBody);
if (onode.type === "FunctionDeclaration" && !nodeAfterExtends) {
nodeAfterExtends = firstNonPrologueStatement(onode.$parent.body);
if (onode.type === "FunctionDeclaration") {
if (!nodeAfterExtends) {
nodeAfterExtends = firstNonPrologueStatement(onode.$parent.body);
}
if (nodeAfterExtends && !existingExpressionStatementWithArray) {
posAfterFunctionDeclaration = skipPrevNewline(nodeAfterExtends.range[0], nodeAfterExtends.loc.start);
}
}
if (nodeAfterExtends && !existingExpressionStatementWithArray) {
posAfterFunctionDeclaration = skipPrevNewline(nodeAfterExtends.range[0], nodeAfterExtends.loc.start);
}
function hasInjectArray(node) {

@@ -894,0 +894,0 @@ var lvalue;

// ng-annotate.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -12,3 +12,3 @@ "use strict";

var ngAnnotate = require("./ng-annotate-main");
var version = "1.2.0";
var version = "1.2.1";
var optimist = require("optimist")

@@ -15,0 +15,0 @@ .usage("ng-annotate v" + version + "\n\nUsage: ng-annotate OPTIONS <file>\n\n" +

// nginject.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -124,3 +124,32 @@ "use strict";

function isStringArray(node) {
if (node.type !== "ArrayExpression") {
return false;
}
return node.elements.length >= 1 && node.elements.every(function(n) {
return n.type === "Literal" && is.string(n.value);
});
}
function findNextStatement(node) {
var body = node.$parent.body;
for (var i = 0; i < body.length; i++) {
if (body[i] === node) {
return body[i + 1] || null;
}
}
return null;
}
function addSuspect(target, ctx, block) {
if (target.type === "ExpressionStatement" && target.expression.type === "AssignmentExpression" && isStringArray(target.expression.right)) {
// /*@ngInject*/
// FooBar.$inject = ["$a", "$b"];
// function FooBar($a, $b) {}
var adjustedTarget = findNextStatement(target);
if (adjustedTarget) {
return addSuspect(adjustedTarget, ctx, block);
}
}
if (target.type === "ObjectExpression") {

@@ -127,0 +156,0 @@ // /*@ngInject*/ {f1: function(a), .., {f2: function(b)}}

@@ -55,3 +55,3 @@ "use strict";

// edit: {controller: function(), resolve: {}}
// edit: {controller: function(), resolve: {}, apply: function()}
var edit = ctx.matchProp('edit', props);

@@ -61,2 +61,3 @@ if (edit && edit.type === "ObjectExpression") {

res.push(ctx.matchProp('controller', editProps));
res.push(ctx.matchProp('apply', editProps));
res.push.apply(res, ctx.matchResolve(editProps));

@@ -63,0 +64,0 @@ }

// run-tests.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// scope.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// scopetools.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

@@ -86,2 +86,5 @@ //test without adf specific annotations

}],
apply: ["$http", "config", function($http, config){
// apply configuration
}],
resolve: {

@@ -88,0 +91,0 @@ editone: ["$http", "config", function($http, config){

@@ -86,2 +86,5 @@ //test without adf specific annotations

},
apply: function($http, config){
// apply configuration
},
resolve: {

@@ -88,0 +91,0 @@ editone: function($http, config){

@@ -831,2 +831,28 @@ "use strict";

// regression-test for https://github.com/olov/ng-annotate/issues/221
var FooBar = (function (_super) {
__extends(FooBar, _super);
/*@ngInject*/
function FooBar($a, $b) {
_super.call(this);
}
/*@ngInject*/
FooBar.onEnter = function (callback) {
x;
};
return FooBar;
})(Bar);
var FooBar2 = (function (_super) {
__extends(FooBar, _super);
function FooBar($a, $b) {
"ngInject";
_super.call(this);
}
FooBar.onEnter = function (callback) {
"ngInject";
x;
};
return FooBar;
})(Bar);
// snippets that shouldn't fool ng-annotate into generating false positives,

@@ -833,0 +859,0 @@ // whether we're inside an angular module or not

@@ -865,2 +865,31 @@ "use strict";

// regression-test for https://github.com/olov/ng-annotate/issues/221
var FooBar = (function (_super) {
__extends(FooBar, _super);
/*@ngInject*/
FooBar.$inject = ["$a", "$b"];
function FooBar($a, $b) {
_super.call(this);
}
/*@ngInject*/
FooBar.onEnter = function (callback) {
x;
};
FooBar.onEnter.$inject = ["callback"];
return FooBar;
})(Bar);
var FooBar2 = (function (_super) {
__extends(FooBar, _super);
FooBar.$inject = ["$a", "$b"];
function FooBar($a, $b) {
"ngInject";
_super.call(this);
}
FooBar.onEnter = ["callback", function (callback) {
"ngInject";
x;
}];
return FooBar;
})(Bar);
// snippets that shouldn't fool ng-annotate into generating false positives,

@@ -867,0 +896,0 @@ // whether we're inside an angular module or not

@@ -0,1 +1,5 @@

## v1.2.1 2016-01-10
* bugfix case where $inject arrays were incorrectly hoisted
* angular-dashboard-framework optional: match apply
## v1.2.0 2015-12-24

@@ -2,0 +6,0 @@ * bugfix $inject array positioning with TypeScript inheritance (__extends)

// lut.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// ng-annotate-main.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -859,3 +859,2 @@ "use strict";

let nodeAfterExtends = null;
let __extends = null;
onode.$parent.body.forEach(function(bnode, idx) {

@@ -884,10 +883,11 @@ if (bnode === onode) {

assert(foundSuspectInBody);
if (onode.type === "FunctionDeclaration" && !nodeAfterExtends) {
nodeAfterExtends = firstNonPrologueStatement(onode.$parent.body);
if (onode.type === "FunctionDeclaration") {
if (!nodeAfterExtends) {
nodeAfterExtends = firstNonPrologueStatement(onode.$parent.body);
}
if (nodeAfterExtends && !existingExpressionStatementWithArray) {
posAfterFunctionDeclaration = skipPrevNewline(nodeAfterExtends.range[0], nodeAfterExtends.loc.start);
}
}
if (nodeAfterExtends && !existingExpressionStatementWithArray) {
posAfterFunctionDeclaration = skipPrevNewline(nodeAfterExtends.range[0], nodeAfterExtends.loc.start);
}
function hasInjectArray(node) {

@@ -894,0 +894,0 @@ let lvalue;

// ng-annotate.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// nginject.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -124,3 +124,32 @@ "use strict";

function isStringArray(node) {
if (node.type !== "ArrayExpression") {
return false;
}
return node.elements.length >= 1 && node.elements.every(function(n) {
return n.type === "Literal" && is.string(n.value);
});
}
function findNextStatement(node) {
const body = node.$parent.body;
for (let i = 0; i < body.length; i++) {
if (body[i] === node) {
return body[i + 1] || null;
}
}
return null;
}
function addSuspect(target, ctx, block) {
if (target.type === "ExpressionStatement" && target.expression.type === "AssignmentExpression" && isStringArray(target.expression.right)) {
// /*@ngInject*/
// FooBar.$inject = ["$a", "$b"];
// function FooBar($a, $b) {}
const adjustedTarget = findNextStatement(target);
if (adjustedTarget) {
return addSuspect(adjustedTarget, ctx, block);
}
}
if (target.type === "ObjectExpression") {

@@ -127,0 +156,0 @@ // /*@ngInject*/ {f1: function(a), .., {f2: function(b)}}

@@ -55,3 +55,3 @@ "use strict";

// edit: {controller: function(), resolve: {}}
// edit: {controller: function(), resolve: {}, apply: function()}
const edit = ctx.matchProp('edit', props);

@@ -61,2 +61,3 @@ if (edit && edit.type === "ObjectExpression") {

res.push(ctx.matchProp('controller', editProps));
res.push(ctx.matchProp('apply', editProps));
res.push.apply(res, ctx.matchResolve(editProps));

@@ -63,0 +64,0 @@ }

{
"name": "ng-annotate",
"version": "1.2.0",
"version": "1.2.1",
"description": "add, remove and rebuild angularjs dependency injection annotations",

@@ -5,0 +5,0 @@ "main": "build/es5/ng-annotate-main.js",

// pos-to-linecolumn.js
// MIT licensed, see LICENSE file
// Copyright (c) 2014-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2014-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

@@ -101,3 +101,3 @@ # ng-annotate [![Build Status](https://travis-ci.org/olov/ng-annotate.svg?branch=master)](https://travis-ci.org/olov/ng-annotate)

* [Grails asset pipeline](https://github.com/bertramdev/asset-pipeline): [angular-annotate-asset-pipeline](https://github.com/craigburke/angular-annotate-asset-pipeline) by [Craig Burke](https://github.com/craigburke)
* [Webpack](http://webpack.github.io/): [ng-annotate-webpack-plugin](https://www.npmjs.org/package/ng-annotate-webpack-plugin) by [Chris Liechty](https://github.com/cliechty)
* [Webpack](http://webpack.github.io/): [ng-annotate-webpack-plugin](https://www.npmjs.org/package/ng-annotate-webpack-plugin) by [Chris Liechty](https://github.com/cliechty), [ng-annotate-loader](https://www.npmjs.org/package/ng-annotate-loader) by [Andrey Skladchikov](https://github.com/huston007)
* [Middleman](http://middlemanapp.com/): [middleman-ngannotate](http://rubygems.org/gems/middleman-ngannotate) by [Michael Siebert](https://github.com/siebertm)

@@ -104,0 +104,0 @@ * [ENB](http://enb-make.info/) (Russian): [enb-ng-techs](https://www.npmjs.org/package/enb-ng-techs#ng-annotate) by [Alexey Gurianov](https://github.com/guria)

// run-tests.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// scope.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

// scopetools.js
// MIT licensed, see LICENSE file
// Copyright (c) 2013-2015 Olov Lassus <olov.lassus@gmail.com>
// Copyright (c) 2013-2016 Olov Lassus <olov.lassus@gmail.com>

@@ -5,0 +5,0 @@ "use strict";

@@ -86,2 +86,5 @@ //test without adf specific annotations

}],
apply: ["$http", "config", function($http, config){
// apply configuration
}],
resolve: {

@@ -88,0 +91,0 @@ editone: ["$http", "config", function($http, config){

@@ -86,2 +86,5 @@ //test without adf specific annotations

},
apply: function($http, config){
// apply configuration
},
resolve: {

@@ -88,0 +91,0 @@ editone: function($http, config){

@@ -831,2 +831,28 @@ "use strict";

// regression-test for https://github.com/olov/ng-annotate/issues/221
var FooBar = (function (_super) {
__extends(FooBar, _super);
/*@ngInject*/
function FooBar($a, $b) {
_super.call(this);
}
/*@ngInject*/
FooBar.onEnter = function (callback) {
x;
};
return FooBar;
})(Bar);
var FooBar2 = (function (_super) {
__extends(FooBar, _super);
function FooBar($a, $b) {
"ngInject";
_super.call(this);
}
FooBar.onEnter = function (callback) {
"ngInject";
x;
};
return FooBar;
})(Bar);
// snippets that shouldn't fool ng-annotate into generating false positives,

@@ -833,0 +859,0 @@ // whether we're inside an angular module or not

@@ -865,2 +865,31 @@ "use strict";

// regression-test for https://github.com/olov/ng-annotate/issues/221
var FooBar = (function (_super) {
__extends(FooBar, _super);
/*@ngInject*/
FooBar.$inject = ["$a", "$b"];
function FooBar($a, $b) {
_super.call(this);
}
/*@ngInject*/
FooBar.onEnter = function (callback) {
x;
};
FooBar.onEnter.$inject = ["callback"];
return FooBar;
})(Bar);
var FooBar2 = (function (_super) {
__extends(FooBar, _super);
FooBar.$inject = ["$a", "$b"];
function FooBar($a, $b) {
"ngInject";
_super.call(this);
}
FooBar.onEnter = ["callback", function (callback) {
"ngInject";
x;
}];
return FooBar;
})(Bar);
// snippets that shouldn't fool ng-annotate into generating false positives,

@@ -867,0 +896,0 @@ // whether we're inside an angular module or not

Sorry, the diff of this file is not supported yet

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