/usr/lib/nodejs/load-grunt-tasks/index.js is in node-load-grunt-tasks 3.5.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 'use strict';
var path = require('path');
var pkgUp = require('pkg-up');
var multimatch = require('multimatch');
var arrify = require('arrify');
var resolvePkg = require('resolve-pkg');
module.exports = function (grunt, opts) {
opts = opts || {};
var pattern = arrify(opts.pattern || ['grunt-*', '@*/grunt-*']);
var config = opts.config || pkgUp.sync();
var scope = arrify(opts.scope || ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']);
if (typeof config === 'string') {
config = require(path.resolve(config));
}
pattern.push('!grunt', '!grunt-cli');
var names = scope.reduce(function (result, prop) {
var deps = config[prop] || [];
return result.concat(Array.isArray(deps) ? deps : Object.keys(deps));
}, []);
multimatch(names, pattern).forEach(function (pkgName) {
if (opts.requireResolution === true) {
try {
grunt.loadTasks(resolvePkg(path.join(pkgName, 'tasks')));
} catch (err) {
grunt.log.error('npm package "' + pkgName + '" not found. Is it installed?');
}
} else {
grunt.loadNpmTasks(pkgName);
}
});
};
|