New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.7 to 0.2.8

4

CHANGELOG.md
# Asset Smasher Changelog
## 0.2.8 (April 28, 2013)
- Allow 'manifest directories' to be created. If a directory name ends in '.mf' it is treated as it it were a manfiest file that does a `require_tree` on that directory. (Fixes #12)
## 0.2.7 (April 17, 2013)

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

@@ -43,5 +43,24 @@ var path = require('path');

this.assetFilePath = this._assetFilePath;
this._assetFileStat = null;
this.contents = null;
this.compiled = false;
},
isManifest:function () {
return path.extname(this.assetFilePath) === '.mf';
},
getAssetFileStats:function (cb, force) {
var self = this;
if (!force && this._assetFileStats) {
cb(null, this._assetFileStats);
} else {
fs.stat(this.assetFilePath, function(e, stats) {
if (e) {
cb(e);
} else {
self._assetFileStats = stats;
cb(null, stats);
}
});
}
},
loadOriginalContents:function (cb, sync) {

@@ -48,0 +67,0 @@ var self = this;

3

lib/compilation/hasher.js

@@ -40,3 +40,4 @@ /**

function (wfCb) {
if (!asset.contents) {
// Manifest files will contain the merged contents already
if (!asset.isManifest() && !asset.contents) {
asset.loadOriginalContents(wfCb);

@@ -43,0 +44,0 @@ } else {

@@ -76,4 +76,4 @@ /**

function (wfCb) {
// Load the asset
if (!asset.contents) {
// Load the asset (if it's not a manifest file/dir)
if (!asset.isManifest() && !asset.contents) {
asset.loadOriginalContents(wfCb);

@@ -80,0 +80,0 @@ }

@@ -81,3 +81,4 @@ /**

var self = this;
if (this.lookFor.length > 0) {
// Manifest files will not have any other dependencies other than those picked up by the manifest walker
if (this.lookFor.length > 0 && !asset.isManifest()) {
async.waterfall([

@@ -84,0 +85,0 @@ function (wfCb) {

@@ -45,4 +45,4 @@ /**

return function(asset, cb) {
if (path.extname(asset.assetFilePath) === '.mf') {
self.walkManifest(asset, bundle, cb);
if (asset.isManifest()) {
self.processManifest(asset, bundle, cb);
} else {

@@ -57,4 +57,4 @@ cb(null, asset);

setImmediateCompat(function () {
if (path.extname(asset.assetFilePath) === '.mf') {
self.walkManifest(asset, assetBundle, eachCb);
if (asset.isManifest()) {
self.processManifest(asset, assetBundle, eachCb);
} else {

@@ -68,2 +68,20 @@ eachCb();

},
processManifest:function (manifest, assetBundle, cb) {
var self = this;
manifest.getAssetFileStats(function (e, stats) {
if (e) {
cb(e);
} else {
if (stats.isDirectory()) {
self.autoManifestDir(manifest, assetBundle, cb);
} else {
self.walkManifest(manifest, assetBundle, cb);
}
}
});
},
autoManifestDir:function (manifest, assetBundle, cb) {
// Require all of the files inside of the manifest directory
this.require_tree(manifest, assetBundle, './' + path.basename(manifest.assetFilePath), cb);
},
walkManifest:function (manifest, assetBundle, cb) {

@@ -303,3 +321,3 @@ var manifestFilePath = manifest.assetFilePath;

if (path.extname(file) === '.mf') {
this.walkManifest(assetBundle.getAsset(file), assetBundle, cb);
this.processManifest(assetBundle.getAsset(file), assetBundle, cb);
} else {

@@ -306,0 +324,0 @@ cb();

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

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

@@ -7,2 +7,3 @@ # Asset Smasher

- [Manifest Files](#manifest-files)
- [Manifest Directories](#manifest-directories)
- [Using via Command Line](#command-line)

@@ -164,2 +165,8 @@ - [Helpers](#cli-helpers)

### <a name="manifest-directories"></a> Manifest Directories
If you create a directory, for example named `foo.js.mf` and put a bunch of javascript files in it (or any subdirectories under it), `asset-smasher` will (recursively) take all the files inside and merge them into `foo.js`.
Essentially, this is a time-saver so that you don't have to create a manifest file that only contains a single `require_tree` directive.
## <a name="command-line"></a> Using via Command-Line

@@ -166,0 +173,0 @@

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