Socket
Socket
Sign inDemoInstall

broccoli-asset-rewrite

Package Overview
Dependencies
31
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.11 to 1.0.12

circle.yml

11

index.js

@@ -119,6 +119,7 @@ var Filter = require('broccoli-filter');

if (this.prepend && this.prepend !== '') {
replaceString = this.prepend + replacementPath;
} else {
replaceString = match[1].replace(assetPath, replacementPath);
replaceString = match[1].replace(assetPath, replacementPath);
if (this.prepend && replaceString.indexOf(this.prepend) !== 0) {
var removeLeadingSlashRegex = new RegExp('^/?(.*)$');
replaceString = this.prepend + removeLeadingSlashRegex.exec(replaceString)[1];
}

@@ -131,3 +132,3 @@

var replaceString = replacementPath;
if (self.prepend && self.prepend !== '' && (!/^sourceMappingURL=(http|https|\/\/)/.test(wholeMatch))) {
if (self.prepend && (!/^sourceMappingURL=(http|https|\/\/)/.test(wholeMatch))) {
replaceString = self.prepend + replacementPath;

@@ -134,0 +135,0 @@ }

{
"name": "broccoli-asset-rewrite",
"version": "1.0.11",
"version": "1.0.12",
"description": "broccoli plugin to rewrite a source tree from an asset map.",
"main": "index.js",
"scripts": {
"test": "mocha tests"
"test": "mocha tests",
"test:cover": "istanbul cover ./node_modules/mocha/bin/_mocha tests"
},

@@ -31,2 +32,4 @@ "repository": {

"broccoli": "^0.16.9",
"codecov": "^1.0.1",
"istanbul": "^0.4.1",
"mocha": "~1.20.1",

@@ -33,0 +36,0 @@ "walk-sync": "~0.1.2"

#broccoli-asset-rewrite
[![CircleCI](https://img.shields.io/circleci/project/rickharrison/broccoli-asset-rewrite.svg)](https://circleci.com/gh/rickharrison/broccoli-asset-rewrite)
[![codecov.io](https://codecov.io/github/rickharrison/broccoli-asset-rewrite/coverage.svg?branch=master&precision=2)](https://codecov.io/github/rickharrison/broccoli-asset-rewrite?branch=master)
[![npm](https://img.shields.io/npm/v/broccoli-asset-rewrite.svg)](https://www.npmjs.com/package/broccoli-asset-rewrite)
[Broccoli](https://github.com/broccolijs/broccoli) plugin to rewrite a source node from an asset map.

@@ -53,1 +57,3 @@

- `annotation` - Default: null - A human-readable description for this plugin instance.
[![ghit.me](https://ghit.me/badge.svg?repo=rickharrison/broccoli-asset-rewrite)](https://ghit.me/repo/rickharrison/broccoli-asset-rewrite)

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

var sourcePath = 'tests/fixtures/basic';
var node = new AssetRewrite(sourcePath + '/input', {
var node = AssetRewrite(sourcePath + '/input', {
assetMap: {

@@ -96,2 +96,3 @@ 'foo/bar/widget.js': 'blahzorz-1.js',

'foo/bar/widget.js': 'blahzorz-1.js',
'dont/fingerprint/me.js': 'dont/fingerprint/me.js',
'images/sample.png': 'images/fingerprinted-sample.png',

@@ -161,2 +162,47 @@ 'assets/images/foobar.png': 'assets/images/foobar-fingerprint.png'

});
it('maintains fragments', function () {
var sourcePath = 'tests/fixtures/fragments';
var node = new AssetRewrite(sourcePath + '/input', {
assetMap: {
'images/defs.svg': 'images/fingerprinted-defs.svg'
}
});
builder = new broccoli.Builder(node);
return builder.build().then(function (graph) {
confirmOutput(graph.directory, sourcePath + '/output');
});
});
it('maintains fragments with prepend', function () {
var sourcePath = 'tests/fixtures/fragments-prepend';
var node = new AssetRewrite(sourcePath + '/input', {
assetMap: {
'images/defs.svg': 'images/fingerprinted-defs.svg'
},
prepend: 'https://cloudfront.net/'
});
builder = new broccoli.Builder(node);
return builder.build().then(function (graph) {
confirmOutput(graph.directory, sourcePath + '/output');
});
});
it('replaces absolute URLs with prepend', function () {
var sourcePath = 'tests/fixtures/absolute-prepend';
var node = new AssetRewrite(sourcePath + '/input', {
assetMap: {
'my-image.png': 'my-image-fingerprinted.png',
'dont/fingerprint/me.js': 'dont/fingerprint/me.js'
},
prepend: 'https://cloudfront.net/'
});
builder = new broccoli.Builder(node);
return builder.build().then(function (graph) {
confirmOutput(graph.directory, sourcePath + '/output');
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc