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

broccoli-asset-rewrite

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-asset-rewrite - npm Package Compare versions

Comparing version 1.0.15 to 1.1.0

29

index.js

@@ -85,2 +85,6 @@ var Filter = require('broccoli-filter');

AssetRewrite.prototype.rewriteAssetPath = function (string, assetPath, replacementPath) {
// Early exit: does the file contain the asset path?
if (string.indexOf(assetPath) === -1) return string;
var newString = string;

@@ -93,17 +97,16 @@

*
* ["\'\\(=]{1} - Match one of "'(= exactly one time
* ["\'(=] - Match one of "'(= exactly one time
* \\s* - Any amount of white space
* ( - Starts the first pattern match
* [^"\'\\(\\)=]* - Do not match any of ^"'()= 0 or more times
* /([.*+?^=!:${}()|\[\]\/\\])/g - Replace .*+?^=!:${}()|[]/\ in filenames with an escaped version for an exact name match
* [^"\'\\(\\)\\\\>=]* - Do not match any of ^"'()\>= 0 or more times - Explicitly add \ here because of handlebars compilation
* ) - End first pattern match
* (\\?[^"\'\\)> ]*)? - Allow for query parameters to be present after the URL of an asset
* ( - Starts the first capture group
* [^"\'()=]* - Do not match any of ^"'()= 0 or more times
* [^"\'()\\>=]* - Do not match any of ^"'()\>= 0 or more times - Explicitly add \ here because of handlebars compilation
* ) - End first capture group
* (\\?[^"\')> ]*)? - Allow for query parameters to be present after the URL of an asset
* \\s* - Any amount of white space
* [\\\\]* - Allow any amount of \ - For handlebars compilation (includes \\\)
* \\\\* - Allow any amount of \ - For handlebars compilation (includes \\\)
* \\s* - Any amount of white space
* ["\'\\)> ]{1} - Match one of "'( > exactly one time
* ["\')> ] - Match one of "'( > exactly one time
*/
var re = new RegExp('["\'\\(=]{1}\\s*([^"\'\\(\\)=]*' + escapeRegExp(assetPath) + '[^"\'\\(\\)\\\\>=]*)(\\?[^"\'\\)> ]*)?\\s*[\\\\]*\\s*["\'\\)> ]{1}', 'g');
var re = new RegExp('["\'(=]\\s*([^"\'()=]*' + escapeRegExp(assetPath) + '[^"\'()\\>=]*)(\\?[^"\')> ]*)?\\s*\\\\*\\s*["\')> ]', 'g');
var match = null;

@@ -114,3 +117,3 @@ /*

*/
var ignoreLibraryCode = new RegExp('(%22|%27|%5C|%28|%29|%3D)[^"\'\\(\\)=]*' + escapeRegExp(assetPath));
var ignoreLibraryCode = new RegExp('%(22|27|5C|28|29|3D)[^"\'()=]*' + escapeRegExp(assetPath));

@@ -132,2 +135,3 @@ while (match = re.exec(newString)) {

}
var self = this;

@@ -192,2 +196,5 @@ return newString.replace(new RegExp('sourceMappingURL=' + escapeRegExp(assetPath)), function(wholeMatch) {

/*
* /([.*+?^=!:${}()|\[\]\/\\])/g - Replace .*+?^=!:${}()|[]/\ in filenames with an escaped version for an exact name match
*/
function escapeRegExp(string) {

@@ -194,0 +201,0 @@ return string.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");

{
"name": "broccoli-asset-rewrite",
"version": "1.0.15",
"version": "1.1.0",
"description": "broccoli plugin to rewrite a source tree from an asset map.",

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

"istanbul": "^0.4.1",
"mocha": "~1.20.1",
"mocha": "~3.0.2",
"walk-sync": "~0.1.2"
}
}
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