broccoli-asset-rev
Advanced tools
Comparing version
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23076
157.23%28
300%270
71.97%0
-100%65
41.3%4
Infinity%3
50%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed