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

asset-smasher

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asset-smasher - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

4

CHANGELOG.md
# Asset Smasher Changelog
## 0.2.2 (November 7, 2012)
- Ensure that concurrent requests for assets are correctly compiled by the connect middleware (Fixes #5)
## 0.2.1 (September 17, 2012)

@@ -4,0 +8,0 @@

var path = require('path');
var url = require('url');
var async = require('async');
var Smasher = require('./asset-smasher').Smasher;

@@ -12,2 +13,3 @@ var staticMiddleware;

if (options.serve) {
this.compileQueue = async.queue(this.loadOrCompileAsset.bind(this), 1);
this.smasher = new Smasher(options);

@@ -20,3 +22,2 @@ this.findAssets();

execute:function (req, res, next) {
var self = this;
this.registerHelpers(res);

@@ -34,8 +35,15 @@ if (!this.serve) {

} else {
this.smasher.compileSingleAsset(asset.assetFilePath, function (e) {
// Assets must be compiled non-concurrently
this.compileQueue.push({
req:req,
res:res,
asset:asset,
next:next
}, function (e) {
// If there's an error, we need to continue the request
if (e) {
next(e);
} else {
self.serveAsset(req, res, next, asset);
}
// Otherwise the asset will be processed and next() will
// have already been called.
});

@@ -51,2 +59,19 @@ }

},
loadOrCompileAsset:function(task, done) {
var self = this;
// Asset might have been compiled while we were waiting
if (task.asset.compiled) {
this.serveAsset(task.req, task.res, task.next, task.asset);
done();
} else {
this.smasher.compileSingleAsset(task.asset.assetFilePath, function (e) {
if (e) {
done(e);
} else {
self.serveAsset(task.req, task.res, task.next, task.asset);
done();
}
});
}
},
serveAsset:function (req, res, next, asset) {

@@ -53,0 +78,0 @@ staticMiddleware.send(req, res, next, {

2

package.json
{
"name": "asset-smasher",
"description": "Asset pre-processor, merger, and compressor.",
"version": "0.2.1",
"version": "0.2.2",
"author": "Jim Riecken <jriecken@gmail.com>",

@@ -6,0 +6,0 @@ "keywords": [

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