Package Exports
- gulp-unused
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-unused) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gulp-unused

Opinionated gulp plugin that takes an array of method names and creates a report with many times each is used. Don't expect miracles, this is very naive.
Install
Install with npm:
$ npm install gulp-unused --save
Usage
The matching is naive, but it works well for quick checks.
Example
Given the following project files:
// --utils.js--
exports.foo = function(){};
exports.qux = function(){};
exports.baz = function(){};
// --main.js--
var utils = require('./utils.js');
module.exports = function(str) {
// do some "foo" and "qux" stuff, but not "baz"
utils.foo();
utils.qux();
utils.qux();
};
In your gulpfile, get the keys
from utils.js
and pass them on the options:
var gulp = require('gulp');
var unused = require('gulp-unused');
gulp.task('unused', function() {
var keys = Object.keys(require('./utils'));
//=> ['foo', 'qux', 'baz']
return gulp.src(['index.js', 'lib/*.js'])
.pipe(unused({keys: keys}))
// optionally write `report.json` with a summary of used/unused methods/properties
.pipe(gulp.dest('.'));
});
Unless options.silent
is true, the following would be logged out:
{ foo: 1,
qux: 2,
baz: 0,
unused: [ 'baz' ] }
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v, on March 25, 2016.