Skip to content

Commit

Permalink
dist update
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Jul 17, 2024
1 parent 1d9d663 commit bd83f33
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
34 changes: 24 additions & 10 deletions dist/tools/libs/semver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@ var hasRequiredRange;
function requireRange () {
if (hasRequiredRange) return range;
hasRequiredRange = 1;
const SPACE_CHARACTERS = /\s+/g;

// hoisted class for cyclic dependency
class Range {
constructor (range, options) {
Expand All @@ -982,7 +984,7 @@ function requireRange () {
// just put it in the set and return
this.raw = range.value;
this.set = [[range]];
this.format();
this.formatted = undefined;
return this
}

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

// First, split on ||
this.set = this.raw
Expand Down Expand Up @@ -1030,14 +1029,29 @@ function requireRange () {
}
}

this.format();
this.formatted = undefined;
}

get range () {
if (this.formatted === undefined) {
this.formatted = '';
for (let i = 0; i < this.set.length; i++) {
if (i > 0) {
this.formatted += '||';
}
const comps = this.set[i];
for (let k = 0; k < comps.length; k++) {
if (k > 0) {
this.formatted += ' ';
}
this.formatted += comps[k].toString().trim();
}
}
}
return this.formatted
}

format () {
this.range = this.set
.map((comps) => comps.join(' ').trim())
.join('||')
.trim();
return this.range
}

Expand Down
2 changes: 1 addition & 1 deletion dist/tools/libs/semver.mjs.map

Large diffs are not rendered by default.

0 comments on commit bd83f33

Please sign in to comment.