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.3 to 2.0.4

.travis.yml

8

lib/fingerprint.js

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

if (typeof options.customHash === 'function') {
this.customHash = null;
this.customHash = '';
this.hashFn = options.customHash;

@@ -59,6 +59,10 @@ } else {

Fingerprint.prototype.getDestFilePath = function (relativePath) {
if (Filter.prototype.getDestFilePath.apply(this, arguments)) {
var destFilePath = Filter.prototype.getDestFilePath.apply(this, arguments);
if (destFilePath) {
if (this.assetMap[relativePath]) {
return this.assetMap[relativePath];
}
if (this.customHash === null) {
return this.assetMap[relativePath] = destFilePath;
}

@@ -65,0 +69,0 @@ var tmpPath = path.join(this._srcDir, relativePath);

{
"name": "broccoli-asset-rev",
"version": "2.0.3",
"version": "2.0.4",
"description": "broccoli asset revisions (fingerprint)",

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

@@ -46,3 +46,12 @@ #broccoli-asset-rev

- `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.
- `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:
```js
{
assets: {
css/file1.css: css/file1-sdaa7d6a87d6ada78ds.css,
images/image1.png: images/image1-sdaa7d6a87d6ada78ds.css, }
}
```
## Ember CLI addon usage

@@ -49,0 +58,0 @@

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

var tree = assetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],
replaceExtensions: ['html', 'js', 'css']

@@ -57,3 +57,3 @@ });

var tree = assetRev(merged, {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],
replaceExtensions: ['html', 'js', 'css']

@@ -72,3 +72,3 @@ });

var tree = assetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],
replaceExtensions: ['html', 'js', 'css'],

@@ -84,2 +84,33 @@ prepend: 'https://foobar.cloudfront.net/'

it('skips fingerprint and prepends when set and customHash is null', function () {
var sourcePath = 'tests/fixtures/prepend';
var tree = assetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],
replaceExtensions: ['html', 'js', 'css'],
prepend: 'https://foobar.cloudfront.net/',
customHash: null
});
builder = new broccoli.Builder(tree);
return builder.build().then(function(graph) {
confirmOutput(graph.directory, sourcePath + '/output-customHash-null');
});
});
it('skips fingerprint when customHash is null', function () {
var sourcePath = 'tests/fixtures/customHash-null';
var tree = assetRev(sourcePath + '/input-output', {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],
replaceExtensions: ['html', 'js', 'css'],
customHash: null
});
builder = new broccoli.Builder(tree);
return builder.build().then(function(graph) {
confirmOutput(graph.directory, sourcePath + '/input-output');
});
});
it('replaces the correct match for the file extension', function () {

@@ -86,0 +117,0 @@ var sourcePath = 'tests/fixtures/extensions';

Sorry, the diff of this file is not supported yet

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