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.0 to 2.1.1

tests/fixtures/basic/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png

2

index.js

@@ -15,3 +15,3 @@ var path = require('path');

}
// Allow simply setting { fingerprint: false } as a shortcut option to disable

@@ -18,0 +18,0 @@ if (this.app.options.fingerprint === false) {

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

function Fingerprint(inputTree, options) {
function Fingerprint(inputNode, options) {
if (!(this instanceof Fingerprint)) {
return new Fingerprint(inputTree, options);
return new Fingerprint(inputNode, options);
}

@@ -18,5 +18,7 @@

this.inputTree = inputTree;
Filter.call(this, inputNode, {
extensions: options.extensions || []
})
this.assetMap = options.assetMap || {};
this.extensions = options.extensions || [];
this.exclude = options.exclude || [];

@@ -73,3 +75,3 @@ this.description = options.description;

var tmpPath = path.join(this._srcDir, relativePath);
var file = fs.readFileSync(tmpPath, { encoding: 'utf8' });
var file = fs.readFileSync(tmpPath, { encoding: null });
var hash;

@@ -166,12 +168,12 @@

Fingerprint.prototype.write = function(readTree, destDir) {
Fingerprint.prototype.build = function() {
var self = this;
return Filter.prototype.write.apply(this, arguments).then(function() {
return Filter.prototype.build.call(this).then(function() {
if (!!self.generateAssetMap) {
self.writeAssetMap(destDir);
self.writeAssetMap(self.outputPath);
}
if (!!self.generateRailsManifest) {
self.writeRailsManifest(destDir);
self.writeRailsManifest(self.outputPath);
}

@@ -178,0 +180,0 @@ });

{
"name": "broccoli-asset-rev",
"version": "2.1.0",
"version": "2.1.1",
"description": "broccoli asset revisions (fingerprint)",

@@ -33,4 +33,4 @@ "main": "lib/asset-rev.js",

"dependencies": {
"broccoli-asset-rewrite": "^1.0.4",
"broccoli-filter": "~0.1.6",
"broccoli-asset-rewrite": "^1.0.9",
"broccoli-filter": "~0.2.0",
"rsvp": "~3.0.6"

@@ -37,0 +37,0 @@ },

@@ -28,5 +28,5 @@ #broccoli-asset-rev

```js
var assetRev = require('broccoli-asset-rev');
var AssetRev = require('broccoli-asset-rev');
var assetTree = assetRev(tree, {
var assetNode = new AssetRev(node, {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],

@@ -46,4 +46,4 @@ exclude: ['fonts/169929'],

- `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. If it is set to `null`, fingerprinting is skipped and only prepending occurs.
- `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:
- `customHash` - Default: none - If set, overrides the md5 checksum calculation with the result of calling `customHash(buffer, pathToFile)`. If it is not a `function`, `customHash` is used as the hash value. If it is set to `null`, fingerprinting is skipped and only prepending occurs.
- `generateAssetMap` - Default: false. If true, will generate a `assetMap.json` file in a `assets` directory on the output node. This file contains a mapping of the original asset name to the fingerprinted asset, like the following:

@@ -50,0 +50,0 @@ ```js

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

var broccoli = require('broccoli');
var mergeTrees = require('broccoli-merge-trees');
var assetRev = require('../lib/asset-rev');
var MergeTrees = require('broccoli-merge-trees');
var AssetRev = require('../lib/asset-rev');
var sinon = require('sinon');

@@ -45,3 +45,3 @@ var builder;

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

@@ -51,3 +51,3 @@ replaceExtensions: ['html', 'js', 'css']

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -61,5 +61,5 @@ confirmOutput(graph.directory, sourcePath + '/output');

var merged = mergeTrees([sourcePath + '/input']);
var merged = new MergeTrees([sourcePath + '/input']);
var tree = assetRev(merged, {
var node = new AssetRev(merged, {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],

@@ -69,3 +69,3 @@ replaceExtensions: ['html', 'js', 'css']

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -79,3 +79,3 @@ confirmOutput(graph.directory, sourcePath + '/output');

var tree = assetRev(sourcePath + '/input', {
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],

@@ -86,3 +86,3 @@ generateRailsManifest: true,

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -99,3 +99,3 @@ var actualFiles = walkSync(graph.directory);

var tree = assetRev(sourcePath + '/input', {
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],

@@ -107,3 +107,3 @@ exclude: ['manifest.json'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -120,3 +120,3 @@ var actualFiles = walkSync(graph.directory);

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

@@ -127,3 +127,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -137,3 +137,3 @@ confirmOutput(graph.directory, sourcePath + '/output');

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

@@ -145,3 +145,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -155,3 +155,3 @@ confirmOutput(graph.directory, sourcePath + '/output-customHash-null');

var tree = assetRev(sourcePath + '/input-output', {
var node = new AssetRev(sourcePath + '/input-output', {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],

@@ -162,3 +162,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -172,3 +172,3 @@ confirmOutput(graph.directory, sourcePath + '/input-output');

var tree = assetRev(sourcePath + '/input', {
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'woff', 'woff2', 'ttf', 'svg', 'eot'],

@@ -178,3 +178,3 @@ replaceExtensions: ['html', 'js' ,'css']

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function (graph) {

@@ -188,3 +188,3 @@ confirmOutput(graph.directory, sourcePath + '/output');

var tree = assetRev(sourcePath + '/input', {
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],

@@ -195,3 +195,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -205,3 +205,3 @@ confirmOutput(graph.directory, sourcePath + '/output');

var tree = assetRev(sourcePath + '/input', {
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif'],

@@ -216,3 +216,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -235,3 +235,3 @@ confirmOutput(graph.directory, sourcePath + '/output');

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

@@ -242,3 +242,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -263,3 +263,3 @@ confirmOutput(graph.directory, sourcePath + '/output');

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

@@ -270,3 +270,3 @@ replaceExtensions: ['html', 'js', 'css'],

builder = new broccoli.Builder(tree);
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {

@@ -273,0 +273,0 @@ confirmOutput(graph.directory, sourcePath + '/output');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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