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

grunt-ng-annotate

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-ng-annotate - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

28

package.json
{
"name": "grunt-ng-annotate",
"version": "2.0.2",
"version": "3.0.0",
"description": "Add, remove and rebuild AngularJS dependency injection annotations.",

@@ -32,12 +32,14 @@ "homepage": "https://github.com/mgol/grunt-ng-annotate",

"files": [
"tasks"
"tasks",
"src"
],
"dependencies": {
"lodash.clonedeep": "^4.3.2",
"lodash.clonedeep": "^4.5.0",
"ng-annotate": "^1.2.1"
},
"devDependencies": {
"babel-preset-es2015": "6.6.0",
"convert-source-map": "1.2.0",
"eslint-config-mgol": "0.0.14",
"babel-preset-es2015": "6.18.0",
"convert-source-map": "1.3.0",
"cross-spawn": "4.0.2",
"eslint-config-mgol": "0.0.33",
"expect.js": "0.3.1",

@@ -49,8 +51,8 @@ "grunt": "1.0.1",

"grunt-contrib-copy": "1.0.0",
"grunt-eslint": "18.0.0",
"grunt-mocha-test": "0.12.7",
"load-grunt-tasks": "3.5.0",
"mocha": "2.4.5",
"source-map": "0.5.3",
"time-grunt": "1.3.0"
"grunt-eslint": "19.0.0",
"grunt-mocha-test": "0.13.2",
"load-grunt-tasks": "3.5.2",
"mocha": "3.1.2",
"source-map": "0.5.6",
"time-grunt": "1.4.0"
},

@@ -64,4 +66,4 @@ "peerDependencies": {

"engines": {
"node": ">=0.12.7 <0.13 || >=4.1.1"
"node": ">=4.4 <5 || >=6.9"
}
}

@@ -153,3 +153,3 @@ # grunt-ng-annotate

## Supported Node.js versions
This project aims to support all Node.js LTS versions in the "active" phase (see [LTS README](https://github.com/nodejs/LTS/blob/master/README.md) for more details) as well as the latest stable Node.js. Today that means Node.js 0.12, 4 & 5.
This project aims to support all Node.js LTS versions in the "active" phase (see [LTS README](https://github.com/nodejs/LTS/blob/master/README.md) for more details) as well as the latest stable Node.js.

@@ -156,0 +156,0 @@ ## Contributing

@@ -11,118 +11,116 @@ /**

var path = require('path');
var cloneDeep = require('lodash.clonedeep');
var ngAnnotate = require('ng-annotate');
const path = require('path');
const cloneDeep = require('lodash.clonedeep');
const ngAnnotate = require('ng-annotate');
module.exports = function (grunt) {
function getPathFromTo(fromFile, toFile) {
return path.relative(path.resolve(path.dirname(fromFile)), path.resolve(toFile))
const getPathFromTo = (fromFile, toFile) =>
path.relative(path.resolve(path.dirname(fromFile)), path.resolve(toFile))
// URLs should have UNIX-y paths.
.replace(/\\+/g, '/');
}
function handleOptions(options) {
var sourceMapOptions;
const handleOptions = options => {
const finalOptions = cloneDeep(options);
if (!options.ngAnnotateOptions) {
options.ngAnnotateOptions = {};
if (!finalOptions.ngAnnotateOptions) {
finalOptions.ngAnnotateOptions = {};
}
if (options.add == null) {
options.ngAnnotateOptions.add = true;
if (finalOptions.add == null) {
finalOptions.ngAnnotateOptions.add = true;
} else {
options.ngAnnotateOptions.add = options.add;
delete options.add;
finalOptions.ngAnnotateOptions.add = finalOptions.add;
delete finalOptions.add;
}
if (options.remove == null) {
options.ngAnnotateOptions.remove = false;
if (finalOptions.remove == null) {
finalOptions.ngAnnotateOptions.remove = false;
} else {
options.ngAnnotateOptions.remove = options.remove;
delete options.remove;
finalOptions.ngAnnotateOptions.remove = finalOptions.remove;
delete finalOptions.remove;
}
if (options.regexp != null) {
options.ngAnnotateOptions.regexp = options.regexp;
delete options.regexp;
if (finalOptions.regexp != null) {
finalOptions.ngAnnotateOptions.regexp = finalOptions.regexp;
delete finalOptions.regexp;
}
if (options.singleQuotes != null) {
options.ngAnnotateOptions.single_quotes = options.singleQuotes;
delete options.singleQuotes;
if (finalOptions.singleQuotes != null) {
finalOptions.ngAnnotateOptions.single_quotes = finalOptions.singleQuotes;
delete finalOptions.singleQuotes;
}
if (options.separator != null) {
options.ngAnnotateOptions.separator = options.separator;
delete options.separator;
if (finalOptions.separator != null) {
finalOptions.ngAnnotateOptions.separator = options.separator;
delete finalOptions.separator;
}
if (options.sourceMap) {
sourceMapOptions = options.ngAnnotateOptions.map = {};
sourceMapOptions.inline = options.sourceMap === true;
if (finalOptions.sourceMap) {
finalOptions.ngAnnotateOptions.map = {
inline: options.sourceMap === true,
};
}
if (options.transformDest != null) {
grunt.fail.fatal(
[
'The `transformDest` option is no longer supported.',
'The following configuration:',
'',
' app: {',
' options: {',
' transformDest: function (srcPath) {',
' return doSomethingWithSrcPath(srcPath);',
' },',
' },',
' src: [\'app/*.js\'],',
' },',
'',
'should be replaced by:',
'',
' app: {',
' files: [',
' {',
' expand: true,',
' src: [\'app/*.js\'],',
' rename: function (destPath, srcPath) {',
' return doSomethingWithSrcPath(srcPath);',
' },',
' },',
' ],',
' },',
].join('\n')
);
grunt.fail.fatal([
'The `transformDest` option is no longer supported.',
'The following configuration:',
'',
' app: {',
' options: {',
' transformDest: function (srcPath) {',
' return doSomethingWithSrcPath(srcPath);',
' },',
' },',
' src: [\'app/*.js\'],',
' },',
'',
'should be replaced by:',
'',
' app: {',
' files: [',
' {',
' expand: true,',
' src: [\'app/*.js\'],',
' rename: function (destPath, srcPath) {',
' return doSomethingWithSrcPath(srcPath);',
' },',
' },',
' ],',
' },',
].join('\n'));
}
if (options.outputFileSuffix != null) {
grunt.fail.fatal(
[
'The `outputFileSuffix` option is no longer supported.',
'The following configuration:',
'',
' app: {',
' options: {',
' outputFileSuffix: \'-annotated\',',
' },',
' src: [\'app/*.js\'],',
' },',
'',
'should be replaced by:',
'',
' app: {',
' files: [',
' {',
' expand: true,',
' src: [\'app/*.js\'],',
' rename: function (destPath, srcPath) {',
' return srcPath + \'-annotated\';',
' },',
' },',
' ],',
' },',
].join('\n')
);
grunt.fail.fatal([
'The `outputFileSuffix` option is no longer supported.',
'The following configuration:',
'',
' app: {',
' options: {',
' outputFileSuffix: \'-annotated\',',
' },',
' src: [\'app/*.js\'],',
' },',
'',
'should be replaced by:',
'',
' app: {',
' files: [',
' {',
' expand: true,',
' src: [\'app/*.js\'],',
' rename: function (destPath, srcPath) {',
' return srcPath + \'-annotated\';',
' },',
' },',
' ],',
' },',
].join('\n'));
}
}
return finalOptions;
};
grunt.registerMultiTask('ngAnnotate',

@@ -132,25 +130,17 @@ 'Add, remove and rebuild AngularJS dependency injection annotations',

function () {
var filesNum = 0;
var validRun = true;
let filesNum = 0;
let validRun = true;
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options();
const options = handleOptions(this.options());
handleOptions(options);
// Iterate over all specified file groups.
this.files.forEach(function (mapping) {
if (!runNgAnnotate(mapping, options)) {
validRun = false;
}
});
function runNgAnnotate(mapping, options) {
const runNgAnnotate = (mapping, options) => {
filesNum++;
var ngAnnotateOptions = cloneDeep(options.ngAnnotateOptions);
const ngAnnotateOptions = cloneDeep(options.ngAnnotateOptions);
if (ngAnnotateOptions.map) {
if (mapping.src.length > 1) {
grunt.fail.fatal('The ngAnnotate task doesn\'t support source maps with many-to-one mappings.');
grunt.fail.fatal('The ngAnnotate task doesn\'t support ' +
'source maps with many-to-one mappings.');
}

@@ -162,17 +152,18 @@

// seperator for file concatenation; defaults to linefeed
var separator = (typeof ngAnnotateOptions.separator === 'string') ?
ngAnnotateOptions.separator :
grunt.util.linefeed;
const separator = typeof ngAnnotateOptions.separator === 'string' ?
ngAnnotateOptions.separator :
grunt.util.linefeed;
var concatenatedSource = mapping.src.map(function (file) {
return grunt.file.read(file);
}).join(separator);
const concatenatedSource = mapping.src
.map(file => grunt.file.read(file))
.join(separator);
var ngAnnotateOutput = ngAnnotate(concatenatedSource, ngAnnotateOptions);
const ngAnnotateOutput = ngAnnotate(concatenatedSource, ngAnnotateOptions);
// Write the destination file.
if (ngAnnotateOutput.errors) {
grunt.log.write('Generating "' + mapping.dest + '" from: "' + mapping.src.join('", "') + '"...');
grunt.log.write(`Generating "${ mapping.dest }" from: "${
mapping.src.join('", "') }"...`);
grunt.log.error();
ngAnnotateOutput.errors.forEach(function (error) {
ngAnnotateOutput.errors.forEach(error => {
grunt.log.error(error);

@@ -187,3 +178,4 @@ });

ngAnnotateOutput.src +=
'\n//# sourceMappingURL=' + getPathFromTo(mapping.dest, options.sourceMap);
`\n//# sourceMappingURL=${
getPathFromTo(mapping.dest, options.sourceMap) }`;
grunt.file.write(options.sourceMap, ngAnnotateOutput.map);

@@ -195,4 +187,11 @@ }

return true;
}
};
// Iterate over all specified file groups.
this.files.forEach(mapping => {
if (!runNgAnnotate(mapping, options)) {
validRun = false;
}
});
if (validRun) {

@@ -202,3 +201,4 @@ if (filesNum < 1) {

} else {
grunt.log.ok(filesNum + (filesNum === 1 ? ' file' : ' files') + ' successfully annotated.');
grunt.log.ok(`${ filesNum + (filesNum === 1 ? ' file' : ' files')
} successfully annotated.`);
}

@@ -205,0 +205,0 @@ }

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