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.3.1 to 1.0.0

tests/filter-tests.js

10

index.js
var path = require('path');
var fs = require('fs');

@@ -16,5 +15,10 @@ var assetRev = require('./lib/asset-rev');

}
// Allow simply setting { fingerprint: false } as a shortcut option to disable
if (this.app.options.fingerprint === false) {
this.options = this.app.options.fingerprint = { enabled: false };
} else {
this.options = this.app.options.fingerprint = this.app.options.fingerprint || {};
}
this.options = this.app.options.fingerprint = this.app.options.fingerprint || {};
for (var option in defaultOptions) {

@@ -21,0 +25,0 @@ if (!this.options.hasOwnProperty(option)) {

@@ -35,6 +35,8 @@ var fs = require('fs');

return Filter.prototype.canProcessFile.apply(this, arguments);
return Filter.prototype.getDestFilePath.apply(this, arguments) != null;
};
Fingerprint.prototype.processFile = function (srcDir, destDir, relativePath) {
this._srcDir = srcDir;
var file = fs.readFileSync(srcDir + '/' + relativePath);

@@ -51,3 +53,7 @@ var self = this;

if (Filter.prototype.getDestFilePath.apply(this, arguments)) {
var tmpPath = path.join(this.inputTree.tmpDestDir, relativePath);
if (this.assetMap[relativePath]) {
return this.assetMap[relativePath];
}
var tmpPath = path.join(this._srcDir, relativePath);
var file = fs.readFileSync(tmpPath, { encoding: 'utf8' });

@@ -54,0 +60,0 @@ var hash;

{
"name": "broccoli-asset-rev",
"version": "0.3.1",
"version": "1.0.0",
"description": "broccoli asset revisions (fingerprint)",
"main": "lib/asset-rev.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha tests"
},

@@ -30,6 +30,12 @@ "repository": {

"dependencies": {
"broccoli-asset-rewrite": "^0.1.0",
"broccoli-asset-rewrite": "^1.0.0",
"broccoli-filter": "~0.1.6",
"rsvp": "~3.0.6"
},
"devDependencies": {
"broccoli": "^0.13.3",
"broccoli-merge-trees": "^0.2.1",
"mocha": "^2.0.1",
"walk-sync": "^0.1.3"
}
}

@@ -46,1 +46,20 @@ #broccoli-asset-rev

- `customHash` - Default: none - If defined, will be appended to filename instead of a md5 checksum.
## Ember CLI addon usage
```js
var app = new EmberApp({
fingerprint: {
exclude: ['fonts/169929'],
prepend: 'https://sudomain.cloudfront.net/'
}
});
```
## Ember CLI addon options
- `enabled` - Default: `app.env === 'production'` - Boolean. Enables fingerprinting if true. **True by default if current environment is production.**
- `exclude` - Default: `[]` - An array of strings. If a filename contains any item in the exclude array, it will not be fingerprinted.
- `extensions` - Default: `['js', 'css', 'png', 'jpg', 'gif']` - The file types to add md5 checksums.
- `prepend` - Default: `''` - A string to prepend to all of the assets. Useful for CDN urls like `https://subdomain.cloudfront.net/`
- `replaceExtensions` - Default: `['html', 'css', 'js']` - The file types to replace source code with new checksum file names.

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