broccoli-asset-rewrite
Advanced tools
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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
79009
569
0