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.1.3 to 2.2.0

1

lib/asset-rev.js

@@ -17,2 +17,3 @@ var Fingerprint = require('./fingerprint');

this.exclude = options.exclude || [];
this.fingerprintAssetMap = options.fingerprintAssetMap || false;
this.generateAssetMap = options.generateAssetMap;

@@ -19,0 +20,0 @@ this.generateRailsManifest = options.generateRailsManifest;

@@ -27,2 +27,3 @@ var fs = require('fs');

this.exclude = options.exclude || [];
this.fingerprintAssetMap = options.fingerprintAssetMap || false;
this.generateAssetMap = options.generateAssetMap;

@@ -100,2 +101,5 @@ this.generateRailsManifest = options.generateRailsManifest;

var contents = new Buffer(stringify(toWrite));
var fileName = this.fingerprintAssetMap ? 'assetMap-' + this.hashFn(contents) + '.json' : 'assetMap.json';
if (!fs.existsSync(destDir + '/assets')) {

@@ -105,3 +109,4 @@ fs.mkdirSync(destDir + '/assets');

fs.writeFileSync(destDir + '/assets/assetMap.json', stringify(toWrite));
fs.writeFileSync(destDir + '/assets/' + fileName, contents);
this.assetMap['assets/assetMap.json'] = 'assets/' + fileName;
};

@@ -108,0 +113,0 @@

2

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

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

@@ -83,3 +83,3 @@ var fs = require('fs');

var actualFiles = walkSync(graph.directory);
var pathPresent = confirmPathPresent(actualFiles, /manifest-[0-9a-f]{32}.json/);
var pathPresent = confirmPathPresent(actualFiles, /manifest-[0-9a-f]{32}\.json/);

@@ -103,3 +103,3 @@ assert(pathPresent, "manifest file not found");

var actualFiles = walkSync(graph.directory);
var pathPresent = confirmPathPresent(actualFiles, /manifest.json/);
var pathPresent = confirmPathPresent(actualFiles, /manifest\.json/);

@@ -110,2 +110,39 @@ assert(pathPresent, "manifest file not found");

it('generates an asset map if requested', function () {
var sourcePath = 'tests/fixtures/basic';
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
generateAssetMap: true,
replaceExtensions: ['html', 'js', 'css']
});
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {
var actualFiles = walkSync(graph.directory);
var pathPresent = confirmPathPresent(actualFiles, /assetMap\.json/);
assert(pathPresent, "asset map file not found");
});
});
it("fingerprints the asset map if requested", function () {
var sourcePath = 'tests/fixtures/basic';
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
fingerprintAssetMap: true,
generateAssetMap: true,
replaceExtensions: ['html', 'js', 'css']
});
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {
var actualFiles = walkSync(graph.directory);
var pathPresent = confirmPathPresent(actualFiles, /assetMap-[0-9a-f]{32}\.json/);
assert(pathPresent, "fingerprinted asset map file not found");
});
});
it('will prepend if set', function () {

@@ -112,0 +149,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