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

broccoli-asset-rev

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-asset-rev - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

9

lib/asset-rev.js

@@ -13,9 +13,13 @@ var Fingerprint = require('./fingerprint');

this.inputTree = inputTree;
this.customHash = options.customHash;
this.fingerprintExtensions = options.fingerprintExtensions || ['js', 'css', 'png'];
this.replaceExtensions = options.replaceExtensions || ['html', 'css'];
this.description = options.description;
var fingerprintTree = Fingerprint(inputTree, {
assetMap: this.assetMap,
customHash: this.customHash,
extensions: this.fingerprintExtensions,
exclude: options.fingerprintExclude || []
exclude: options.fingerprintExclude || [],
description: options.description
});

@@ -26,3 +30,4 @@

extensions: this.replaceExtensions,
prepend: options.prependPath || ''
prepend: options.prependPath || '',
description: options.description
});

@@ -29,0 +34,0 @@ }

@@ -16,4 +16,6 @@ var fs = require('fs');

this.assetMap = options.assetMap || {};
this.customHash = options.customHash;
this.extensions = options.extensions || [];
this.exclude = options.exclude || [];
this.description = options.description;
}

@@ -48,9 +50,14 @@

var file = fs.readFileSync(tmpPath, { encoding: 'utf8' });
var hash;
var md5 = crypto.createHash('md5');
md5.update(file);
var hex = md5.digest('hex');
if (this.customHash) {
hash = this.customHash;
} else {
var md5 = crypto.createHash('md5');
md5.update(file);
hash = md5.digest('hex');
}
var ext = path.extname(relativePath);
var newPath = relativePath.replace(ext, '-' + hex + ext);
var newPath = relativePath.replace(ext, '-' + hash + ext);
this.assetMap[relativePath] = newPath;

@@ -57,0 +64,0 @@

@@ -14,2 +14,3 @@ var Filter = require('broccoli-filter');

this.prepend = options.prepend || '';
this.description = options.description;
}

@@ -16,0 +17,0 @@

{
"name": "broccoli-asset-rev",
"version": "0.0.5",
"version": "0.0.6",
"description": "broccoli asset revisions (fingerprint)",

@@ -5,0 +5,0 @@ "main": "lib/asset-rev.js",

@@ -44,1 +44,2 @@ #broccoli-asset-rev

- `prependPath` - Default: `''` - A string to prepend to all of the assets. Useful for CDN urls like `https://subdomain.cloudfront.net/`
- `customHash` - Default: none - If defined, will be appended to filename instead of a md5 checksum.
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