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.4 to 0.2.5

4

CHANGELOG.md
# Asset Smasher Changelog
## 0.2.5 (March 18, 2013)
- Stop starving the event loop during `async.eachSync` calls. Fixes compatibilty with node `0.10.x`. (Fixes #8)
## 0.2.4 (March 16, 2013)

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

13

lib/asset-smasher.js

@@ -20,2 +20,5 @@ var async = require('async');

// Use setImmediate if available
var setImmediateCompat = global.setImmediate || process.nextTick;
function executePhase(phase, target, cb) {

@@ -171,3 +174,5 @@ async.eachSeries(phase, function (operation, cb) {

async.eachSeries(orderedAssets, function (asset, eachCb) {
executePhase(self.phases.compilation, asset, eachCb);
setImmediateCompat(function() {
executePhase(self.phases.compilation, asset, eachCb);
});
}, wfCb);

@@ -225,4 +230,6 @@ }

async.eachSeries(dependencies, function (dep, eachCb) {
dep.reset(); // Ensure the file gets compiled even if it's already been compiled before
executePhase(self.phases.compilation, dep, eachCb);
setImmediateCompat(function() {
dep.reset(); // Ensure the file gets compiled even if it's already been compiled before
executePhase(self.phases.compilation, dep, eachCb);
});
}, wfCb);

@@ -229,0 +236,0 @@ },

@@ -17,2 +17,5 @@ /**

// Use setImmediate if available
var setImmediateCompat = global.setImmediate || process.nextTick;
exports.transforms = {

@@ -99,3 +102,5 @@ CoffeeScript:require('./transforms/coffee_transform'),

async.eachSeries(postTransforms, function (postTransform, eachCb) {
postTransform(asset, eachCb);
setImmediateCompat(function() {
postTransform(asset, eachCb);
});
}, wfCb);

@@ -102,0 +107,0 @@ }

@@ -24,2 +24,4 @@ /**

// Use setImmediate if available
var setImmediateCompat = global.setImmediate || process.nextTick;
// Get "exists" from the right place

@@ -54,7 +56,9 @@ var existsCompat = fs.exists || path.exists;

async.eachSeries(assetBundle.getAllAssets(), function (asset, eachCb) {
if (path.extname(asset.assetFilePath) === '.mf') {
self.walkManifest(asset, assetBundle, eachCb);
} else {
eachCb();
}
setImmediateCompat(function () {
if (path.extname(asset.assetFilePath) === '.mf') {
self.walkManifest(asset, assetBundle, eachCb);
} else {
eachCb();
}
});
}, function (e) {

@@ -75,18 +79,20 @@ cb(e, assetBundle);

async.eachSeries(contents.split('\n'), function (line, eachCb) {
if (line && line.indexOf('#') !== 0) {
var directive = line.match(DIRECTIVE_REGEX);
if (!directive) {
eachCb(new Error('Bad directive in manifest file: ' + line));
} else {
var cmd = directive[1];
var file = directive[2];
if (self[cmd]) {
self[cmd](manifest, assetBundle, file, eachCb);
setImmediateCompat(function() {
if (line && line.indexOf('#') !== 0) {
var directive = line.match(DIRECTIVE_REGEX);
if (!directive) {
eachCb(new Error('Bad directive in manifest file: ' + line));
} else {
eachCb(new Error('Bad directive in manifest file: ' + line));
var cmd = directive[1];
var file = directive[2];
if (self[cmd]) {
self[cmd](manifest, assetBundle, file, eachCb);
} else {
eachCb(new Error('Bad directive in manifest file: ' + line));
}
}
} else {
eachCb();
}
} else {
eachCb();
}
});
}, wfCb);

@@ -115,11 +121,13 @@ }

async.eachSeries(this.paths, function (p, eachCb) {
self.resolveFile(file, p, function (e, f) {
if (e) {
eachCb(e);
} else if (f) {
afterResolve(null, f);
eachCb('break');
} else {
eachCb();
}
setImmediateCompat(function () {
self.resolveFile(file, p, function (e, f) {
if (e) {
eachCb(e);
} else if (f) {
afterResolve(null, f);
eachCb('break');
} else {
eachCb();
}
});
});

@@ -147,9 +155,11 @@ }, function (e) {

async.eachSeries(files, function (f, eachCb) {
var filePath = path.join(dirPath, f);
var extn = path.extname(f);
if (filePath !== manifestFilePath && _.contains(self.extensions, extn)) {
self.registerRequiredAsset(manifest, assetBundle, filePath, eachCb);
} else {
eachCb();
}
setImmediateCompat(function () {
var filePath = path.join(dirPath, f);
var extn = path.extname(f);
if (filePath !== manifestFilePath && _.contains(self.extensions, extn)) {
self.registerRequiredAsset(manifest, assetBundle, filePath, eachCb);
} else {
eachCb();
}
});
}, wfCb);

@@ -171,8 +181,10 @@ }

async.eachSeries(files, function (f, eachCb) {
var extn = path.extname(f);
if (f !== manifestFilePath && _.contains(self.extensions, extn)) {
self.registerRequiredAsset(manifest, assetBundle, f, eachCb);
} else {
eachCb();
}
setImmediateCompat(function () {
var extn = path.extname(f);
if (f !== manifestFilePath && _.contains(self.extensions, extn)) {
self.registerRequiredAsset(manifest, assetBundle, f, eachCb);
} else {
eachCb();
}
});
}, wfCb);

@@ -218,24 +230,26 @@ }

async.eachSeries(files, function (f, eachCb) {
var lookupBase = path.basename(filePath);
var fBase = path.basename(f);
var found = false;
if (lookupBase === fBase) {
found = true;
} else {
var extn;
do {
extn = path.extname(fBase);
fBase = path.basename(fBase, extn);
if (lookupBase === fBase) {
found = true;
break;
}
} while (_.contains(self.extensions, extn));
}
if (found) {
wfCb(null, path.join(fileDir, f));
eachCb('break');
} else {
eachCb();
}
setImmediateCompat(function () {
var lookupBase = path.basename(filePath);
var fBase = path.basename(f);
var found = false;
if (lookupBase === fBase) {
found = true;
} else {
var extn;
do {
extn = path.extname(fBase);
fBase = path.basename(fBase, extn);
if (lookupBase === fBase) {
found = true;
break;
}
} while (_.contains(self.extensions, extn));
}
if (found) {
wfCb(null, path.join(fileDir, f));
eachCb('break');
} else {
eachCb();
}
});
}, function (e) {

@@ -242,0 +256,0 @@ if (!e || e !== 'break') {

{
"name": "asset-smasher",
"description": "Asset pre-processor, merger, and compressor.",
"version": "0.2.4",
"version": "0.2.5",
"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