New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

composer

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

composer - npm Package Compare versions

Comparing version 0.11.1 to 0.11.2

3

index.js

@@ -42,2 +42,5 @@ 'use strict';

*
* Dependencies may also be specified as a glob pattern. Be aware that
* the order cannot be guarenteed when using a glob pattern.
*
* ```js

@@ -44,0 +47,0 @@ * // register task "site" with composer

46

lib/resolve.js
'use strict';
var utils = require('./utils');
/**

@@ -9,24 +11,44 @@ * Resolve the arguments by looking up tasks and their dependencies.

* // bind the composer to the resolve call
* var tasks = resolve.call(this, args);
* var tasks = resolve.call(this, arr);
* ```
*
* @param {Array} `args` flattened array of strings and functions to resolve.
* @param {Array} `arr` flattened array of strings and functions to resolve.
* @return {Array} Return array of composed functions to run.
*/
module.exports = function(args) {
var len = args.length, i = 0;
var fns = new Array(len);
module.exports = function(arr) {
var len = arr.length, i = 0;
var fns = [];
while (len--) {
var fn = args[i];
if (typeof fn === 'string') {
var task = this.tasks[fn];
if (!task) {
throw new Error('Invalid task `' + fn + '`. Register `' + fn + '` before building.');
var str = arr[i++];
if (isGlob(str)) {
var obj = utils.mm.matchKeys(this.tasks, str);
var keys = Object.keys(obj);
if (!keys.length) {
throw new Error('glob pattern "' + str + '" did not match any tasks');
}
fn = task.run.bind(task);
for (var j = 0; j < keys.length; j++) {
fns.push(getTaskFn(this.tasks, keys[j]));
}
continue;
}
fns[i++] = fn;
if (typeof str === 'string') {
str = getTaskFn(this.tasks, str);
}
fns.push(str);
}
return fns;
};
var re = /\[anonymous \(\d*\)\]/;
function isGlob(str) {
return utils.isGlob(str) && (!re.test(str));
}
function getTaskFn(tasks, key) {
var task = tasks[key];
if (!task) {
throw new Error('task "' + key + '" is not registered');
}
return task.run.bind(task);
}

@@ -30,3 +30,5 @@ 'use strict';

require('nanoseconds', 'nano');
require('micromatch', 'mm');
require('isobject');
require('is-glob');
require('bach');

@@ -33,0 +35,0 @@

{
"name": "composer",
"description": "API-first task runner with three methods: task, run and watch.",
"version": "0.11.1",
"version": "0.11.2",
"homepage": "https://github.com/doowb/composer",

@@ -32,4 +32,6 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"define-property": "^0.2.5",
"is-glob": "^2.0.1",
"isobject": "^2.0.0",
"lazy-cache": "^1.0.3",
"micromatch": "^2.3.7",
"nanoseconds": "^0.1.0"

@@ -36,0 +38,0 @@ },

@@ -23,6 +23,9 @@ # composer [![NPM version](https://img.shields.io/npm/v/composer.svg)](https://www.npmjs.com/package/composer) [![Build Status](https://img.shields.io/travis/doowb/composer.svg)](https://travis-ci.org/doowb/composer)

### [.task](index.js#L62)
### [.task](index.js#L65)
Register a new task with it's options and dependencies. To return the task object of an already registered task, pass the name of the task without any additional parameters.
Dependencies may also be specified as a glob pattern. Be aware that
the order cannot be guarenteed when using a glob pattern.
**Params**

@@ -51,3 +54,3 @@

### [.build](index.js#L118)
### [.build](index.js#L121)

@@ -70,3 +73,3 @@ Build a task or array of tasks.

### [.series](index.js#L178)
### [.series](index.js#L181)

@@ -102,3 +105,3 @@ Compose task or list of tasks into a single function that runs the tasks in series.

### [.parallel](index.js#L210)
### [.parallel](index.js#L213)

@@ -257,6 +260,6 @@ Compose task or list of tasks into a single function that runs the tasks in parallel.

Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
Released under the [MIT license](https://github.com/doowb/composer/blob/master/LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb) on January 29, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.1.0, on February 12, 2016._
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