Skip to content

Commit bd83f33

Browse files
committed
dist update
1 parent 1d9d663 commit bd83f33

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

dist/tools/libs/semver.mjs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,8 @@ var hasRequiredRange;
962962
function requireRange () {
963963
if (hasRequiredRange) return range;
964964
hasRequiredRange = 1;
965+
const SPACE_CHARACTERS = /\s+/g;
966+
965967
// hoisted class for cyclic dependency
966968
class Range {
967969
constructor (range, options) {
@@ -982,7 +984,7 @@ function requireRange () {
982984
// just put it in the set and return
983985
this.raw = range.value;
984986
this.set = [[range]];
985-
this.format();
987+
this.formatted = undefined;
986988
return this
987989
}
988990

@@ -993,10 +995,7 @@ function requireRange () {
993995
// First reduce all whitespace as much as possible so we do not have to rely
994996
// on potentially slow regexes like \s*. This is then stored and used for
995997
// future error messages as well.
996-
this.raw = range
997-
.trim()
998-
.split(/\s+/)
999-
.join(' ');
998+
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
1000999

10011000
// First, split on ||
10021001
this.set = this.raw
@@ -1030,14 +1029,29 @@ function requireRange () {
10301029
}
10311030
}
10321031

1033-
this.format();
1032+
this.formatted = undefined;
1033+
}
1034+
1035+
get range () {
1036+
if (this.formatted === undefined) {
1037+
this.formatted = '';
1038+
for (let i = 0; i < this.set.length; i++) {
1039+
if (i > 0) {
1040+
this.formatted += '||';
1041+
}
1042+
const comps = this.set[i];
1043+
for (let k = 0; k < comps.length; k++) {
1044+
if (k > 0) {
1045+
this.formatted += ' ';
1046+
}
1047+
this.formatted += comps[k].toString().trim();
1048+
}
1049+
}
1050+
}
1051+
return this.formatted
10341052
}
10351053

10361054
format () {
1037-
this.range = this.set
1038-
.map((comps) => comps.join(' ').trim())
1039-
.join('||')
1040-
.trim();
10411055
return this.range
10421056
}
10431057

dist/tools/libs/semver.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)