This commit is contained in:
XhmikosR 2019-01-10 17:13:19 +02:00
Родитель 8df237f0ed
Коммит 0d5650b3f0
3 изменённых файлов: 174 добавлений и 112 удалений

252
dist/browser/bootlint.js поставляемый
Просмотреть файл

@ -1,7 +1,7 @@
/*!
* Bootlint v0.15.1 (https://github.com/twbs/bootlint)
* Bootlint v0.16.0 (https://github.com/twbs/bootlint)
* HTML linter for Bootstrap projects
* Copyright (c) 2014-2018 The Bootlint Authors
* Copyright (c) 2014-2019 The Bootlint Authors
* Licensed under the MIT License (https://github.com/twbs/bootlint/blob/master/LICENSE).
*/
@ -10808,7 +10808,10 @@ for (var i = 0; i < R; i++) {
}
exports.parse = parse;
function parse(version, loose) {
function parse(version, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (version instanceof SemVer)
return version;
@ -10818,35 +10821,37 @@ function parse(version, loose) {
if (version.length > MAX_LENGTH)
return null;
var r = loose ? re[LOOSE] : re[FULL];
var r = options.loose ? re[LOOSE] : re[FULL];
if (!r.test(version))
return null;
try {
return new SemVer(version, loose);
return new SemVer(version, options);
} catch (er) {
return null;
}
}
exports.valid = valid;
function valid(version, loose) {
var v = parse(version, loose);
function valid(version, options) {
var v = parse(version, options);
return v ? v.version : null;
}
exports.clean = clean;
function clean(version, loose) {
var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
function clean(version, options) {
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
return s ? s.version : null;
}
exports.SemVer = SemVer;
function SemVer(version, loose) {
function SemVer(version, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (version instanceof SemVer) {
if (version.loose === loose)
if (version.loose === options.loose)
return version;
else
version = version.version;
@ -10858,11 +10863,13 @@ function SemVer(version, loose) {
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
if (!(this instanceof SemVer))
return new SemVer(version, loose);
return new SemVer(version, options);
debug('SemVer', version, loose);
this.loose = loose;
var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
debug('SemVer', version, options);
this.options = options;
this.loose = !!options.loose;
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
if (!m)
throw new TypeError('Invalid Version: ' + version);
@ -10912,16 +10919,16 @@ SemVer.prototype.toString = function() {
};
SemVer.prototype.compare = function(other) {
debug('SemVer.compare', this.version, this.loose, other);
debug('SemVer.compare', this.version, this.options, other);
if (!(other instanceof SemVer))
other = new SemVer(other, this.loose);
other = new SemVer(other, this.options);
return this.compareMain(other) || this.comparePre(other);
};
SemVer.prototype.compareMain = function(other) {
if (!(other instanceof SemVer))
other = new SemVer(other, this.loose);
other = new SemVer(other, this.options);
return compareIdentifiers(this.major, other.major) ||
compareIdentifiers(this.minor, other.minor) ||
@ -10930,7 +10937,7 @@ SemVer.prototype.compareMain = function(other) {
SemVer.prototype.comparePre = function(other) {
if (!(other instanceof SemVer))
other = new SemVer(other, this.loose);
other = new SemVer(other, this.options);
// NOT having a prerelease is > having one
if (this.prerelease.length && !other.prerelease.length)
@ -11221,19 +11228,23 @@ function cmp(a, op, b, loose) {
}
exports.Comparator = Comparator;
function Comparator(comp, loose) {
function Comparator(comp, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (comp instanceof Comparator) {
if (comp.loose === loose)
if (comp.loose === !!options.loose)
return comp;
else
comp = comp.value;
}
if (!(this instanceof Comparator))
return new Comparator(comp, loose);
return new Comparator(comp, options);
debug('comparator', comp, loose);
this.loose = loose;
debug('comparator', comp, options);
this.options = options;
this.loose = !!options.loose;
this.parse(comp);
if (this.semver === ANY)
@ -11246,7 +11257,7 @@ function Comparator(comp, loose) {
var ANY = {};
Comparator.prototype.parse = function(comp) {
var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var m = comp.match(r);
if (!m)
@ -11260,7 +11271,7 @@ Comparator.prototype.parse = function(comp) {
if (!m[2])
this.semver = ANY;
else
this.semver = new SemVer(m[2], this.loose);
this.semver = new SemVer(m[2], this.options.loose);
};
Comparator.prototype.toString = function() {
@ -11268,30 +11279,33 @@ Comparator.prototype.toString = function() {
};
Comparator.prototype.test = function(version) {
debug('Comparator.test', version, this.loose);
debug('Comparator.test', version, this.options.loose);
if (this.semver === ANY)
return true;
if (typeof version === 'string')
version = new SemVer(version, this.loose);
version = new SemVer(version, this.options);
return cmp(version, this.operator, this.semver, this.loose);
return cmp(version, this.operator, this.semver, this.options);
};
Comparator.prototype.intersects = function(comp, loose) {
Comparator.prototype.intersects = function(comp, options) {
if (!(comp instanceof Comparator)) {
throw new TypeError('a Comparator is required');
}
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var rangeTmp;
if (this.operator === '') {
rangeTmp = new Range(comp.value, loose);
return satisfies(this.value, rangeTmp, loose);
rangeTmp = new Range(comp.value, options);
return satisfies(this.value, rangeTmp, options);
} else if (comp.operator === '') {
rangeTmp = new Range(this.value, loose);
return satisfies(comp.semver, rangeTmp, loose);
rangeTmp = new Range(this.value, options);
return satisfies(comp.semver, rangeTmp, options);
}
var sameDirectionIncreasing =
@ -11305,11 +11319,11 @@ Comparator.prototype.intersects = function(comp, loose) {
(this.operator === '>=' || this.operator === '<=') &&
(comp.operator === '>=' || comp.operator === '<=');
var oppositeDirectionsLessThan =
cmp(this.semver, '<', comp.semver, loose) &&
cmp(this.semver, '<', comp.semver, options) &&
((this.operator === '>=' || this.operator === '>') &&
(comp.operator === '<=' || comp.operator === '<'));
var oppositeDirectionsGreaterThan =
cmp(this.semver, '>', comp.semver, loose) &&
cmp(this.semver, '>', comp.semver, options) &&
((this.operator === '<=' || this.operator === '<') &&
(comp.operator === '>=' || comp.operator === '>'));
@ -11320,23 +11334,29 @@ Comparator.prototype.intersects = function(comp, loose) {
exports.Range = Range;
function Range(range, loose) {
function Range(range, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
if (range instanceof Range) {
if (range.loose === loose) {
if (range.loose === !!options.loose &&
range.includePrerelease === !!options.includePrerelease) {
return range;
} else {
return new Range(range.raw, loose);
return new Range(range.raw, options);
}
}
if (range instanceof Comparator) {
return new Range(range.value, loose);
return new Range(range.value, options);
}
if (!(this instanceof Range))
return new Range(range, loose);
return new Range(range, options);
this.loose = loose;
this.options = options;
this.loose = !!options.loose;
this.includePrerelease = !!options.includePrerelease
// First, split based on boolean or ||
this.raw = range;
@ -11366,9 +11386,8 @@ Range.prototype.toString = function() {
};
Range.prototype.parseRange = function(range) {
var loose = this.loose;
var loose = this.options.loose;
range = range.trim();
debug('range', range, loose);
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
range = range.replace(hr, hyphenReplace);
@ -11391,22 +11410,22 @@ Range.prototype.parseRange = function(range) {
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var set = range.split(' ').map(function(comp) {
return parseComparator(comp, loose);
}).join(' ').split(/\s+/);
if (this.loose) {
return parseComparator(comp, this.options);
}, this).join(' ').split(/\s+/);
if (this.options.loose) {
// in loose mode, throw out any that are not valid comparators
set = set.filter(function(comp) {
return !!comp.match(compRe);
});
}
set = set.map(function(comp) {
return new Comparator(comp, loose);
});
return new Comparator(comp, this.options);
}, this);
return set;
};
Range.prototype.intersects = function(range, loose) {
Range.prototype.intersects = function(range, options) {
if (!(range instanceof Range)) {
throw new TypeError('a Range is required');
}
@ -11415,7 +11434,7 @@ Range.prototype.intersects = function(range, loose) {
return thisComparators.every(function(thisComparator) {
return range.set.some(function(rangeComparators) {
return rangeComparators.every(function(rangeComparator) {
return thisComparator.intersects(rangeComparator, loose);
return thisComparator.intersects(rangeComparator, options);
});
});
});
@ -11424,8 +11443,8 @@ Range.prototype.intersects = function(range, loose) {
// Mostly just for testing and legacy API reasons
exports.toComparators = toComparators;
function toComparators(range, loose) {
return new Range(range, loose).set.map(function(comp) {
function toComparators(range, options) {
return new Range(range, options).set.map(function(comp) {
return comp.map(function(c) {
return c.value;
}).join(' ').trim().split(' ');
@ -11435,15 +11454,15 @@ function toComparators(range, loose) {
// comprised of xranges, tildes, stars, and gtlt's at this point.
// already replaced the hyphen ranges
// turn into a set of JUST comparators.
function parseComparator(comp, loose) {
debug('comp', comp);
comp = replaceCarets(comp, loose);
function parseComparator(comp, options) {
debug('comp', comp, options);
comp = replaceCarets(comp, options);
debug('caret', comp);
comp = replaceTildes(comp, loose);
comp = replaceTildes(comp, options);
debug('tildes', comp);
comp = replaceXRanges(comp, loose);
comp = replaceXRanges(comp, options);
debug('xrange', comp);
comp = replaceStars(comp, loose);
comp = replaceStars(comp, options);
debug('stars', comp);
return comp;
}
@ -11458,14 +11477,16 @@ function isX(id) {
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
function replaceTildes(comp, loose) {
function replaceTildes(comp, options) {
return comp.trim().split(/\s+/).map(function(comp) {
return replaceTilde(comp, loose);
return replaceTilde(comp, options);
}).join(' ');
}
function replaceTilde(comp, loose) {
var r = loose ? re[TILDELOOSE] : re[TILDE];
function replaceTilde(comp, options) {
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var r = options.loose ? re[TILDELOOSE] : re[TILDE];
return comp.replace(r, function(_, M, m, p, pr) {
debug('tilde', comp, _, M, m, p, pr);
var ret;
@ -11499,15 +11520,17 @@ function replaceTilde(comp, loose) {
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
// ^1.2.3 --> >=1.2.3 <2.0.0
// ^1.2.0 --> >=1.2.0 <2.0.0
function replaceCarets(comp, loose) {
function replaceCarets(comp, options) {
return comp.trim().split(/\s+/).map(function(comp) {
return replaceCaret(comp, loose);
return replaceCaret(comp, options);
}).join(' ');
}
function replaceCaret(comp, loose) {
debug('caret', comp, loose);
var r = loose ? re[CARETLOOSE] : re[CARET];
function replaceCaret(comp, options) {
debug('caret', comp, options);
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var r = options.loose ? re[CARETLOOSE] : re[CARET];
return comp.replace(r, function(_, M, m, p, pr) {
debug('caret', comp, _, M, m, p, pr);
var ret;
@ -11554,16 +11577,18 @@ function replaceCaret(comp, loose) {
});
}
function replaceXRanges(comp, loose) {
debug('replaceXRanges', comp, loose);
function replaceXRanges(comp, options) {
debug('replaceXRanges', comp, options);
return comp.split(/\s+/).map(function(comp) {
return replaceXRange(comp, loose);
return replaceXRange(comp, options);
}).join(' ');
}
function replaceXRange(comp, loose) {
function replaceXRange(comp, options) {
comp = comp.trim();
var r = loose ? re[XRANGELOOSE] : re[XRANGE];
if (!options || typeof options !== 'object')
options = { loose: !!options, includePrerelease: false }
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
debug('xRange', comp, ret, gtlt, M, m, p, pr);
var xM = isX(M);
@ -11627,8 +11652,8 @@ function replaceXRange(comp, loose) {
// Because * is AND-ed with everything else in the comparator,
// and '' means "any version", just remove the *s entirely.
function replaceStars(comp, loose) {
debug('replaceStars', comp, loose);
function replaceStars(comp, options) {
debug('replaceStars', comp, options);
// Looseness is ignored here. star is always as loose as it gets!
return comp.trim().replace(re[STAR], '');
}
@ -11672,22 +11697,25 @@ Range.prototype.test = function(version) {
return false;
if (typeof version === 'string')
version = new SemVer(version, this.loose);
version = new SemVer(version, this.options);
for (var i = 0; i < this.set.length; i++) {
if (testSet(this.set[i], version))
if (testSet(this.set[i], version, this.options))
return true;
}
return false;
};
function testSet(set, version) {
function testSet(set, version, options) {
for (var i = 0; i < set.length; i++) {
if (!set[i].test(version))
return false;
}
if (version.prerelease.length) {
if (!options)
options = {}
if (version.prerelease.length && !options.includePrerelease) {
// Find the set of versions that are allowed to have prereleases
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
// That should allow `1.2.3-pr.2` to pass.
@ -11715,9 +11743,9 @@ function testSet(set, version) {
}
exports.satisfies = satisfies;
function satisfies(version, range, loose) {
function satisfies(version, range, options) {
try {
range = new Range(range, loose);
range = new Range(range, options);
} catch (er) {
return false;
}
@ -11725,19 +11753,19 @@ function satisfies(version, range, loose) {
}
exports.maxSatisfying = maxSatisfying;
function maxSatisfying(versions, range, loose) {
function maxSatisfying(versions, range, options) {
var max = null;
var maxSV = null;
try {
var rangeObj = new Range(range, loose);
var rangeObj = new Range(range, options);
} catch (er) {
return null;
}
versions.forEach(function (v) {
if (rangeObj.test(v)) { // satisfies(v, range, loose)
if (rangeObj.test(v)) { // satisfies(v, range, options)
if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
max = v;
maxSV = new SemVer(max, loose);
maxSV = new SemVer(max, options);
}
}
})
@ -11745,19 +11773,19 @@ function maxSatisfying(versions, range, loose) {
}
exports.minSatisfying = minSatisfying;
function minSatisfying(versions, range, loose) {
function minSatisfying(versions, range, options) {
var min = null;
var minSV = null;
try {
var rangeObj = new Range(range, loose);
var rangeObj = new Range(range, options);
} catch (er) {
return null;
}
versions.forEach(function (v) {
if (rangeObj.test(v)) { // satisfies(v, range, loose)
if (rangeObj.test(v)) { // satisfies(v, range, options)
if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
min = v;
minSV = new SemVer(min, loose);
minSV = new SemVer(min, options);
}
}
})
@ -11765,11 +11793,11 @@ function minSatisfying(versions, range, loose) {
}
exports.validRange = validRange;
function validRange(range, loose) {
function validRange(range, options) {
try {
// Return '*' instead of '' so that truthiness works.
// This will throw if it's invalid anyway
return new Range(range, loose).range || '*';
return new Range(range, options).range || '*';
} catch (er) {
return null;
}
@ -11777,20 +11805,20 @@ function validRange(range, loose) {
// Determine if version is less than all the versions possible in the range
exports.ltr = ltr;
function ltr(version, range, loose) {
return outside(version, range, '<', loose);
function ltr(version, range, options) {
return outside(version, range, '<', options);
}
// Determine if version is greater than all the versions possible in the range.
exports.gtr = gtr;
function gtr(version, range, loose) {
return outside(version, range, '>', loose);
function gtr(version, range, options) {
return outside(version, range, '>', options);
}
exports.outside = outside;
function outside(version, range, hilo, loose) {
version = new SemVer(version, loose);
range = new Range(range, loose);
function outside(version, range, hilo, options) {
version = new SemVer(version, options);
range = new Range(range, options);
var gtfn, ltefn, ltfn, comp, ecomp;
switch (hilo) {
@ -11813,7 +11841,7 @@ function outside(version, range, hilo, loose) {
}
// If it satisifes the range it is not outside
if (satisfies(version, range, loose)) {
if (satisfies(version, range, options)) {
return false;
}
@ -11832,9 +11860,9 @@ function outside(version, range, hilo, loose) {
}
high = high || comparator;
low = low || comparator;
if (gtfn(comparator.semver, high.semver, loose)) {
if (gtfn(comparator.semver, high.semver, options)) {
high = comparator;
} else if (ltfn(comparator.semver, low.semver, loose)) {
} else if (ltfn(comparator.semver, low.semver, options)) {
low = comparator;
}
});
@ -11858,15 +11886,15 @@ function outside(version, range, hilo, loose) {
}
exports.prerelease = prerelease;
function prerelease(version, loose) {
var parsed = parse(version, loose);
function prerelease(version, options) {
var parsed = parse(version, options);
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
}
exports.intersects = intersects;
function intersects(r1, r2, loose) {
r1 = new Range(r1, loose)
r2 = new Range(r2, loose)
function intersects(r1, r2, options) {
r1 = new Range(r1, options)
r2 = new Range(r2, options)
return r1.intersects(r2)
}
@ -11911,10 +11939,10 @@ module.exports = {
};
},{}],6:[function(require,module,exports){
/*!
/*
* Bootlint - an HTML linter for Bootstrap projects
* https://github.com/twbs/bootlint
* Copyright (c) 2014-2018 The Bootlint Authors
* Copyright (c) 2014-2019 The Bootlint Authors
* Licensed under the MIT License.
*/
@ -11923,6 +11951,7 @@ var parseUrl = require('url').parse;
var semver = require('semver');
var voidElements = require('void-elements');
var _location = require('./location');
var LocationIndex = _location.LocationIndex;
(function (exports) {
@ -11945,8 +11974,8 @@ var LocationIndex = _location.LocationIndex;
};
var NUM2SCREEN = ['xs', 'sm', 'md', 'lg'];
var IN_NODE_JS = Boolean(cheerio.load);
var MIN_JQUERY_VERSION = '1.9.1'; // as of Bootstrap v3.3.0
var CURRENT_BOOTSTRAP_VERSION = '3.3.7';
var MIN_JQUERY_VERSION = '1.9.1'; // as of Bootstrap v3.3.0
var CURRENT_BOOTSTRAP_VERSION = '3.4.0';
var BOOTSTRAP_VERSION_4 = '4.0.0';
var PLUGINS = [
'affix',
@ -12056,7 +12085,7 @@ var LocationIndex = _location.LocationIndex;
}
for (width in width2screens) {
if (width2screens.hasOwnProperty(width)) {
if (Object.prototype.hasOwnProperty.call(width2screens, 'width')) {
width2screens[width].sort(compareNums);
}
}
@ -12533,7 +12562,6 @@ var LocationIndex = _location.LocationIndex;
reporter(NON_HTML5_DOCTYPE);
}
};
})());
addLinter('E002', function lintBootstrapv2($, reporter) {
var columnClasses = [];

33
dist/browser/bootlint.min.js поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
dist/browser/bootlint.min.js.map поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны