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 2.0.4 to 2.0.5

10

lib/fingerprint.js

@@ -124,4 +124,10 @@ var fs = require('fs');

var contents = new Buffer(JSON.stringify(assets));
var hash = this.hashFn(contents);
fs.writeFileSync(destDir + '/assets/manifest-' + hash + '.json', contents);
var fileName = 'manifest';
if (this.exclude.indexOf('manifest.json') === -1) {
var hash = this.hashFn(contents);
fileName += '-' + hash;
}
fs.writeFileSync(destDir + '/assets/' + fileName + '.json', contents);
};

@@ -128,0 +134,0 @@

2

package.json
{
"name": "broccoli-asset-rev",
"version": "2.0.4",
"version": "2.0.5",
"description": "broccoli asset revisions (fingerprint)",

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

@@ -44,3 +44,3 @@ #broccoli-asset-rev

- `prepend` - Default: `''` - A string to prepend to all of the assets. Useful for CDN urls like `https://subdomain.cloudfront.net/`
- `generateRailsManifest` - Default: none - If true, will generate a `manifest.json` to be used by Sprockets for the Rails Asset Pipeline
- `generateRailsManifest` - Default: none - If true, will generate a `manifest.json` to be used by Sprockets for the Rails Asset Pipeline. The manifest will be fingerprinted by default but this can be avoided by adding `'manifest.json'` to the `exclude` list.
- `customHash` - Default: none - If set, overrides the md5 checksum calculation with the result of calling `customHash(buffer)`. If it is not a `function`, `customHash` is used as the hash value.

@@ -47,0 +47,0 @@ - `generateAssetMap` - Default: false. If true, will generate a `assetMap.json` file in a `assets` directory on the output tree. This file contains a mapping of the original asset name to the fingerprinted asset, like the following:

@@ -29,2 +29,8 @@ var fs = require('fs');

function confirmPathPresent(list, pattern) {
return list.some(function(item) {
return item.search(pattern) !== -1;
});
}
describe('broccoli-asset-rev', function() {

@@ -67,2 +73,39 @@ afterEach(function() {

it('generates a rails-style asset manifest if requested', function () {
var sourcePath = 'tests/fixtures/basic';
var tree = assetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
generateRailsManifest: true,
replaceExtensions: ['html', 'js', 'css']
});
builder = new broccoli.Builder(tree);
return builder.build().then(function(graph) {
var actualFiles = walkSync(graph.directory);
var pathPresent = confirmPathPresent(actualFiles, /manifest-[0-9a-f]{32}.json/);
assert(pathPresent, "manifest file not found");
});
});
it("doesn't fingerprint rails-style manifest if excluded", function () {
var sourcePath = 'tests/fixtures/basic';
var tree = assetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
exclude: ['manifest.json'],
generateRailsManifest: true,
replaceExtensions: ['html', 'js', 'css']
});
builder = new broccoli.Builder(tree);
return builder.build().then(function(graph) {
var actualFiles = walkSync(graph.directory);
var pathPresent = confirmPathPresent(actualFiles, /manifest.json/);
assert(pathPresent, "manifest file not found");
});
});
it('will prepend if set', function () {

@@ -69,0 +112,0 @@ var sourcePath = 'tests/fixtures/prepend';

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