svg-sprite-loader
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="3.0.6"></a> | ||
## [3.0.6](https://github.com/kisenka/webpack-svg-sprite-loader/compare/v3.0.5...v3.0.6) (2017-07-17) | ||
<a name="3.0.5"></a> | ||
@@ -7,0 +12,0 @@ ## [3.0.5](https://github.com/kisenka/webpack-svg-sprite-loader/compare/v3.0.4...v3.0.5) (2017-06-02) |
@@ -56,3 +56,4 @@ const { interpolateName, getOptions } = require('loader-utils'); | ||
const matchedRules = utils.getMatchedRules(resource, utils.getLoadersRules(compiler)); | ||
const issuer = loaderContext._module && loaderContext._module.issuer; | ||
const matchedRules = utils.getMatchedRules(resource, utils.getLoadersRules(compiler), issuer); | ||
if (matchedRules.length > 1 && !compiler.isChild()) { | ||
@@ -59,0 +60,0 @@ this.emitWarning(new Exceptions.SeveralRulesAppliedException(resource, matchedRules)); |
@@ -1,3 +0,5 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const ruleMatcher = require('webpack/lib/ModuleFilenameHelpers').matchObject; | ||
const isWebpack1 = require('./is-webpack-1'); | ||
const RuleSet = !isWebpack1 ? require('webpack/lib/RuleSet') : null; | ||
@@ -9,6 +11,20 @@ /** | ||
*/ | ||
function getMatchedRules(request, rules) { | ||
return rules.filter(rule => ruleMatcher(rule, request)); | ||
function getMatchedRules(request, rules, issuer) { | ||
const matchedRules = rules.filter(rule => ruleMatcher(rule, request)); | ||
if (issuer) { | ||
return matchedRules.filter((rule) => { | ||
// If rule doesn't have an issuer or RuleSet is not available | ||
if (!rule.issuer || !RuleSet) { | ||
return true; | ||
} | ||
const matcher = RuleSet.normalizeCondition(rule.issuer); | ||
return matcher(issuer); | ||
}); | ||
} | ||
return matchedRules; | ||
} | ||
module.exports = getMatchedRules; |
{ | ||
"name": "svg-sprite-loader", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "SVG sprite loader for Webpack", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/kisenka/webpack-svg-sprite-loader#readme", |
25502
1137988
96