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

component-builder

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

component-builder - npm Package Compare versions

Comparing version 0.5.5 to 0.6.0

6

History.md
0.6.0 / 2013-01-01
==================
* add async hook support. Closes #43
* update require
0.5.5 / 2012-12-30

@@ -3,0 +9,0 @@ ==================

89

lib/builder.js

@@ -536,30 +536,32 @@

// "before <type>" hook
self.hook('before ' + type, self);
self.performHook('before ' + type, function(error) {
if (error) done(error);
// build files
if (conf[type]) {
conf[type].forEach(function(file){
var path = self.path(file);
batch.push(function(done){
var val = self._files[file];
// build files
if (conf[type]) {
conf[type].forEach(function(file){
var path = self.path(file);
batch.push(function(done){
var val = self._files[file];
// on disk
if (null == val) {
debug('read file %s', path);
fs.readFile(path, 'utf8', function(err, str){
if (err) return fn(err);
done(null, process(self, file, str));
});
return
}
// on disk
if (null == val) {
debug('read file %s', path);
fs.readFile(path, 'utf8', function(err, str){
if (err) return fn(err);
done(null, process(self, file, str));
});
return
}
// fabricated
done(null, process(self, file, val));
// fabricated
done(null, process(self, file, val));
});
});
}
batch.end(function(err, res){
if (err) return fn(err);
fn(null, res.join('\n'));
});
}
batch.end(function(err, res){
if (err) return fn(err);
fn(null, res.join('\n'));
});

@@ -719,30 +721,29 @@ });

/**
* Define or perform hook `name`.
* Perform hook `name` passing this builder
* to the hook callback, allowing the hook
* to work with the "current" builder instance
* specific to each component, _not_ the root
* builder.
*
* @param {String} name
* @param {Mixed} fn
* @return {Mixed}
* @api private
*/
Builder.prototype.hook = function(name, fn){
if ('function' == typeof fn) return this.defineHook(name, fn);
return this.performHook(name, fn);
};
/**
* Perform hook `name` with `arg` reduced.
*
* @param {String} name
* @return {Mixed}
* @api priate
*/
Builder.prototype.performHook = function(name, arg){
Builder.prototype.performHook = function(name, fn){
debug('invoke hook "%s"', name);
var fns = this._hooks[name] || [];
for (var i = 0, len = fns.length; i < len; ++i) {
arg = fns[i](arg);
var hooks = this._hooks[name] || [];
var self = this;
var i = 0;
function next(err) {
if (err) return fn(err);
var hook = hooks[i++];
if (!hook) return fn();
if (hook.length > 1) return hook(self, next);
hook(self);
next();
}
return arg;
next();
};

@@ -758,3 +759,3 @@

Builder.prototype.defineHook = function(name, fn){
Builder.prototype.hook = function(name, fn){
debug('hook into "%s"', name);

@@ -761,0 +762,0 @@ this._hooks[name] = this._hooks[name] || [];

{
"name": "component-builder",
"version": "0.5.5",
"version": "0.6.0",
"description": "Component build tool",

@@ -11,3 +11,3 @@ "keywords": [

"dependencies": {
"component-require": "0.1.1",
"component-require": "0.2.0",
"batch": "0.2.1",

@@ -14,0 +14,0 @@ "mkdirp": "0.3.4",

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