Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-rev-all

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-rev-all - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

test/fixtures/config1/script/no_space_after_map.js

2

package.json
{
"name": "gulp-rev-all",
"version": "0.8.2",
"version": "0.8.3",
"description": "Static asset revisioning by appending content hash to filenames: unicorn.css => unicorn.098f6bcd.css, also re-writes references in each file to new reved name.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,6 +19,6 @@ # [gulp](https://github.com/wearefractal/gulp)-rev-all [![Build Status](https://travis-ci.org/smysnk/gulp-rev-all.png?branch=master)](https://travis-ci.org/smysnk/gulp-rev-all)

This project was forked from [gulp-rev](https://github.com/sindresorhus/gulp-rev) to add reference processing and rewriting functionality.
It is the philosophy of `gulp-rev` that concerns should be seperated between revisioning the files and correcting internal references. That is to say it is not `gulp-rev`'s responsibility to analyse or re-write references.
`gulp-rev-all` does not agree with this idea for the simple reason that to accurately calculate a file's hash for caching purposes you need to take child references in to consideration.
It is the philosophy of `gulp-rev` that concerns should be seperated between revisioning the files and re-writing references to those files. `gulp-rev-all` does not agree with this, we believe you need analyze each revisioned files' references, to calculate a final hash for caching purposes.
eg. A revisioned css file makes a reference to an image. If the image contents changes, the hash of the css file will remain the same since none of its contents have changed. Web clients that have previously cached this css file will not correctly resolve the new image file.
### Consider the following example:
A css file makes reference to an image. If the image changes, the hash of the css file remains the same since its contents have not changed. Web clients that have previously cached this css file will not correctly resolve the new image.
If we take in to consideration the dependency graph while calculating the css file hash, we can have it change if any of it child references have changed.

@@ -39,5 +39,2 @@

Warning: From v0.7 to v0.8 was a fairly substanial re-write and I highly suspect I broke some things! Treat v0.8 as an alpha!
## Install

@@ -44,0 +41,0 @@

@@ -169,3 +169,3 @@ var gracefulfs = require('graceful-fs');

// Expect left and right sides of the reference to be a non-filename type character, escape special regex chars
var regExp = '([^a-z0-9\\.\\-\\_/])(' + reference.path.replace(/([^0-9a-z])/ig, '\\$1') + ')([^a-z0-9\\.\\-\\_])';
var regExp = '([^a-z0-9\\.\\-\\_/])(' + reference.path.replace(/([^0-9a-z])/ig, '\\$1') + ')([^a-z0-9\\.\\-\\_]|$)';
regExp = new RegExp(regExp, 'g');

@@ -172,0 +172,0 @@

@@ -640,3 +640,3 @@ var RevAll = require('./index');

describe('main js', function () {
describe('reference resolution', function () {

@@ -732,18 +732,40 @@ it('should not resolve arbitrarty text with the same name as a file', function (done) {

it('should resolve references to source map', function (done) {
describe('source map', function () {
setup();
it('should resolve reference with spaces after map statement', function (done) {
setup();
streamRevision.on('data', function (file) { });
streamRevision.on('end', function () {
var contents = String(files['/script/app.js'].contents);
contents.should.containEql('//# sourceMappingURL=' + files['/script/app.js.map'].revFilename);
done();
streamRevision.on('data', function (file) { });
streamRevision.on('end', function () {
});
var contents = String(files['/script/app.js'].contents);
contents.should.containEql('//# sourceMappingURL=' + files['/script/app.js.map'].revFilename);
done();
Tool.write_glob_to_stream(base, 'test/fixtures/config1/**', streamRevision);
});
Tool.write_glob_to_stream(base, 'test/fixtures/config1/**', streamRevision);
});
it('should resolve reference with no characters after map statement', function (done) {
setup();
streamRevision.on('data', function (file) { });
streamRevision.on('end', function () {
var contents = String(files['/script/no_space_after_map.js'].contents);
contents.should.containEql('//# sourceMappingURL=' + files['/script/no_space_after_map.js.map'].revFilename);
done();
});
Tool.write_glob_to_stream(base, 'test/fixtures/config1/**', streamRevision);
});
});

@@ -750,0 +772,0 @@

@@ -52,2 +52,2 @@ 'use strict';

//# sourceMappingURL=app.js.map
//# sourceMappingURL=app.js.map
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